Skip to contentSkip to conversation

ptrace.2: Add details about usage of PTRACE_GET_SYSCALL_INFO

PATCH In review Fotios Valasiadis 3 participants 19 messages Feb 25, 2023 – Mar 1, 2023 1 message not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ptrace.2: Add details about usage of PTRACE_GET_SYSCALL_INFO

Document the role of PTRACE_O_TRACESYSGOOD option in connection with PTRACE_GET_SYSCALL_INFO.

Complements: fc91449cb "ptrace.2: Document PTRACE_GET_SYSCALL_INFO"

---
 man2/ptrace.2 | 9 +++++++++
 1 file changed, 9 insertions(+)
man2/ptrace.2 +9 -0
index 55d9fd36d..ad0543b0b 100644
@@ -1111,6 +1111,15 @@ stop.
 .B PTRACE_SYSCALL_INFO_NONE
 No component of the union contains relevant information.
 .RE
+.IP
+Note that in case of
+syscall entry or exit stops, the data returned by
+.B PTRACE_GET_SYSCALL_INFO
+is limited to type
+.B PTRACE_SYSCALL_INFO_NONE
+unless
+.B PTRACE_O_TRACESYSGOOD
+option is set before the corresponding ptrace stop has occurred.
 .\"
 .SS Death under ptrace
 When a (possibly multithreaded) process receives a killing signal
Signature · 1 line
2.39.2
#1 lore raw

Hi Fotios,

Quoted 14 lines · Fotios Valasiadis

Document the role of PTRACE_O_TRACESYSGOOD option in connection with PTRACE_GET_SYSCALL_INFO.

Complements: fc91449cb "ptrace.2: Document PTRACE_GET_SYSCALL_INFO"

---
 man2/ptrace.2 | 9 +++++++++
 1 file changed, 9 insertions(+)
man2/ptrace.2 +0 -0
index 55d9fd36d..ad0543b0b 100644

man2/ptrace.2 stop. · line 1115

Quoted 5 lines
man2/ptrace.2 +2 -0
@@ -1111,6 +1111,15 @@ stop.
 .B PTRACE_SYSCALL_INFO_NONE
 No component of the union contains relevant information.
 .RE
+.IP
+Note that in case of

"Note that" is usually redundant.
See:
<https://lore.kernel.org/linux-man/[email protected]/>
<https://lore.kernel.org/linux-man/20230105225235.6cjtz6orjzxzvo6v@illithid/>

man2/ptrace.2 stop. · line 1116

Quoted 1 line
man2/ptrace.2 +1 -0
+syscall entry or exit stops, the data returned by

Please use semantic newlines. See man-pages(7):

Use semantic newlines
In the source of a manual page, new sentences should be started on new lines, long sentences should be split into lines at clause breaks (com‐ mas, semicolons, colons, and so on), and long clauses should be split
at phrase boundaries. This convention, sometimes known as "semantic
newlines", makes it easier to see the effect of patches, which often operate at the level of individual sentences, clauses, or phrases.

man2/ptrace.2 stop. · line 1122

Quoted 6 lines
man2/ptrace.2 +6 -0
+.B PTRACE_GET_SYSCALL_INFO
+is limited to type
+.B PTRACE_SYSCALL_INFO_NONE
+unless
+.B PTRACE_O_TRACESYSGOOD
+option is set before the corresponding ptrace stop has occurred.

You should say
.BR ptrace ()
right?
Or is unformatted ptrace common in this page?

Cheers,

Alex

Quoted 3 lines
man2/ptrace.2 +0 -0
 .\"
 .SS Death under ptrace
 When a (possibly multithreaded) process receives a killing signal
Signature · 2 lines
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
#2 lore raw

On Sun, Feb 26, 2023 at 10:58:02PM +0100, Alejandro Colomar wrote:
[...]

Quoted 11 lines

man2/ptrace.2 stop. · line 1122

Quoted 6 lines

+.B PTRACE_GET_SYSCALL_INFO

man2/ptrace.2 +5 -0
+is limited to type
+.B PTRACE_SYSCALL_INFO_NONE
+unless
+.B PTRACE_O_TRACESYSGOOD
+option is set before the corresponding ptrace stop has occurred.

You should say
.BR ptrace ()
right?
Or is unformatted ptrace common in this page?

Or just say "syscall stop".

Signature · 1 line
ldv
#3 lore raw

Hi Dmitry,

Quoted 14 lines · Dmitry V . Levin

On Sun, Feb 26, 2023 at 10:58:02PM +0100, Alejandro Colomar wrote:
[...]

Quoted 11 lines

man2/ptrace.2 stop. · line 1122

Quoted 6 lines

+.B PTRACE_GET_SYSCALL_INFO

man2/ptrace.2 +5 -0
+is limited to type
+.B PTRACE_SYSCALL_INFO_NONE
+unless
+.B PTRACE_O_TRACESYSGOOD
+option is set before the corresponding ptrace stop has occurred.

You should say
.BR ptrace ()
right?
Or is unformatted ptrace common in this page?

