Re: RFR: 8226919: attach in linux hangs due to permission denied accessing /proc/pid/root

2024-05-01 Thread Larry Cable
On Tue, 30 Jan 2024 12:13:05 GMT, Per Lundberg wrote: >> 8226919: attach in linux hangs due to permission denied accessing >> /proc/pid/root > > src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java line > 217: > >> 215: // Instead, attach relative to the target root fi

Re: RFR: 8226919: attach in linux hangs due to permission denied accessing /proc/pid/root

2024-05-01 Thread Larry Cable
On Wed, 1 May 2024 17:47:47 GMT, Sebastian Lövdahl wrote: >> should it not be comparing pid namespace ids and not pids? > > Do you mean that it should compare the input PID against the outermost > (leftmost) PID in the `NSpid` list from `/proc//status` and not > innermost (rightmost) as is done

Re: RFR: 8226919: attach in linux hangs due to permission denied accessing /proc/pid/root

2024-05-01 Thread Larry Cable
On Wed, 1 May 2024 18:35:29 GMT, Larry Cable wrote: >> Do you mean that it should compare the input PID against the outermost >> (leftmost) PID in the `NSpid` list from `/proc//status` and not >> innermost (rightmost) as is done right now? What would be the benefit of >&g

Re: RFR: 8226919: attach in linux hangs due to permission denied accessing /proc/pid/root

2024-05-01 Thread Larry Cable
On Wed, 1 May 2024 20:07:00 GMT, Larry Cable wrote: >> c.f: /proc//ns/pid >> >> every (Linux) namespace has a unique id, if 2 (or more) processes occupy the >> same pid namespace (or any other for that matter) then their ../ns/pid >>

Re: RFR: 8327114: Attach in Linux may have wrong behaviour when pid == ns_pid (Kubernetes debug container) [v2]

2024-05-06 Thread Larry Cable
d528d72d83f56cd098b__;!!ACWV5N9M2RV99hQ!M_KzQgiC8WkHTfJnvTw6zsw7l0RACDgJU3ShDs0R1dAWE_IxEinuX1_Uqom0UPt96Bl6iEqHc-yUUmz5svPHZrq9ZQ$>. > > Local testing and |make test > TEST="jtreg:test/hotspot/jtreg/containers"| + |make test > TEST="jtreg:test/hotspot/jtreg/serviceability"| indicate that all the > kn

Re: RFR: 8327114: Attach in Linux may have wrong behaviour when pid == ns_pid (Kubernetes debug container) [v3]

2024-05-21 Thread Larry Cable
nce the last revision: > > - Remove unused `SELF_PID_NS` > - Rewrite in line with suggestion from Larry Cable Hi Sebastian! On 5/21/24 9:50 AM, Sebastian Lövdahl wrote: > > In these cases, is it not a requirement that jcmd is run as root? > So even if the target process is run wi

Re: RFR: 8327114: Attach in Linux may have wrong behaviour when pid == ns_pid (Kubernetes debug container) [v3]

2024-05-22 Thread Larry Cable
nce the last revision: > > - Remove unused `SELF_PID_NS` > - Rewrite in line with suggestion from Larry Cable I haven't but I will BTW which linux capabilities should be enabled in order to prevent a /proc/... style attach due to lack of permissions to access target's /proc fs? Rgds

Re: RFR: 8327114: Attach in Linux may have wrong behaviour when pid == ns_pid (Kubernetes debug container) [v3]

2024-05-22 Thread Larry Cable
nce the last revision: > > - Remove unused `SELF_PID_NS` > - Rewrite in line with suggestion from Larry Cable On 5/22/24 11:58 AM, Sebastian Lövdahl wrote: > > I haven't but I will BTW which linux capabilities should be > enabled in order to prevent a /proc/... style attac

Re: RFR: 8327114: Attach in Linux may have wrong behaviour when pid == ns_pid (Kubernetes debug container) [v3]

