diff mbox

[Precise,SRU] ptrace: renumber PTRACE_EVENT_STOP so that future new options and events can match

Message ID 20140605184320.GT5422@outflux.net
State New
Headers show

Commit Message

Kees Cook June 5, 2014, 6:43 p.m. UTC
BugLink: http://bugs.launchpad.net/bugs/1326905

commit 5cdf389aee90109e2e3d88085dea4dd5508a3be7 upstream.

PTRACE_EVENT_foo and PTRACE_O_TRACEfoo used to match.

New PTRACE_EVENT_STOP is the first event which has no corresponding
PTRACE_O_TRACE option.  If we will ever want to add another such option,
its PTRACE_EVENT's value will collide with PTRACE_EVENT_STOP's value.

This patch changes PTRACE_EVENT_STOP value to prevent this.

While at it, added a comment - the one atop PTRACE_EVENT block, saying
"Wait extended result codes for the above trace options", is not true
for PTRACE_EVENT_STOP.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Tejun Heo <tj@kernel.org>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Cc: Pedro Alves <palves@redhat.com>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

[kees:adjusted PTRACE_EVENT_SECCOMP as well]
Signed-off-by: Kees Cook <kees@ubuntu.com>
---
 include/linux/ptrace.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Tim Gardner June 6, 2014, 5:08 p.m. UTC | #1

Brad Figg June 6, 2014, 5:10 p.m. UTC | #2
On 06/05/2014 11:43 AM, Kees Cook wrote:
> BugLink: http://bugs.launchpad.net/bugs/1326905
> 
> commit 5cdf389aee90109e2e3d88085dea4dd5508a3be7 upstream.
> 
> PTRACE_EVENT_foo and PTRACE_O_TRACEfoo used to match.
> 
> New PTRACE_EVENT_STOP is the first event which has no corresponding
> PTRACE_O_TRACE option.  If we will ever want to add another such option,
> its PTRACE_EVENT's value will collide with PTRACE_EVENT_STOP's value.
> 
> This patch changes PTRACE_EVENT_STOP value to prevent this.
> 
> While at it, added a comment - the one atop PTRACE_EVENT block, saying
> "Wait extended result codes for the above trace options", is not true
> for PTRACE_EVENT_STOP.
> 
> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
> Cc: Tejun Heo <tj@kernel.org>
> Reviewed-by: Oleg Nesterov <oleg@redhat.com>
> Cc: Pedro Alves <palves@redhat.com>
> Cc: Jan Kratochvil <jan.kratochvil@redhat.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> 
> [kees:adjusted PTRACE_EVENT_SECCOMP as well]
> Signed-off-by: Kees Cook <kees@ubuntu.com>
> ---
>  include/linux/ptrace.h | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
> index 6c50571..8f17a17 100644
> --- a/include/linux/ptrace.h
> +++ b/include/linux/ptrace.h
> @@ -73,8 +73,10 @@
>  #define PTRACE_EVENT_EXEC	4
>  #define PTRACE_EVENT_VFORK_DONE	5
>  #define PTRACE_EVENT_EXIT	6
> -#define PTRACE_EVENT_STOP	7
> -#define PTRACE_EVENT_SECCOMP	8
> +#define PTRACE_EVENT_SECCOMP	7
> +
> +/* Extended result codes which enabled by means other than options.  */
> +#define PTRACE_EVENT_STOP	128
>  
>  #include <asm/ptrace.h>
>  
>
Tim Gardner June 6, 2014, 5:22 p.m. UTC | #3

diff mbox

Patch

diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 6c50571..8f17a17 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -73,8 +73,10 @@ 
 #define PTRACE_EVENT_EXEC	4
 #define PTRACE_EVENT_VFORK_DONE	5
 #define PTRACE_EVENT_EXIT	6
-#define PTRACE_EVENT_STOP	7
-#define PTRACE_EVENT_SECCOMP	8
+#define PTRACE_EVENT_SECCOMP	7
+
+/* Extended result codes which enabled by means other than options.  */
+#define PTRACE_EVENT_STOP	128
 
 #include <asm/ptrace.h>