Quoted 1 line

Or just say "syscall stop".

Sure, that would work. BTW, se prefer system call over syscall (there's not much consistency regarding that, but let's try to achieve it).

Thanks,

Alex

Quoted 2 lines
Signature · 2 lines
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
#4 lore raw

Ahhhh hello everyone! Give me 20 minutes and I will make the changes as requested!

By the way this patch is the very first patch I do through emails! I am using git format-patch and git send-email, is it okay for me to be opening a new thread for each change you request? Or should I send the new patches in the same thread as responses?

Is there a universal standard or is it per project? Any guidance shall be greatly appreciated!

Thanks!

-- fvalasiad --

Quoted 24 lines · Alejandro Colomar

Hi Dmitry,

Quoted 12 lines · Dmitry V . Levin

On Sun, Feb 26, 2023 at 10:58:02PM +0100, Alejandro Colomar wrote:
[...]

Quoted 10 lines

man2/ptrace.2 stop. · line 1122

Quoted 6 lines

+.B PTRACE_GET_SYSCALL_INFO

man2/ptrace.2 +5 -0
+is limited to type
+.B PTRACE_SYSCALL_INFO_NONE
+unless
+.B PTRACE_O_TRACESYSGOOD
+option is set before the corresponding ptrace stop has occurred.

You should say
.BR ptrace ()
right?
Or is unformatted ptrace common in this page?

Quoted 1 line

Or just say "syscall stop".

Sure, that would work. BTW, se prefer system call over syscall (there's not much consistency regarding that, but let's try to achieve it).

Thanks,

Alex

Quoted 1 line
#5 lore raw

Hi Φώτης,

Quoted 7 lines · Φώτης Βαλασιάδης

Ahhhh hello everyone! Give me 20 minutes and I will make the changes as requested!

By the way this patch is the very first patch I do through emails! I am using git format-patch and git send-email, is it okay for me to be opening a new thread for each change you request? Or should I send the new patches in the same thread as responses?

It is good to keep them in the same thread,
which you can do with --in-reply-to= in git-format-patch(1). In that case, I usually make it a reply of the previous patch (not replies to it), or of the cover letter for patch sets.

That makes it easy for someone in the future to find stuff in the mailing list. For me right now it's not so much of a problem, and I usually don't even check if someone made it a reply or not; it's just a matter of how useful it will be in the future (for insignificant patches I just send new threads).

Quoted 3 lines

Is there a universal standard or is it per project? Any guidance shall be greatly appreciated!

I'd say there's no standards, but if you reply to the old thread by default, it will be better than starting a new thread. I can't imagine why some project would want to avoid that. It's more work on your side though, so for small patches that just fix a typo, you may not want to do it.

Quoted 2 lines

Thanks!

Cheers,

Alex

Quoted 2 lines

-- fvalasiad --

P.S.: If you want to sign the patch with your name in non-Latin] letters (is that Greek?), that's fine by me. Whatever you prefer. ;)

Quoted 26 lines · Alejandro Colomar
Quoted 24 lines

Hi Dmitry,

Quoted 12 lines · Dmitry V . Levin

On Sun, Feb 26, 2023 at 10:58:02PM +0100, Alejandro Colomar wrote:
[...]

Quoted 10 lines

man2/ptrace.2 stop. · line 1122

Quoted 6 lines

+.B PTRACE_GET_SYSCALL_INFO

man2/ptrace.2 +5 -0
+is limited to type
+.B PTRACE_SYSCALL_INFO_NONE
+unless
+.B PTRACE_O_TRACESYSGOOD
+option is set before the corresponding ptrace stop has occurred.

You should say
.BR ptrace ()
right?
Or is unformatted ptrace common in this page?

Quoted 1 line

Or just say "syscall stop".

Sure, that would work. BTW, se prefer system call over syscall (there's not much consistency regarding that, but let's try to achieve it).

Thanks,

Alex

Quoted 1 line
Signature · 2 lines
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
#6 lore raw

Tried my best, hope I did it right!

Thanks for the assist!

And yes, it's Greek! Signing off with my github username most of the time.

Thanks again, here you go!

Βαλασιάδης Φώτιος

Quoted 62 lines · Alejandro Colomar

Hi Φώτης,

Quoted 7 lines · Φώτης Βαλασιάδης

Ahhhh hello everyone! Give me 20 minutes and I will make the changes as requested!

By the way this patch is the very first patch I do through emails! I am using git format-patch and git send-email, is it okay for me to be opening a new thread for each change you request? Or should I send the new patches in the same thread as responses?

It is good to keep them in the same thread,
which you can do with --in-reply-to= in git-format-patch(1). In that case, I usually make it a reply of the previous patch (not replies to it), or of the cover letter for patch sets.

That makes it easy for someone in the future to find stuff in the mailing list. For me right now it's not so much of a problem, and I usually don't even check if someone made it a reply or not; it's just a matter of how useful it will be in the future (for insignificant patches I just send new threads).

Quoted 2 lines

Is there a universal standard or is it per project? Any guidance shall be greatly appreciated!