2024-06-03 Thread Larry Cable
nce the last revision: > > - Remove unused `SELF_PID_NS` > - Rewrite in line with suggestion from Larry Cable Hi Sebastian, sadly no I haven't. :( it would be good to get it in, it would be good if @kevinjwalls could take a look. as with regressions, I think as long as it passes the c

Re: RFR: 8327114: Attach in Linux may have wrong behaviour when pid == ns_pid (Kubernetes debug container) [v3]

2024-06-03 Thread Larry Cable
nce the last revision: > > - Remove unused `SELF_PID_NS` > - Rewrite in line with suggestion from Larry Cable going to take a look at a couple of the "containers" tests to see if I can "quickly" clone them to provide a bootstrap for this patch... - Larry On 6/3/24 10:24 AM,

Re: RFR: 8327114: Attach in Linux may have wrong behaviour when pid == ns_pid (Kubernetes debug container) [v3]

2024-06-03 Thread Larry Cable
nce the last revision: > > - Remove unused `SELF_PID_NS` > - Rewrite in line with suggestion from Larry Cable On 6/3/24 10:24 AM, Sebastian Lövdahl wrote: > > Hi Larry, no worries. :) > > I can try to look into writing some tests for the elevated use-cases. > but it will be quite mu

Re: RFR: 8327114: Attach in Linux may have wrong behaviour when pid == ns_pid (Kubernetes debug container) [v3]

2024-06-03 Thread Larry Cable
nce the last revision: > > - Remove unused `SELF_PID_NS` > - Rewrite in line with suggestion from Larry Cable it looks as though I can take an existing jcmd test in the container tests and quite quickly implement an 'elevated' sidecar test... I'll work on that today and tomorro

Re: RFR: 8261242: [Linux] OSContainer::is_containerized() returns true when run outside a container [v7]

2024-06-27 Thread Larry Cable
On Tue, 25 Jun 2024 13:54:46 GMT, Severin Gehwolf wrote: >> Please review this enhancement to the container detection code which allows >> it to figure out whether the JVM is actually running inside a container >> (`podman`, `docker`, `crio`), or with some other means that enforces >> memory/c

Re: RFR: 8261242: [Linux] OSContainer::is_containerized() returns true when run outside a container [v7]

2024-06-27 Thread Larry Cable
On Tue, 25 Jun 2024 13:54:46 GMT, Severin Gehwolf wrote: >> Please review this enhancement to the container detection code which allows >> it to figure out whether the JVM is actually running inside a container >> (`podman`, `docker`, `crio`), or with some other means that enforces >> memory/c

Re: RFR: 8261242: [Linux] OSContainer::is_containerized() returns true when run outside a container [v8]

2024-06-28 Thread Larry Cable
more: https://git.openjdk.org/jdk/compare/486aa11e...1017da35 On 6/28/24 8:47 AM, Severin Gehwolf wrote: > > @adinn > <https://urldefense.com/v3/__https://github.com/adinn__;!!ACWV5N9M2RV99hQ!JFioMWt3M387QFQK8UEgSmPMiy736aUVfLbZdVscJ-BDxoO9GjUqLFHtvCkNB5oG3MBadzdxxytGTNNNu9cWG6X3BQ$> > > @iklam > <https:/

RFR: JDK-8327114: fix to resolve permissions issue as per: 8341246

2024-10-02 Thread Larry Cable
this is a fix to: https://bugs.openjdk.org/browse/JDK-8327114 to resolve an issue detected in: https://bugs.openjdk.org/browse/JDK-8341246 sym link file accesses should be performed as "privileged" actions. - Commit messages: - JDK-8327114: fix to resolve permissions issue as pe

Re: RFR: JDK-8327114: fix to resolve permissions issue as per: 8341246

2024-10-02 Thread Larry Cable
On Wed, 2 Oct 2024 19:55:29 GMT, Larry Cable wrote: > this is a fix to: https://bugs.openjdk.org/browse/JDK-8327114 > > to resolve an issue detected in: > > https://bugs.openjdk.org/browse/JDK-8341246 > > sym link file accesses should be performed as "privileg

