[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240906205436.GA2417@redhat.com>
Date: Fri, 6 Sep 2024 22:55:08 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Roman Kisel <romank@...ux.microsoft.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, apais@...rosoft.com,
benhill@...rosoft.com, ssengar@...rosoft.com,
sunilmut@...rosoft.com, vdso@...bites.dev
Subject: Re: [PATCH 1/1] ptrace: Get tracer PID without reliance on the proc
FS
Well, I leave this to you and Linus (and other reviewers), but if it was not
clear I too do not really like this feature, that is why I added cc's.
Perhaps it makes sense to discuss the alternatives? Say, a process can have a
please_insert_the_breakpoint_here() function implemented in asm which just does
asm(ret).
Then something like
#define breakpoint_if_debugging() \
asm volatile ("call please_insert_the_breakpoint_here" : ASM_CALL_CONSTRAINT);
if the process is ptraced, debugger can insert the breakoint into
please_insert_the_breakpoint_here(). Otherwise breakpoint_if_debugging()
is a cheap nop.
Not that I think this is a good idea, but std::breakpoint_if_debugging()
looks even more strange to me...
Oleg.
On 09/06, Roman Kisel wrote:
>
> All told, let me know if I may proceed with fixing the code as Oleg
> suggested, or this piece should go into the waste basket. I could make
> an argument that providing the way to get the tracer PID only via
> proc FS through parsing text is more like shell/Perl/Python interface
> to the kernel, and for compiled languages could have what's easier in
> that setting (there is an easy syscall for getting PID, and there could
> be code changing the logic on the PID being odd or even for the sake
> of argument).
>
> >
> > Linus
>
> --
> Thank you,
> Roman
>
Powered by blists - more mailing lists