I'd say there's no standards, but if you reply to the old thread by default, it will be better than starting a new thread. I can't imagine why some project would want to avoid that. It's more work on your side though, so for small patches that just fix a typo, you may not want to do it.

Quoted 1 line

Thanks!

Cheers,

Alex

Quoted 1 line

-- fvalasiad --

P.S.: If you want to sign the patch with your name in non-Latin] letters (is that Greek?), that's fine by me. Whatever you prefer. ;)

Quoted 24 lines · Alejandro Colomar
Quoted 23 lines

Hi Dmitry,

Quoted 12 lines · Dmitry V . Levin

On Sun, Feb 26, 2023 at 10:58:02PM +0100, Alejandro Colomar wrote:
[...]

Quoted 10 lines

man2/ptrace.2 stop. · line 1122

Quoted 6 lines

+.B PTRACE_GET_SYSCALL_INFO

man2/ptrace.2 +5 -0
+is limited to type
+.B PTRACE_SYSCALL_INFO_NONE
+unless
+.B PTRACE_O_TRACESYSGOOD
+option is set before the corresponding ptrace stop has occurred.

You should say
.BR ptrace ()
right?
Or is unformatted ptrace common in this page?

Quoted 1 line

Or just say "syscall stop".

Sure, that would work. BTW, se prefer system call over syscall (there's not much consistency regarding that, but let's try to achieve it).

Thanks,

Alex

#7 lore raw

PATCH 1/1 ptrace.2: Add details about usage of PTRACE_GET_SYSCALL_INFO

In reply to Fotios Valasiadis

Document the role of PTRACE_O_TRACESYSGOOD option in connection with PTRACE_GET_SYSCALL_INFO.

Complements: fc91449cb "ptrace.2: Document PTRACE_GET_SYSCALL_INFO"

---
 man2/ptrace.2 | 9 +++++++++
 1 file changed, 9 insertions(+)
man2/ptrace.2 +9 -0
index 55d9fd36d..9737b3825 100644
@@ -1111,6 +1111,15 @@ stop.
 .B PTRACE_SYSCALL_INFO_NONE
 No component of the union contains relevant information.
 .RE
+.IP
+In case of system call entry or exit stops,
+the data returned by
+.B PTRACE_GET_SYSCALL_INFO
+is limited to type
+.B PTRACE_SYSCALL_INFO_NONE
+unless
+.B PTRACE_O_TRACESYSGOOD
+option is set before the corresponding system call stop has occurred.
 .\"
 .SS Death under ptrace
 When a (possibly multithreaded) process receives a killing signal
Signature · 1 line
2.39.2
Acked-by Nate Eldredge on v1 1/1
#8 lore raw

Hi Βαλασιάδης Φώτιος,

(did I write your name correctly?
I've seen it previously in the reverse order)

Quoted 5 lines · Fotios Valasiadis

Document the role of PTRACE_O_TRACESYSGOOD option in connection with PTRACE_GET_SYSCALL_INFO.

Complements: fc91449cb "ptrace.2: Document PTRACE_GET_SYSCALL_INFO"

Patch applied. Thanks!

I tweaked the commit message to include the original one, which was great. I forgot to mention this, but please keep the commit message for revisions of patches; it's always easier to discard some information later if it's unnecessary, but usually it's best to keep as much as possible in the commit message.

Quoted 24 lines
---
 man2/ptrace.2 | 9 +++++++++
 1 file changed, 9 insertions(+)
man2/ptrace.2 +9 -0
index 55d9fd36d..9737b3825 100644
@@ -1111,6 +1111,15 @@ stop.
 .B PTRACE_SYSCALL_INFO_NONE
 No component of the union contains relevant information.
 .RE
+.IP
+In case of system call entry or exit stops,
+the data returned by
+.B PTRACE_GET_SYSCALL_INFO
+is limited to type
+.B PTRACE_SYSCALL_INFO_NONE
+unless
+.B PTRACE_O_TRACESYSGOOD
+option is set before the corresponding system call stop has occurred.
 .\"
 .SS Death under ptrace
 When a (possibly multithreaded) process receives a killing signal
Quoted 5 lines · Φώτης Βαλασιάδης

Tried my best, hope I did it right!

Thanks for the assist!

And yes, it's Greek!

:-)

Quoted 1 line

Signing off with my github username most of the time.

Okay.

Quoted 4 lines

Thanks again, here you go!

Βαλασιάδης Φώτιος

The applied patch is below:

$ git show
commit f04064d73b9f60f189c490e7ef5c3b9fa5498920 (HEAD -> master)
Author: Fotios Valasiadis <[email protected]>
Date:   Mon Feb 27 01:22:01 2023 +0200

ptrace.2: Add details about usage of PTRACE_GET_SYSCALL_INFO

Document the role of PTRACE_O_TRACESYSGOOD option in connection with PTRACE_GET_SYSCALL_INFO.

Fixed incomplete doc. PTRACE_GET_SYSCALL_INFO's description wouldn't inform the user that they need to enable PTRACE_O_TRACESYSGOOD to get detailed information from said operation.