Re: RFR: 8342449: reimplement: JDK-8327114 Attach in Linux may have wrong behavior when pid == ns_pid [v2]

2024-10-29 Thread Larry Cable
On Tue, 29 Oct 2024 16:41:31 GMT, Kevin Walls wrote: >> Larry Cable has updated the pull request incrementally with one additional >> commit since the last revision: >> >> JDK-8342449: changed logic of attach loop to throw if target still not >> ready w

Re: RFR: 8342449: reimplement: JDK-8327114 Attach in Linux may have wrong behavior when pid == ns_pid [v3]

2024-10-30 Thread Larry Cable
; can handshake with a descendant "attachee" in > this fashion. > > therefore an "attacher" has two choices when attempting to attach: > > - use the /proc//root/tmp path to the "attachee's" /tmp (or its cwd) > - this works with both peers an

Re: RFR: 8342449: reimplement: JDK-8327114 Attach in Linux may have wrong behavior when pid == ns_pid [v2]

2024-10-28 Thread Larry Cable
; can handshake with a descendant "attachee" in > this fashion. > > therefore an "attacher" has two choices when attempting to attach: > > - use the /proc//root/tmp path to the "attachee's" /tmp (or its cwd) > - this works with both peers an

Re: RFR: 8341482: Attach API access to /proc filesystem should use doPrivileged [v2]

2024-10-23 Thread Larry Cable
On Wed, 2 Oct 2024 21:15:11 GMT, Larry Cable wrote: >> this is a fix to: https://bugs.openjdk.org/browse/JDK-8327114 >> >> to resolve an issue detected in: >> >> https://bugs.openjdk.org/browse/JDK-8341246 >> >> /proc/**/* file accesses shou

Withdrawn: 8341482: Attach API access to /proc filesystem should use doPrivileged

2024-10-23 Thread Larry Cable
On Wed, 2 Oct 2024 19:55:29 GMT, Larry Cable wrote: > this is a fix to: https://bugs.openjdk.org/browse/JDK-8327114 > > to resolve an issue detected in: > > https://bugs.openjdk.org/browse/JDK-8341246 > > /proc/**/* file accesses should be performed as "pr

Re: RFR: 8342449: reimplement: JDK-8327114 Attach in Linux may have wrong behavior when pid == ns_pid [v4]

2024-11-12 Thread Larry Cable
; can handshake with a descendant "attachee" in > this fashion. > > therefore an "attacher" has two choices when attempting to attach: > > - use the /proc//root/tmp path to the "attachee's" /tmp (or its cwd) > - this works with both peers an

Re: RFR: 8327114: Attach in Linux may have wrong behaviour when pid == ns_pid (Kubernetes debug container) [v6]

2024-09-25 Thread Larry Cable
On Tue, 2 Jul 2024 11:07:56 GMT, Sebastian Lövdahl wrote: >> 8327114: Attach in Linux may have wrong behaviour when pid == ns_pid >> (Kubernetes debug container) > > Sebastian Lövdahl has updated the pull request incrementally with one > additional commit since the last revision: > > Clarify

Re: RFR: 8327114: Attach in Linux may have wrong behaviour when pid == ns_pid (Kubernetes debug container) [v6]

2024-09-27 Thread Larry Cable
On Fri, 27 Sep 2024 15:17:18 GMT, Severin Gehwolf wrote: >> Still waiting for another reviewer. > > @slovdahl Could you please merge in latest master into your branch and push > so that the GHA checks are more up-to-date. It looks like the last update was > in July. Thanks! @jerboaa many thank

Re: RFR: 8327114: Attach in Linux may have wrong behaviour when pid == ns_pid (Kubernetes debug container) [v7]

2024-10-01 Thread Larry Cable
Clarify PID 1 check with comment > - Adapt code style > - Add test for the elevated privileges case > - Remove unused `SELF_PID_NS` > - Rewrite in line with suggestion from Larry Cable > - Reworked attach logic > - 8327114: Attach in Linux may have wrong behaviour when pid =

Re: RFR: JDK-8327114: fix to resolve permissions issue as per: 8341246 [v2]

