ptrace.2: Add details about usage of PTRACE_GET_SYSCALL_INFO
PATCH 1/1 ptrace.2: Add details about usage of PTRACE_GET_SYSCALL_INFO
From: Fotios Valasiadis <[email protected]>
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.
I am unaware if Nate wants to be included as a co-author of this commit, nor am I aware of any way to contact him.
--- man2/ptrace.2 | 5 +++++ 1 file changed, 5 insertions(+)
man2/ptrace.2 +5 -0
@@ -1033,6 +1033,11 @@ If the size of the data to be written by the kernel exceeds the size specified by the .I addr argument, the output data is truncated. +To obtain complete information during system call entry or exit stops, +you should enable the +.B PTRACE_O_TRACESYSGOOD +option using +.B PTRACE_SETOPTIONS. .IP The .I ptrace_syscall_info
Signature · 1 line
2.39.2
Quoted 11 lines · Fotios Valasiadis
From: Fotios Valasiadis <[email protected]>
Fixed incomplete doc. PTRACE_GET_SYSCALL_INFO's description wouldn't inform the user that they need to enable
PTRACE_O_TRACESYSGOODto 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-noneNate 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 thePTRACE_O_TRACESYSGOODoption is set. You can read about that in thePTRACE_O_TRACESYSGOODsection of ptrace.2 's manual.I am unaware if Nate wants to be included as a co-author of this commit, nor am I aware of any way to contact him.
Cc'ed Nate just in case.
Quoted 11 lines
Signed-off-by Fotios Valasiadis <[email protected]>--- man2/ptrace.2 | 5 +++++ 1 file changed, 5 insertions(+)man2/ptrace.2 +0
-0@@ -1033,6 +1033,11 @@ If the size of the data to be written by the kernel exceeds the size specified by the
man2/ptrace.2 If the size of the data to be written by the kernel exceeds the size · line 1043
Quoted 10 lines
man2/ptrace.2 +5
-0.I addr argument, the output data is truncated. +To obtain complete information during system call entry or exit stops, +you should enable the +.B PTRACE_O_TRACESYSGOOD +option using +.B PTRACE_SETOPTIONS. .IP The .I ptrace_syscall_info
I suggest the following wording:
man2/ptrace.2 +9 -0
@@ -1111,6 +1111,15 @@ stop. .B PTRACE_SYSCALL_INFO_NONE No component of the union contains relevant information. .RE +.IP +Note that 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
As written in the manual page, using the PTRACE_O_TRACESYSGOOD option is the recommended method to distinguish syscall-stops from other kinds of ptrace-stops, since it is reliable and does not incur a performance penalty. In other words, if you use ptrace(2) at all, please consider using PTRACE_O_TRACESYSGOOD option.
Signature · 1 line
ldv
This was during the early days of the program I was implementing, I later found out I needed PTRACE_O_TRACESYSGOOD anyways as the manual suggests. Still it's something that should be documented! Caused a lot of frustration.
Regarding your suggestion, it's great but I have something to point out. In the case of PTRACE_EVENT_SECCOMP the union is filled normally, without any need for the PTRACE_O_TRACESYSGOOD option to be set. So unless I am missing something, please consider including that!
Quoted 65 lines · Dmitry V. Levin
Quoted 11 lines · Fotios Valasiadis
From: Fotios Valasiadis <[email protected]>
Fixed incomplete doc. PTRACE_GET_SYSCALL_INFO's description wouldn't inform the user that they need to enable
PTRACE_O_TRACESYSGOODto 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-noneNate 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 thePTRACE_O_TRACESYSGOODoption is set. You can read about that in thePTRACE_O_TRACESYSGOODsection of ptrace.2 's manual.I am unaware if Nate wants to be included as a co-author of this commit, nor am I aware of any way to contact him.
Cc'ed Nate just in case.
Quoted 11 lines
Signed-off-by Fotios Valasiadis <[email protected]>--- man2/ptrace.2 | 5 +++++ 1 file changed, 5 insertions(+)man2/ptrace.2 +0
-0@@ -1033,6 +1033,11 @@ If the size of the data to be written by the kernel exceeds the size specified by theman2/ptrace.2 If the size of the data to be written by the kernel exceeds the size · line 1043
Quoted 10 lines
man2/ptrace.2 +5
-0.I addr argument, the output data is truncated. +To obtain complete information during system call entry or exit stops, +you should enable the +.B PTRACE_O_TRACESYSGOOD +option using +.B PTRACE_SETOPTIONS. .IP The .I ptrace_syscall_infoI suggest the following wording:
man2/ptrace.2 +9
-0@@ -1111,6 +1111,15 @@ stop. .B PTRACE_SYSCALL_INFO_NONE No component of the union contains relevant information. .RE +.IP +Note that 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 signalAs written in the manual page, using the
PTRACE_O_TRACESYSGOODoption is the recommended method to distinguish syscall-stops from other kinds of ptrace-stops, since it is reliable and does not incur a performance penalty. In other words, if you use ptrace(2) at all, please consider usingPTRACE_O_TRACESYSGOODoption.
Quoted 9 lines · Φώτης Βαλασιάδης
This was during the early days of the program I was implementing, I later found out I needed
PTRACE_O_TRACESYSGOODanyways as the manual suggests. Still it's something that should be documented! Caused a lot of frustration.Regarding your suggestion, it's great but I have something to point out. In the case of
PTRACE_EVENT_SECCOMPthe union is filled normally, without any need for thePTRACE_O_TRACESYSGOODoption to be set. So unless I am missing something, please consider including that!
Correct, to get PTRACE_SYSCALL_INFO_SECCOMP one has to set PTRACE_O_TRACESECCOMP option, and to get PTRACE_SYSCALL_INFO_ENTRY/PTRACE_SYSCALL_INFO_EXIT one has to set PTRACE_O_TRACESYSGOOD option.
Quoted 66 lines · Dmitry V. Levin
Quoted 65 lines · Fotios Valasiadis
Quoted 11 lines
From: Fotios Valasiadis <[email protected]>
Fixed incomplete doc. PTRACE_GET_SYSCALL_INFO's description wouldn't inform the user that they need to enable
PTRACE_O_TRACESYSGOODto 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-noneNate 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 thePTRACE_O_TRACESYSGOODoption is set. You can read about that in thePTRACE_O_TRACESYSGOODsection of ptrace.2 's manual.I am unaware if Nate wants to be included as a co-author of this commit, nor am I aware of any way to contact him.
Cc'ed Nate just in case.
Quoted 11 lines
Signed-off-by Fotios Valasiadis <[email protected]>--- man2/ptrace.2 | 5 +++++ 1 file changed, 5 insertions(+)man2/ptrace.2 +0
-0@@ -1033,6 +1033,11 @@ If the size of the data to be written by the kernel exceeds the size specified by theman2/ptrace.2 If the size of the data to be written by the kernel exceeds the size · line 1043
Quoted 10 lines
man2/ptrace.2 +5
-0.I addr argument, the output data is truncated. +To obtain complete information during system call entry or exit stops, +you should enable the +.B PTRACE_O_TRACESYSGOOD +option using +.B PTRACE_SETOPTIONS. .IP The .I ptrace_syscall_infoI suggest the following wording:
man2/ptrace.2 +9
-0@@ -1111,6 +1111,15 @@ stop. .B PTRACE_SYSCALL_INFO_NONE No component of the union contains relevant information. .RE +.IP +Note that 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 signalAs written in the manual page, using the
PTRACE_O_TRACESYSGOODoption is the recommended method to distinguish syscall-stops from other kinds of ptrace-stops, since it is reliable and does not incur a performance penalty. In other words, if you use ptrace(2) at all, please consider usingPTRACE_O_TRACESYSGOODoption.
Signature · 1 line
ldv
So, what about this?
man2/ptrace.2 +0 -0
@@ -1111,6 +1111,16 @@ stop.
.B PTRACE_SYSCALL_INFO_NONE
No component of the union contains relevant information. .RE
+.IP
+Note that in case of
+.B PTRACE_SYSCALL
+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
Quoted 81 lines · Dmitry V. Levin
Quoted 9 lines · Φώτης Βαλασιάδης
This was during the early days of the program I was implementing, I later found out I needed
PTRACE_O_TRACESYSGOODanyways as the manual suggests. Still it's something that should be documented! Caused a lot of frustration.Regarding your suggestion, it's great but I have something to point out. In the case of
PTRACE_EVENT_SECCOMPthe union is filled normally, without any need for thePTRACE_O_TRACESYSGOODoption to be set. So unless I am missing something, please consider including that!Correct, to get
PTRACE_SYSCALL_INFO_SECCOMPone has to setPTRACE_O_TRACESECCOMPoption, and to get PTRACE_SYSCALL_INFO_ENTRY/PTRACE_SYSCALL_INFO_EXIT one has to setPTRACE_O_TRACESYSGOODoption.Quoted 66 lines · Dmitry V. Levin
Quoted 65 lines · Fotios Valasiadis
Quoted 11 lines
From: Fotios Valasiadis <[email protected]>
Fixed incomplete doc. PTRACE_GET_SYSCALL_INFO's description wouldn't inform the user that they need to enable
PTRACE_O_TRACESYSGOODto 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-noneNate 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 thePTRACE_O_TRACESYSGOODoption is set. You can read about that in thePTRACE_O_TRACESYSGOODsection of ptrace.2 's manual.I am unaware if Nate wants to be included as a co-author of this commit, nor am I aware of any way to contact him.
Cc'ed Nate just in case.
Quoted 11 lines
Signed-off-by Fotios Valasiadis <[email protected]>--- man2/ptrace.2 | 5 +++++ 1 file changed, 5 insertions(+)man2/ptrace.2 +0
-0@@ -1033,6 +1033,11 @@ If the size of the data to be written by the kernel exceeds the size specified by theman2/ptrace.2 If the size of the data to be written by the kernel exceeds the size · line 1043
Quoted 10 lines
man2/ptrace.2 +5
-0.I addr argument, the output data is truncated. +To obtain complete information during system call entry or exit stops, +you should enable the +.B PTRACE_O_TRACESYSGOOD +option using +.B PTRACE_SETOPTIONS. .IP The .I ptrace_syscall_infoI suggest the following wording:
man2/ptrace.2 +9
-0@@ -1111,6 +1111,15 @@ stop. .B PTRACE_SYSCALL_INFO_NONE No component of the union contains relevant information. .RE +.IP +Note that 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 signalAs written in the manual page, using the
PTRACE_O_TRACESYSGOODoption is the recommended method to distinguish syscall-stops from other kinds of ptrace-stops, since it is reliable and does not incur a performance penalty. In other words, if you use ptrace(2) at all, please consider usingPTRACE_O_TRACESYSGOODoption.
Quoted 7 lines · Φώτης Βαλασιάδης
So, what about this?
man2/ptrace.2 +0
-0
man2/ptrace.2 stop. · line 1117
Quoted 7 lines
man2/ptrace.2 +4
-0@@ -1111,6 +1111,16 @@ stop. .B PTRACE_SYSCALL_INFO_NONE No component of the union contains relevant information. .RE +.IP +Note that in case of +.B PTRACE_SYSCALL +syscall entry or exit stops, the data returned by
I'm not sure about mentioning PTRACE_SYSCALL in this context as it's not the only way to have the tracee stopped at a syscall stop.
Quoted 9 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. .\" .SS Death under ptrace When a (possibly multithreaded) process receives a killing signal
Signature · 1 line
ldv
Better?
man2/ptrace.2 +0 -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
+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
Quoted 27 lines · Dmitry V. Levin
Quoted 7 lines · Φώτης Βαλασιάδης
So, what about this?
man2/ptrace.2 +0
-0man2/ptrace.2 stop. · line 1117
Quoted 7 lines
man2/ptrace.2 +4
-0@@ -1111,6 +1111,16 @@ stop. .B PTRACE_SYSCALL_INFO_NONE No component of the union contains relevant information. .RE +.IP +Note that in case of +.B PTRACE_SYSCALL +syscall entry or exit stops, the data returned byI'm not sure about mentioning
PTRACE_SYSCALLin this context as it's not the only way to have the tracee stopped at a syscall stop.Quoted 9 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. .\" .SS Death under ptrace When a (possibly multithreaded) process receives a killing signal
Quoted 12 lines · Φώτης Βαλασιάδης
Better?
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
man2/ptrace.2 stop. · line 1125
Quoted 10 lines
man2/ptrace.2 +7
-0+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
LGTM, thanks.
Signature · 1 line
ldv
Hi Dmitry!
Quoted 17 lines · Dmitry V. Levin
Quoted 16 lines · Φώτης Βαλασιάδης
Better?
man2/ptrace.2 +6
-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 +syscall entry or exit stops, the data returned by +.B PTRACE_GET_SYSCALL_INFO +is limited to type +.B PTRACE_SYSCALL_INFO_NONE
Quoted 8 lines
man2/ptrace.2 stop. · line 1125
Quoted 6 lines
man2/ptrace.2 +3
-0+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 signalLGTM, thanks.
Ahh, I see you already CCd Nate. Thanks!
Thanks for the review! I should take that as an Acked-by?
Cheers,
Alex
Quoted 2 lines
Signature · 2 lines
<http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
Dmitry V. Levin
Reviewed-byHi Alex,
Quoted 29 lines · Alex Colomar
Hi Dmitry!
Quoted 17 lines · Dmitry V. Levin
Quoted 16 lines · Φώτης Βαλασιάδης
Better?
man2/ptrace.2 +6
-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 +syscall entry or exit stops, the data returned by +.B PTRACE_GET_SYSCALL_INFO +is limited to type +.B PTRACE_SYSCALL_INFO_NONEQuoted 8 lines
man2/ptrace.2 stop. · line 1125
Quoted 6 lines
man2/ptrace.2 +3
-0+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 signalLGTM, thanks.
Quoted 3 lines
Ahh, I see you already CCd Nate. Thanks!
Thanks for the review! I should take that as an Acked-by?
Sure, feel free to add:
Signature · 1 line
ldv
Quoted 11 lines · Fotios Valasiadis
From: Fotios Valasiadis <[email protected]>
Fixed incomplete doc. PTRACE_GET_SYSCALL_INFO's description wouldn't inform the user that they need to enable
PTRACE_O_TRACESYSGOODto 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-noneNate 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 thePTRACE_O_TRACESYSGOODoption is set. You can read about that in thePTRACE_O_TRACESYSGOODsection of ptrace.2 's manual.I am unaware if Nate wants to be included as a co-author of this commit, nor am I aware of any way to contact him.
Hello Fotios,
I found his address in a kernel commit:
Nate Eldredge <[email protected]>
I'm CCing him in case he wants to review.
Thanks for the patch!
Alex
Quoted 22 lines
Signed-off-by Fotios Valasiadis <[email protected]>--- man2/ptrace.2 | 5 +++++ 1 file changed, 5 insertions(+)man2/ptrace.2 +5
-0@@ -1033,6 +1033,11 @@ If the size of the data to be written by the kernel exceeds the size specified by the .I addr argument, the output data is truncated. +To obtain complete information during system call entry or exit stops, +you should enable the +.B PTRACE_O_TRACESYSGOOD +option using +.B PTRACE_SETOPTIONS. .IP The .I ptrace_syscall_info
Signature · 2 lines
<http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
Hello Alex!
Good! I will wait a day or two before submitting a new patch the way we agreed with Dmitry! In case Nate responds!
Quoted 49 lines · Alex Colomar
Quoted 11 lines · Fotios Valasiadis
From: Fotios Valasiadis <[email protected]>
Fixed incomplete doc. PTRACE_GET_SYSCALL_INFO's description wouldn't inform the user that they need to enable
PTRACE_O_TRACESYSGOODto 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-noneNate 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 thePTRACE_O_TRACESYSGOODoption is set. You can read about that in thePTRACE_O_TRACESYSGOODsection of ptrace.2 's manual.I am unaware if Nate wants to be included as a co-author of this commit, nor am I aware of any way to contact him.
Hello Fotios,
I found his address in a kernel commit:
Nate Eldredge <[email protected]>
I'm CCing him in case he wants to review.
Thanks for the patch!
Alex
Quoted 23 lines
Signed-off-by Fotios Valasiadis <[email protected]>---
man2/ptrace.2 | 5 +++++1 file changed, 5 insertions(+)man2/ptrace.2 +0
-0@@ -1033,6 +1033,11 @@ If the size of the data to be written by thekernel exceeds the size
specified by the
.I addr
argument, the output data is truncated.man2/ptrace.2 +5
-0+To obtain complete information during system call entry or exit stops, +you should enable the +.B PTRACE_O_TRACESYSGOOD +option using +.B PTRACE_SETOPTIONS..IP
The
.Iptrace_syscall_info
Quoted 13 lines · Alex Colomar
Quoted 11 lines · Fotios Valasiadis
From: Fotios Valasiadis <[email protected]>
Fixed incomplete doc. PTRACE_GET_SYSCALL_INFO's description wouldn't inform the user that they need to enable
PTRACE_O_TRACESYSGOODto 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-noneNate 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 thePTRACE_O_TRACESYSGOODoption is set. You can read about that in thePTRACE_O_TRACESYSGOODsection of ptrace.2 's manual.I am unaware if Nate wants to be included as a co-author of this commit, nor am I aware of any way to contact him.
Quoted 7 lines
Hello Fotios,
I found his address in a kernel commit:
Nate Eldredge <[email protected]>
I'm CCing him in case he wants to review.
Hi everyone, I think it's a good clear explanation. Thanks for taking the time to write the patch! No need to include me as coauthor.
Quoted 33 lines
Thanks for the patch!
Alex
Quoted 23 lines
Signed-off-by Fotios Valasiadis <[email protected]>--- man2/ptrace.2 | 5 +++++ 1 file changed, 5 insertions(+)man2/ptrace.2 +0
-0@@ -1033,6 +1033,11 @@ If the size of the data to be written by the kernelexceeds the size
specified by the
.I addr
argument, the output data is truncated.man2/ptrace.2 +5
-0+To obtain complete information during system call entry or exit stops, +you should enable the +.B PTRACE_O_TRACESYSGOOD +option using +.B PTRACE_SETOPTIONS. .IP The .I ptrace_syscall_infoSignature · 2 lines
<http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
Signature · 2 lines
Nate Eldredge [email protected]