Came upon this bug after writing a test program using PTRACE_O_TRACESYSGOOD. After failing to find what's wrong I posted a stackoverflow question which you can find right here:
<https://stackoverflow.com/questions/72410182/ptrace-get-syscall-info-always-returns-info-op-as-ptrace-syscall-info-none>

Nate Eldredge found out what's wrong by looking into the kernel's source code, here is a link to the relevant part
<https://github.com/torvalds/linux/blob/8291eaafed36f575f23951f3ce18407f480e9ecf/kernel/ptrace.c#L1018>

In the code it can be seen that the union is filled if and only if the signal matches "SIGTRAP | 0x80", a signal which is only sent if the PTRACE_O_TRACESYSGOOD option is set. You can read about that in the PTRACE_O_TRACESYSGOOD section of ptrace(2)'s manual.

Complements: fc91449cb "ptrace.2: Document PTRACE_GET_SYSCALL_INFO"

man2/ptrace.2 +9 -0
index 55d9fd36d..9737b3825 100644
@@ -1111,6 +1111,15 @@ .SH DESCRIPTION
 .B PTRACE_SYSCALL_INFO_NONE
 No component of the union contains relevant information.
 .RE
+.IP
+In case of system call entry or exit stops,
+the data returned by
+.B PTRACE_GET_SYSCALL_INFO
+is limited to type
+.B PTRACE_SYSCALL_INFO_NONE
+unless
+.B PTRACE_O_TRACESYSGOOD
+option is set before the corresponding system call stop has occurred.
 .\"
 .SS Death under ptrace
 When a (possibly multithreaded) process receives a killing signal

Please confirm if you want me to push it like that, or if there's anything you'd like to tweak.

Cheers,

Alex

Signature · 2 lines
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
#9 lore raw

Ah yes sorry for the confusion.

First name is Φώτιος, surname Βαλασιάδης,
just call me Fotis!

we use both formats in Greece, confusing i know . :D

It's fine by me, you know best! But if I have to point something it's that Dmitry didn't like the word "Fixed" and we in fact agreed to replace:

Fixed incomplete doc. PTRACE_GET_SYSCALL_INFO's description wouldn't
inform the user that they need to enable PTRACE_O_TRACESYSGOOD to get detailed information from said operation.

with:

Document the role of PTRACE_O_TRACESYSGOOD option in connection with
PTRACE_GET_SYSCALL_INFO.

So perhaps you'd want to look into that? Can probably communicate on this with Dmitry so we can all agree to something.

I repeat though, from me it's all good, you know best!

Cheers!

-- fvalasiad --

Quoted 126 lines · Alejandro Colomar

Hi Βαλασιάδης Φώτιος,

(did I write your name correctly?
I've seen it previously in the reverse order)

Quoted 5 lines · Fotios Valasiadis

Document the role of PTRACE_O_TRACESYSGOOD option in connection with PTRACE_GET_SYSCALL_INFO.

Complements: fc91449cb "ptrace.2: Document PTRACE_GET_SYSCALL_INFO"

Patch applied. Thanks!

I tweaked the commit message to include the original one, which was great. I forgot to mention this, but please keep the commit message for revisions of patches; it's always easier to discard some information later if it's unnecessary, but usually it's best to keep as much as possible in the commit message.

Quoted 24 lines
---
  man2/ptrace.2 | 9 +++++++++
  1 file changed, 9 insertions(+)
man2/ptrace.2 +9 -0
index 55d9fd36d..9737b3825 100644
@@ -1111,6 +1111,15 @@ stop.
  .B PTRACE_SYSCALL_INFO_NONE
  No component of the union contains relevant information.
  .RE
+.IP
+In case of system call entry or exit stops,
+the data returned by
+.B PTRACE_GET_SYSCALL_INFO
+is limited to type
+.B PTRACE_SYSCALL_INFO_NONE
+unless
+.B PTRACE_O_TRACESYSGOOD
+option is set before the corresponding system call stop has occurred.
  .\"
  .SS Death under ptrace
  When a (possibly multithreaded) process receives a killing signal
Quoted 5 lines · Φώτης Βαλασιάδης

Tried my best, hope I did it right!

Thanks for the assist!

And yes, it's Greek!

:-)

Quoted 1 line

Signing off with my github username most of the time.

Okay.

Quoted 3 lines

Thanks again, here you go!

Βαλασιάδης Φώτιος

The applied patch is below:

$ git show
commit f04064d73b9f60f189c490e7ef5c3b9fa5498920 (HEAD -> master)
Author: Fotios Valasiadis <[email protected]>
Date:   Mon Feb 27 01:22:01 2023 +0200

ptrace.2: Add details about usage of PTRACE_GET_SYSCALL_INFO

Document the role of PTRACE_O_TRACESYSGOOD option in connection with PTRACE_GET_SYSCALL_INFO.

Fixed incomplete doc. PTRACE_GET_SYSCALL_INFO's description wouldn't inform the user that they need to enable PTRACE_O_TRACESYSGOOD to get detailed information from said operation.

