mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Willeke <willeke@linux.vnet.ibm.com>
To: Kees Cook <keescook@chromium.org>
Cc: heicars2@linux.vnet.ibm.com,
	Andy Lutomirski <luto@amacapital.net>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: Fw: seccomp selftest on s390
Date: Fri, 21 Aug 2015 14:20:57 +0200	[thread overview]
Message-ID: <1440159657.6295.10.camel@BL3AGF5T.de.ibm.com> (raw)
In-Reply-To: <OFECC5FAAD.3D356CD5-ONC1257EA8.003F3F5A-C1257EA8.003F4C0D@de.ibm.com>

On Fri, 2015-08-20 at 23:33 , Kees Cook wrote:
> Hi!
> 
> I don't have access to s390 running a modern kernel, so I've not been able
> to meaningfully run the seccomp selftest suite. In a quick review, I think
> the following is close to the missing pieces, but I can't verify it. :)
> 
> Can someone let me know if this works, or otherwise check that the
> tools/testing/selftests/seccomp suite passes on s390?
> 
> Thanks!
> 
> -Kees
> 
> --- seccomp_bpf.c.orig		 2015-08-20 21:13:17.735789007 +0000
> +++ seccomp_bpf.c		 2015-08-20 21:09:49.547879621 +0000
> @@ -1210,6 +1211,10 @@
>  # define ARCH_REGS		 struct pt_regs
>  # define SYSCALL_NUM		 gpr[0]
>  # define SYSCALL_RET		 gpr[3]
> +#elif defined(__s390__)
> +# define ARCH_REGS		 s390_regs
> +# define SYSCALL_NUM		 gprs[1]
> +# define SYSCALL_RET		 gprs[2]
>  #else
>  # error "Do not know how to find your architecture's registers and
> syscalls"
>  #endif
> @@ -1243,7 +1248,7 @@
>  		 ret = ptrace(PTRACE_GETREGSET, tracee, NT_PRSTATUS, &iov);
>  		 EXPECT_EQ(0, ret);
> 
> -#if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__) ||
> defined(__powerpc__)
> +#if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__) ||
> defined(__powerpc__) || defined(__s390__)
>  		 {
>  		 		 regs.SYSCALL_NUM = syscall;
>  		 }
> 
> --
> Kees Cook
> Chrome OS Security
> 
> 


Hi Kees,
to compile the code warning free I added:

@@ -1409,6 +1413,8 @@ TEST_F(TRACE_syscall, syscall_dropped)
 #  define __NR_seccomp 277
 # elif defined(__powerpc__)
 #  define __NR_seccomp 358
+# elif defined(__s390__)
+#  define __NR_seccomp 348
 # else
 #  warning "seccomp syscall number unknown for this architecture"
 #  define __NR_seccomp 0xffff

than I run the testcase on the linux next kernel, result:

./seccomp_bpf 
[==========] Running 48 tests from 1 test cases.
...
[       OK ] TRACE_syscall.syscall_allowed
[ RUN      ] TRACE_syscall.syscall_redirected
seccomp_bpf.c:1386:TRACE_syscall.syscall_redirected:Expected
self->parent (2774548873216) == syscall(20) (686)
seccomp_bpf.c:1387:TRACE_syscall.syscall_redirected:Expected self->mypid
(2946347565056) != syscall(20) (686)
[     FAIL ] TRACE_syscall.syscall_redirected
[ RUN      ] TRACE_syscall.syscall_dropped
[       OK ] TRACE_syscall.syscall_dropped
...
[ RUN      ] TSYNC.two_siblings_not_under_filter
[       OK ] TSYNC.two_siblings_not_under_filter
[ RUN      ] global.syscall_restart
seccomp_bpf.c:2063:global.syscall_restart:Expected 168 (721554505728) ==
get_syscall(_metadata, child_pid) (14965540365812105216)
seccomp_bpf.c:2104:global.syscall_restart:Expected 7 (30064771072) ==
ret (18446744072899020716)
[     FAIL ] global.syscall_restart
[==========] 46 / 48 tests passed.
[  FAILED  ]

I hope that helps you.

regards Jan 

Linux on z Systems Development
----------------------------------------------------
IBM Deutschland Research & Development GmbH, Vorsitzende des
Aufsichtsrats:
Martina Koederitz, Geschäftsführung: Dirk WittkoppSitz der Gesellschaft:
Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294


       reply	other threads:[~2015-08-21 12:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <OFECC5FAAD.3D356CD5-ONC1257EA8.003F3F5A-C1257EA8.003F4C0D@de.ibm.com>
2015-08-21 12:20 ` Jan Willeke [this message]
2015-08-21 16:56   ` Kees Cook

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=1440159657.6295.10.camel@BL3AGF5T.de.ibm.com \
    --to=willeke@linux.vnet.ibm.com \
    --cc=heicars2@linux.vnet.ibm.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    /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

all inboxes | Powered by JetHome®