2024-10-02 Thread Larry Cable
> this is a fix to: https://bugs.openjdk.org/browse/JDK-8327114 > > to resolve an issue detected in: > > https://bugs.openjdk.org/browse/JDK-8341246 > > sym link file accesses should be performed as "privileged" actions. Larry Cable has updated the pull

Re: RFR: 8341482: Attach API access to /proc filesystem should use doPrivileged [v2]

2024-10-03 Thread Larry Cable
On Wed, 2 Oct 2024 21:15:11 GMT, Larry Cable wrote: >> this is a fix to: https://bugs.openjdk.org/browse/JDK-8327114 >> >> to resolve an issue detected in: >> >> https://bugs.openjdk.org/browse/JDK-8341246 >> >> /proc/**/* file accesses shou

RFR: 8342449: reimplement: JDK-8327114 Attach in Linux may have wrong behavior when pid == ns_pid

2024-10-25 Thread Larry Cable
the implementation I originally provided does not in fact solve the issue! the attach protocol initiation "handshake" requires that the "attacher" (the caller of this code) and the "attachee"(the target JVM to be "attached" to) *must* share a "/tmp" (or access to the attachee's `cwd`) in common

Re: RFR: 8337199: Add jcmd Thread.vthread_summary diagnostic command

2024-11-25 Thread Larry Cable
On Thu, 14 Nov 2024 21:34:08 GMT, Larry Cable wrote: > c.f: > [https://bugs.openjdk.org/browse/JDK-8339420](https://bugs.openjdk.org/browse/JDK-8339420) > > Summary > --- > > Add `jcmd Thread.vthread_summary` to print summary information that is > useful when t

Re: RFR: 8342449: reimplement: JDK-8327114 Attach in Linux may have wrong behavior when pid == ns_pid [v4]

2024-11-18 Thread Larry Cable
On Tue, 12 Nov 2024 20:39:55 GMT, Larry Cable wrote: >> the implementation I originally provided does not in fact solve the issue! >> >> the attach protocol initiation "handshake" requires that the "attacher" (the >> caller of this code) and the &

Re: RFR: 8342449: reimplement: JDK-8327114 Attach in Linux may have wrong behavior when pid == ns_pid [v4]

2024-11-18 Thread Larry Cable
On Tue, 12 Nov 2024 20:39:55 GMT, Larry Cable wrote: >> the implementation I originally provided does not in fact solve the issue! >> >> the attach protocol initiation "handshake" requires that the "attacher" (the >> caller of this code) and the &

Integrated: 8342449: reimplement: JDK-8327114 Attach in Linux may have wrong behavior when pid == ns_pid

2024-11-19 Thread Larry Cable
On Thu, 24 Oct 2024 16:07:50 GMT, Larry Cable wrote: > the implementation I originally provided does not in fact solve the issue! > > the attach protocol initiation "handshake" requires that the "attacher" (the > caller of this code) and the "attache

RFR: 8337199: Add jcmd Thread.vthread_summary diagnostic command

2024-11-25 Thread Larry Cable
c.f: [https://bugs.openjdk.org/browse/JDK-8339420](https://bugs.openjdk.org/browse/JDK-8339420) Summary --- Add `jcmd Thread.vthread_summary` to print summary information that is useful when trying to diagnose issues with virtual threads. Problem --- The JDK is lacking tooling to di

Re: RFR: 8346082: Output JVMTI agent information is hserr files [v3]

2024-12-12 Thread Larry Cable
On Thu, 12 Dec 2024 12:41:28 GMT, Matthias Baesken wrote: >> We should output more information about the JVMTI agents in the hserr file. > > Matthias Baesken has updated the pull request incrementally with one > additional commit since the last revision: > > infos -> info I do not understand

Re: RFR: 8344671: Few JFR streaming tests fail with application not alive error on MacOS 15 [v2]

2025-04-05 Thread Larry Cable
On Thu, 27 Mar 2025 06:27:44 GMT, Jaikiran Pai wrote: >> Larry Cable has updated the pull request incrementally with three additional >> commits since the last revision: >> >> - Update src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c >> >

Integrated: 8344671: Few JFR streaming tests fail with application not alive error on MacOS 15

2025-04-05 Thread Larry Cable
On Mon, 17 Mar 2025 18:26:57 GMT, Larry Cable wrote: > on both Linux and MacOS libattach utilizes UNIX signal (QUIT) to cause a > target JVM (attachee) to create the socket file used as transport for > subsequent jcmds (and other attach based interactions) and to listen upon > t

RFR: 8344671: Few JFR streaming tests fail with application not alive error on MacOS 15

2025-03-26 Thread Larry Cable
on both Linux and MacOS libattach utilizes UNIX signal (QUIT) to cause a target JVM (attachee) to create the socket file used as transport for subsequent jcmds (and other attach based interactions) and to listen upon that for such. it should be noted that the default behavior for QUIT (if not bl

Re: RFR: 8344671: Few JFR streaming tests fail with application not alive error on MacOS 15 [v2]

2025-03-27 Thread Larry Cable
revious > implementation, however should the target JVM not > become "ready" (signal handlers installed) prior to the attach "timeout" > occurring the attach operation will throw an > "AttachNotSupportedException" with a suitable error message. > &g

Re: RFR: 8344671: Few JFR streaming tests fail with application not alive error on MacOS 15 [v3]

2025-03-27 Thread Larry Cable
revious > implementation, however should the target JVM not > become "ready" (signal handlers installed) prior to the attach "timeout" > occurring the attach operation will throw an > "AttachNotSupportedException" with a suitable error message. >

Re: RFR: 8344671: Few JFR streaming tests fail with application not alive error on MacOS 15 [v3]

2025-03-28 Thread Larry Cable
On Fri, 28 Mar 2025 05:39:27 GMT, David Holmes wrote: >> Larry Cable has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Merge branch 'JDK-8344671' of github.com:larry-cable/jdk into JDK-8344671 >>

Re: RFR: 8344671: Few JFR streaming tests fail with application not alive error on MacOS 15 [v3]

2025-03-28 Thread Larry Cable
On Fri, 28 Mar 2025 06:09:53 GMT, Serguei Spitsyn wrote: >> Larry Cable has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Merge branch 'JDK-8344671' of github.com:larry-cable/jdk into JDK-8344671 &g

Re: RFR: 8344671: Few JFR streaming tests fail with application not alive error on MacOS 15 [v4]

2025-03-28 Thread Larry Cable
revious > implementation, however should the target JVM not > become "ready" (signal handlers installed) prior to the attach "timeout" > occurring the attach operation will throw an > "AttachNotSupportedException" with a suitable error message. >

Re: RFR: 8344671: Few JFR streaming tests fail with application not alive error on MacOS 15 [v5]

2025-04-04 Thread Larry Cable
revious > implementation, however should the target JVM not > become "ready" (signal handlers installed) prior to the attach "timeout" > occurring the attach operation will throw an > "AttachNotSupportedException" with a suitable error message. >

Integrated: 8358077: sun.tools.attach.VirtualMachineImpl::checkCatchesAndSendQuitTo on Linux leaks file handles after JDK-8327114

2025-06-03 Thread Larry Cable
On Thu, 29 May 2025 19:14:06 GMT, Larry Cable wrote: > JDK-8358077:sun.tools.attach.VirtualMachineImpl::checkCatchesAndSendQuitTo on > Linux leaks file handles after JDK-8327114 > > modified the code to place the `Files::lines` in a `try-with-resources` block > in order t

RFR: 8358077: sun.tools.attach.VirtualMachineImpl::checkCatchesAndSendQuitTo on Linux leaks file handles after JDK-8327114

2025-05-30 Thread Larry Cable
JDK-8358077:sun.tools.attach.VirtualMachineImpl::checkCatchesAndSendQuitTo on Linux leaks file handles after JDK-8327114 modified the code to place the `Files::lines` in a `try-with-resources` block in order to autoclose the `Stream` and underlying file resources immediately. - Com