Came upon this bug after writing a test program using PTRACE_O_TRACESYSGOOD. After failing to find what's wrong I posted a stackoverflow question which you can find right here:
<https://stackoverflow.com/questions/72410182/ptrace-get-syscall-info-always-returns-info-op-as-ptrace-syscall-info-none>

Nate Eldredge found out what's wrong by looking into the kernel's source code, here is a link to the relevant part
<https://github.com/torvalds/linux/blob/8291eaafed36f575f23951f3ce18407f480e9ecf/kernel/ptrace.c#L1018>

In the code it can be seen that the union is filled if and only if the signal matches "SIGTRAP | 0x80", a signal which is only sent if the PTRACE_O_TRACESYSGOOD option is set. You can read about that in the PTRACE_O_TRACESYSGOOD section of ptrace(2)'s manual.

Complements: fc91449cb "ptrace.2: Document PTRACE_GET_SYSCALL_INFO"

man2/ptrace.2 +9 -0
index 55d9fd36d..9737b3825 100644
@@ -1111,6 +1111,15 @@ .SH DESCRIPTION
  .B PTRACE_SYSCALL_INFO_NONE
  No component of the union contains relevant information.
  .RE
+.IP
+In case of system call entry or exit stops,
+the data returned by
+.B PTRACE_GET_SYSCALL_INFO
+is limited to type
+.B PTRACE_SYSCALL_INFO_NONE
+unless
+.B PTRACE_O_TRACESYSGOOD
+option is set before the corresponding system call stop has occurred.
  .\"
  .SS Death under ptrace
  When a (possibly multithreaded) process receives a killing signal

Please confirm if you want me to push it like that, or if there's anything you'd like to tweak.

Cheers,

Alex

Acked-by Nate Eldredge
#10 lore raw
Quoted 4 lines · Φώτης Βαλασιάδης

Ah yes sorry for the confusion.

First name is Φώτιος, surname Βαλασιάδης,
just call me Fotis!

Hi Fotis, :)

Quoted 12 lines

we use both formats in Greece, confusing i know . :D

It's fine by me, you know best! But if I have to point something it's that Dmitry didn't like the word "Fixed" and we in fact agreed to replace:

Fixed incomplete doc. PTRACE_GET_SYSCALL_INFO's description wouldn't
inform the user that they need to enable PTRACE_O_TRACESYSGOOD to get detailed information from said operation.

with:

Quoted 7 lines

Document the role of PTRACE_O_TRACESYSGOOD option in connection with
PTRACE_GET_SYSCALL_INFO.

So perhaps you'd want to look into that? Can probably communicate on this with Dmitry so we can all agree to something.

I repeat though, from me it's all good, you know best!

Ahh, sorry, I forgot about that. I reworded it to the following:

ptrace.2: Add details about usage of PTRACE_GET_SYSCALL_INFO

Document the role of PTRACE_O_TRACESYSGOOD option in connection with PTRACE_GET_SYSCALL_INFO.

Came upon this after writing a test program using PTRACE_O_TRACESYSGOOD. After failing to find what's wrong I posted a StackOverflow question which you can find right here:
<https://stackoverflow.com/questions/72410182/ptrace-get-syscall-info-always-returns-info-op-as-ptrace-syscall-info-none>

Nate Eldredge found out what happens by looking into the kernel's source code, here is a link to the relevant part
<https://github.com/torvalds/linux/blob/8291eaafed36f575f23951f3ce18407f480e9ecf/kernel/ptrace.c#L1018>

In the code it can be seen that the union is filled if and only if the signal matches "SIGTRAP | 0x80", a signal which is only sent if the PTRACE_O_TRACESYSGOOD option is set. You can read about that in the PTRACE_O_TRACESYSGOOD section of ptrace(2)'s manual.

Complements: fc91449cb "ptrace.2: Document PTRACE_GET_SYSCALL_INFO"

Cheers!

Alex

Signature · 2 lines
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
#11 lore raw

Hi,

On Mon, Feb 27, 2023 at 02:28:45PM +0100, Alejandro Colomar wrote:
[...]

Quoted 8 lines

Ahh, sorry, I forgot about that. I reworded it to the following:

ptrace.2: Add details about usage of PTRACE_GET_SYSCALL_INFO

Document the role of PTRACE_O_TRACESYSGOOD option in connection with PTRACE_GET_SYSCALL_INFO.

Came upon this after writing a test program using PTRACE_O_TRACESYSGOOD.

Just otherwise, PTRACE_O_TRACESYSGOOD was not used in that test, otherwise there wouldn't be any question in the first place. Did you mean PTRACE_GET_SYSCALL_INFO?

Quoted 4 lines

After failing to find what's wrong I posted a StackOverflow question which you can find right here:
<https://stackoverflow.com/questions/72410182/ptrace-get-syscall-info-always-returns-info-op-as-ptrace-syscall-info-none>

Quoted 8 lines

