linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: "Dmitry V. Levin" <ldv@altlinux.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Elvira Khabirova <lineprinter@altlinux.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Andy Lutomirski <luto@kernel.org>,
	Eugene Syromyatnikov <esyr@redhat.com>,
	Shuah Khan <shuah@kernel.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	kbuild test robot <lkp@intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	lkp@01.org
Subject: Re: [PATCH] selftests/seccomp/seccomp_bpf: update for PTRACE_GET_SYSCALL_INFO
Date: Mon, 8 Jul 2019 21:24:26 -0700	[thread overview]
Message-ID: <201907082124.F358ED0@keescook> (raw)
In-Reply-To: <20190708182904.GA12332@altlinux.org>

On Mon, Jul 08, 2019 at 09:29:04PM +0300, Dmitry V. Levin wrote:
> The syscall entry/exit is now exposed via PTRACE_GETEVENTMSG,
> update the test accordingly.

Oh yes, thank you!

Acked-by: Kees Cook <keescook@chromium.org>

-Kees

> 
> Reported-by: kernel test robot <rong.a.chen@intel.com>
> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> ---
>  tools/testing/selftests/seccomp/seccomp_bpf.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
> index dc66fe852768..6ef7f16c4cf5 100644
> --- a/tools/testing/selftests/seccomp/seccomp_bpf.c
> +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
> @@ -1775,13 +1775,18 @@ void tracer_ptrace(struct __test_metadata *_metadata, pid_t tracee,
>  	unsigned long msg;
>  	static bool entry;
>  
> -	/* Make sure we got an empty message. */
> +	/*
> +	 * The traditional way to tell PTRACE_SYSCALL entry/exit
> +	 * is by counting.
> +	 */
> +	entry = !entry;
> +
> +	/* Make sure we got an appropriate message. */
>  	ret = ptrace(PTRACE_GETEVENTMSG, tracee, NULL, &msg);
>  	EXPECT_EQ(0, ret);
> -	EXPECT_EQ(0, msg);
> +	EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY
> +			: PTRACE_EVENTMSG_SYSCALL_EXIT, msg);
>  
> -	/* The only way to tell PTRACE_SYSCALL entry/exit is by counting. */
> -	entry = !entry;
>  	if (!entry)
>  		return;
>  
> -- 
> ldv

-- 
Kees Cook

      parent reply	other threads:[~2019-07-09  4:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08  9:06 [ptrace] cd5bbb3047: kernel_selftests.seccomp.seccomp_bpf.fail kernel test robot
2019-07-08 18:29 ` [PATCH] selftests/seccomp/seccomp_bpf: update for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
2019-07-08 18:41   ` Andy Lutomirski
2019-07-09  4:24   ` Kees Cook [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201907082124.F358ED0@keescook \
    --to=keescook@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=esyr@redhat.com \
    --cc=ldv@altlinux.org \
    --cc=lineprinter@altlinux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@01.org \
    --cc=lkp@intel.com \
    --cc=luto@kernel.org \
    --cc=oleg@redhat.com \
    --cc=sfr@canb.auug.org.au \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).