Nate Eldredge found out what happens by looking into the kernel's source code, here is a link to the relevant part
<https://github.com/torvalds/linux/blob/8291eaafed36f575f23951f3ce18407f480e9ecf/kernel/ptrace.c#L1018>

In the code it can be seen that the union is filled if and only if the signal matches "SIGTRAP | 0x80", a signal which is only sent if the PTRACE_O_TRACESYSGOOD option is set. You can read about that in the PTRACE_O_TRACESYSGOOD section of ptrace(2)'s manual.

Once again, this "if and only if" is confusing, as PTRACE_EVENT_SECCOMP event that can happen when PTRACE_O_TRACESECCOMP option is enabled fills the union with the data of type PTRACE_SYSCALL_INFO_SECCOMP.

PTRACE_EVENT_SECCOMP stop is similar to system call enter stop, but it's not exactly the same kind of stop.

The note we're adding to the manual page is more correct in this regards.

Signature · 1 line
ldv
#12 lore raw

Hi Dmitry,

Quoted 30 lines · Dmitry V. Levin

Hi,

On Mon, Feb 27, 2023 at 02:28:45PM +0100, Alejandro Colomar wrote:
[...]

Quoted 8 lines

Ahh, sorry, I forgot about that. I reworded it to the following:

ptrace.2: Add details about usage of PTRACE_GET_SYSCALL_INFO

Document the role of PTRACE_O_TRACESYSGOOD option in connection with PTRACE_GET_SYSCALL_INFO.

Came upon this after writing a test program using PTRACE_O_TRACESYSGOOD.

Just otherwise, PTRACE_O_TRACESYSGOOD was not used in that test, otherwise there wouldn't be any question in the first place. Did you mean PTRACE_GET_SYSCALL_INFO?

Quoted 4 lines

After failing to find what's wrong I posted a StackOverflow question which you can find right here:
<https://stackoverflow.com/questions/72410182/ptrace-get-syscall-info-always-returns-info-op-as-ptrace-syscall-info-none>

Quoted 8 lines

Nate Eldredge found out what happens by looking into the kernel's source code, here is a link to the relevant part
<https://github.com/torvalds/linux/blob/8291eaafed36f575f23951f3ce18407f480e9ecf/kernel/ptrace.c#L1018>

In the code it can be seen that the union is filled if and only if the signal matches "SIGTRAP | 0x80", a signal which is only sent if the PTRACE_O_TRACESYSGOOD option is set. You can read about that in the PTRACE_O_TRACESYSGOOD section of ptrace(2)'s manual.

Quoted 8 lines

Once again, this "if and only if" is confusing, as PTRACE_EVENT_SECCOMP event that can happen when PTRACE_O_TRACESECCOMP option is enabled fills the union with the data of type PTRACE_SYSCALL_INFO_SECCOMP.

PTRACE_EVENT_SECCOMP stop is similar to system call enter stop, but it's not exactly the same kind of stop.

The note we're adding to the manual page is more correct in this regards.

Okay, I'll let Fotios write the commit message, and will take it whatever it is :)

Cheers,

Alex

Quoted 2 lines
Signature · 2 lines
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

A message that is not in the archive (sent off-list or not yet received): [email protected]

#14 lore raw

PATCH 1/1 ptrace.2: Add details about usage of PTRACE_GET_SYSCALL_INFO

Hi Alex,

Quoted 38 lines · Alejandro Colomar

Hi Dmitry,

Quoted 35 lines · Dmitry V. Levin

Hi,

On Mon, Feb 27, 2023 at 02:28:45PM +0100, Alejandro Colomar wrote:
[...]

Quoted 8 lines

Ahh, sorry, I forgot about that. I reworded it to the following:

ptrace.2: Add details about usage of PTRACE_GET_SYSCALL_INFO

Document the role of PTRACE_O_TRACESYSGOOD option in connection with PTRACE_GET_SYSCALL_INFO.

Came upon this after writing a test program using PTRACE_O_TRACESYSGOOD.

Just otherwise, PTRACE_O_TRACESYSGOOD was not used in that test, otherwise there wouldn't be any question in the first place. Did you mean PTRACE_GET_SYSCALL_INFO?

Quoted 4 lines

After failing to find what's wrong I posted a StackOverflow question which you can find right here:
<https://stackoverflow.com/questions/72410182/ptrace-get-syscall-info-always-returns-info-op-as-ptrace-syscall-info-none>

Quoted 8 lines

Nate Eldredge found out what happens by looking into the kernel's source code, here is a link to the relevant part
<https://github.com/torvalds/linux/blob/8291eaafed36f575f23951f3ce18407f480e9ecf/kernel/ptrace.c#L1018>

In the code it can be seen that the union is filled if and only if the signal matches "SIGTRAP | 0x80", a signal which is only sent if the PTRACE_O_TRACESYSGOOD option is set. You can read about that in the PTRACE_O_TRACESYSGOOD section of ptrace(2)'s manual.

Once again, this "if and only if" is confusing, as PTRACE_EVENT_SECCOMP event that can happen when PTRACE_O_TRACESECCOMP option is enabled fills the union with the data of type PTRACE_SYSCALL_INFO_SECCOMP.

PTRACE_EVENT_SECCOMP stop is similar to system call enter stop, but it's not exactly the same kind of stop.

Quoted 7 lines
Quoted 1 line

The note we're adding to the manual page is more correct in this regards.

Okay, I'll let Fotios write the commit message, and will take it whatever it is :)

Cheers,

Alex

So with Dmitry we agreed on:

1.

Came upon this after writing a test program using PTRACE_GET_SYSCALL_INFO.

2.

In the code it can be seen that in case of system call entry or exit stops, the union is filled if and only if the signal matches "SIGTRAP | 0x80", a signal which is sent if the PTRACE_O_TRACESYSGOOD option is set. You can read about that in the PTRACE_O_TRACESYSGOOD section of ptrace(2)'s manual.

Replace these and we are set!

-- fvalasiad --

#15 lore raw
In reply to a message not in the archive

Hi Φώτης,

Quoted 9 lines · Φώτης Βαλασιάδης
Quoted 1 line
Quoted 1 line

So with Dmitry we agreed on:

1.

Came upon this after writing a test program using PTRACE_GET_SYSCALL_INFO.

2.

Quoted 7 lines

In the code it can be seen that in case of system call entry or exit stops, the union is filled if and only if the signal matches "SIGTRAP | 0x80", a signal which is sent if the PTRACE_O_TRACESYSGOOD option is set. You can read about that in the PTRACE_O_TRACESYSGOOD section of ptrace(2)'s manual.

Replace these and we are set!

Would you mind sending the patch again with that text? :)

Thanks!

Alex

Quoted 2 lines

-- fvalasiad --

Signature · 2 lines
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
#16 lore raw

PATCH 1/1 ptrace.2: Add details about usage of PTRACE_GET_SYSCALL_INFO

Document the role of PTRACE_O_TRACESYSGOOD option in connection with PTRACE_GET_SYSCALL_INFO.

Came upon this after writing a test program using PTRACE_GET_SYSCALL_INFO. After failing to find what's wrong I posted a StackOverflow question which you can find right here:
<https://stackoverflow.com/questions/72410182/ptrace-get-syscall-info-always-returns-info-op-as-ptrace-syscall-info-none>

Nate Eldredge found out what happens by looking into the kernel's source code, here is a link to the relevant part
<https://github.com/torvalds/linux/blob/8291eaafed36f575f23951f3ce18407f480e9ecf/kernel/ptrace.c#L1018>

In the code it can be seen that in case of system call entry or exit stops, the union is filled if and only if the signal matches "SIGTRAP | 0x80", a signal which is only sent if the PTRACE_O_TRACESYSGOOD option is set. You can read about that in the PTRACE_O_TRACESYSGOOD section of ptrace(2)'s manual.

Complements: fc91449cb "ptrace.2: Document PTRACE_GET_SYSCALL_INFO"

---
 man2/ptrace.2 | 9 +++++++++
 1 file changed, 9 insertions(+)
man2/ptrace.2 +9 -0
index 55d9fd36d..9737b3825 100644
@@ -1111,6 +1111,15 @@ stop.
 .B PTRACE_SYSCALL_INFO_NONE
 No component of the union contains relevant information.
 .RE
+.IP
+In case of system call entry or exit stops,
+the data returned by
+.B PTRACE_GET_SYSCALL_INFO
+is limited to type
+.B PTRACE_SYSCALL_INFO_NONE
+unless
+.B PTRACE_O_TRACESYSGOOD
+option is set before the corresponding system call stop has occurred.
 .\"
 .SS Death under ptrace
 When a (possibly multithreaded) process receives a killing signal
Signature · 1 line
2.39.2
#17 lore raw

Hi Alex!

Is that good enough?

-- fvalasiad --

Quoted 49 lines · Fotios Valasiadis

Document the role of PTRACE_O_TRACESYSGOOD option in connection with PTRACE_GET_SYSCALL_INFO.

Came upon this after writing a test program using PTRACE_GET_SYSCALL_INFO. After failing to find what's wrong I posted a StackOverflow question which you can find right here:
<https://stackoverflow.com/questions/72410182/ptrace-get-syscall-info-always-returns-info-op-as-ptrace-syscall-info-none>

Nate Eldredge found out what happens by looking into the kernel's source code, here is a link to the relevant part
<https://github.com/torvalds/linux/blob/8291eaafed36f575f23951f3ce18407f480e9ecf/kernel/ptrace.c#L1018>

In the code it can be seen that in case of system call entry or exit stops, the union is filled if and only if the signal matches "SIGTRAP | 0x80", a signal which is only sent if the PTRACE_O_TRACESYSGOOD option is set. You can read about that in the PTRACE_O_TRACESYSGOOD section of ptrace(2)'s manual.

Complements: fc91449cb "ptrace.2: Document PTRACE_GET_SYSCALL_INFO"

---
  man2/ptrace.2 | 9 +++++++++
  1 file changed, 9 insertions(+)
man2/ptrace.2 +9 -0
index 55d9fd36d..9737b3825 100644
@@ -1111,6 +1111,15 @@ stop.
  .B PTRACE_SYSCALL_INFO_NONE
  No component of the union contains relevant information.
  .RE
+.IP
+In case of system call entry or exit stops,
+the data returned by
+.B PTRACE_GET_SYSCALL_INFO
+is limited to type
+.B PTRACE_SYSCALL_INFO_NONE
+unless
+.B PTRACE_O_TRACESYSGOOD
+option is set before the corresponding system call stop has occurred.
  .\"
  .SS Death under ptrace
  When a (possibly multithreaded) process receives a killing signal
#18 lore raw

Hi yet again Alex!

You didn't confirm so I was wondering if you received my message!

Let me know if possible.

-- fvalasiad --

Quoted 58 lines · Φώτης Βαλασιάδης

Hi Alex!

Is that good enough?

-- fvalasiad --

Quoted 51 lines · Fotios Valasiadis

Document the role of PTRACE_O_TRACESYSGOOD option in connection with PTRACE_GET_SYSCALL_INFO.

Came upon this after writing a test program using PTRACE_GET_SYSCALL_INFO. After failing to find what's wrong I posted a StackOverflow question which you can find right here:
<https://stackoverflow.com/questions/72410182/ptrace-get-syscall-info-always-returns-info-op-as-ptrace-syscall-info-none>

Nate Eldredge found out what happens by looking into the kernel's source code, here is a link to the relevant part
<https://github.com/torvalds/linux/blob/8291eaafed36f575f23951f3ce18407f480e9ecf/kernel/ptrace.c#L1018>

In the code it can be seen that in case of system call entry or exit stops, the union is filled if and only if the signal matches "SIGTRAP | 0x80", a signal which is only sent if the PTRACE_O_TRACESYSGOOD option is set.  You can read about that in the PTRACE_O_TRACESYSGOOD section of ptrace(2)'s manual.

Complements: fc91449cb "ptrace.2: Document PTRACE_GET_SYSCALL_INFO"

---
  man2/ptrace.2 | 9 +++++++++

  1 file changed, 9 insertions(+)
man2/ptrace.2 +0 -0
index 55d9fd36d..9737b3825 100644
@@ -1111,6 +1111,15 @@ stop.

  .B PTRACE_SYSCALL_INFO_NONE
  No component of the union contains relevant information. .RE
+.IP

man2/ptrace.2 +8 -0
+In case of system call entry or exit stops,
+the data returned by
+.B PTRACE_GET_SYSCALL_INFO
+is limited to type
+.B PTRACE_SYSCALL_INFO_NONE
+unless
+.B PTRACE_O_TRACESYSGOOD
+option is set before the corresponding system call stop has occurred.

  .\"
  .SS Death under ptrace
  When a (possibly multithreaded) process receives a killing signal

#19 lore raw
In reply to Fotios Valasiadis

Hi Fotios,

Quoted 4 lines · Φώτης Βαλασιάδης

Hi Alex!

Is that good enough?

Yep. Patch applied. Thanks!

Alex

Quoted 49 lines · Fotios Valasiadis

Document the role of PTRACE_O_TRACESYSGOOD option in connection with PTRACE_GET_SYSCALL_INFO.

Came upon this after writing a test program using PTRACE_GET_SYSCALL_INFO. After failing to find what's wrong I posted a StackOverflow question which you can find right here:
<https://stackoverflow.com/questions/72410182/ptrace-get-syscall-info-always-returns-info-op-as-ptrace-syscall-info-none>

Nate Eldredge found out what happens by looking into the kernel's source code, here is a link to the relevant part
<https://github.com/torvalds/linux/blob/8291eaafed36f575f23951f3ce18407f480e9ecf/kernel/ptrace.c#L1018>

In the code it can be seen that in case of system call entry or exit stops, the union is filled if and only if the signal matches "SIGTRAP | 0x80", a signal which is only sent if the PTRACE_O_TRACESYSGOOD option is set. You can read about that in the PTRACE_O_TRACESYSGOOD section of ptrace(2)'s manual.

Complements: fc91449cb "ptrace.2: Document PTRACE_GET_SYSCALL_INFO"

---
 man2/ptrace.2 | 9 +++++++++
 1 file changed, 9 insertions(+)
man2/ptrace.2 +9 -0
index 55d9fd36d..9737b3825 100644
@@ -1111,6 +1111,15 @@ stop.
 .B PTRACE_SYSCALL_INFO_NONE
 No component of the union contains relevant information.
 .RE
+.IP
+In case of system call entry or exit stops,
+the data returned by
+.B PTRACE_GET_SYSCALL_INFO
+is limited to type
+.B PTRACE_SYSCALL_INFO_NONE
+unless
+.B PTRACE_O_TRACESYSGOOD
+option is set before the corresponding system call stop has occurred.
 .\"
 .SS Death under ptrace
 When a (possibly multithreaded) process receives a killing signal
Signature · 2 lines
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5