linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/seccomp: Support glibc 2.26 siginfo_t.h
@ 2017-09-07 23:32 Kees Cook
  2017-09-08  3:19 ` Seth Forshee
  0 siblings, 1 reply; 5+ messages in thread
From: Kees Cook @ 2017-09-07 23:32 UTC (permalink / raw)
  To: Seth Forshee
  Cc: Shuah Khan, Andy Lutomirski, Will Drewry, linux-kselftest, linux-kernel

The 2.26 release of glibc changed how siginfo_t is defined, and the earlier
work-around to using the kernel definition are no longer needed. The old
way needs to stay around for a while, though.

Reported-by: Seth Forshee <seth.forshee@canonical.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Will Drewry <wad@chromium.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-kselftest@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
Seth, can you double check this to confirm it works for you too? This builds
and tests correctly for me on both Ubuntu 17.10 (-proposed) with glibc 2.26
and with earlier distros with 2.24, etc.
---
 tools/testing/selftests/seccomp/seccomp_bpf.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 73f5ea6778ce..9380c3fc7cfe 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -6,10 +6,18 @@
  */
 
 #include <sys/types.h>
-#include <asm/siginfo.h>
-#define __have_siginfo_t 1
-#define __have_sigval_t 1
-#define __have_sigevent_t 1
+
+/*
+ * glibc 2.26 and later have SIGSYS in siginfo_t. Before that,
+ * we need to use the kernel's siginfo.h file and trick glibc
+ * into accepting it.
+ */
+#if !__GLIBC_PREREQ(2, 26)
+# include <asm/siginfo.h>
+# define __have_siginfo_t 1
+# define __have_sigval_t 1
+# define __have_sigevent_t 1
+#endif
 
 #include <errno.h>
 #include <linux/filter.h>
@@ -676,7 +684,7 @@ TEST_F_SIGNAL(TRAP, ign, SIGSYS)
 	syscall(__NR_getpid);
 }
 
-static struct siginfo TRAP_info;
+static siginfo_t TRAP_info;
 static volatile int TRAP_nr;
 static void TRAP_action(int nr, siginfo_t *info, void *void_context)
 {
-- 
2.7.4


-- 
Kees Cook
Pixel Security

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests/seccomp: Support glibc 2.26 siginfo_t.h
  2017-09-07 23:32 [PATCH] selftests/seccomp: Support glibc 2.26 siginfo_t.h Kees Cook
@ 2017-09-08  3:19 ` Seth Forshee
  2017-09-08  3:36   ` Kees Cook
  0 siblings, 1 reply; 5+ messages in thread
From: Seth Forshee @ 2017-09-08  3:19 UTC (permalink / raw)
  To: Kees Cook
  Cc: Shuah Khan, Andy Lutomirski, Will Drewry, linux-kselftest, linux-kernel

On Thu, Sep 07, 2017 at 04:32:46PM -0700, Kees Cook wrote:
> The 2.26 release of glibc changed how siginfo_t is defined, and the earlier
> work-around to using the kernel definition are no longer needed. The old
> way needs to stay around for a while, though.
> 
> Reported-by: Seth Forshee <seth.forshee@canonical.com>
> Cc: Andy Lutomirski <luto@amacapital.net>
> Cc: Will Drewry <wad@chromium.org>
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: linux-kselftest@vger.kernel.org
> Cc: stable@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> Seth, can you double check this to confirm it works for you too? This builds
> and tests correctly for me on both Ubuntu 17.10 (-proposed) with glibc 2.26
> and with earlier distros with 2.24, etc.

It builds and tests correctly for me too, with both glibc 2.26 and 2.24.

Tested-by: Seth Forshee <seth.forshee@canonical.com>

Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests/seccomp: Support glibc 2.26 siginfo_t.h
  2017-09-08  3:19 ` Seth Forshee
@ 2017-09-08  3:36   ` Kees Cook
  2017-09-20 22:02     ` Kees Cook
  0 siblings, 1 reply; 5+ messages in thread
From: Kees Cook @ 2017-09-08  3:36 UTC (permalink / raw)
  To: Seth Forshee, Shuah Khan
  Cc: Andy Lutomirski, Will Drewry, open list:KERNEL SELFTEST FRAMEWORK, LKML

On Thu, Sep 7, 2017 at 8:19 PM, Seth Forshee <seth.forshee@canonical.com> wrote:
> On Thu, Sep 07, 2017 at 04:32:46PM -0700, Kees Cook wrote:
>> The 2.26 release of glibc changed how siginfo_t is defined, and the earlier
>> work-around to using the kernel definition are no longer needed. The old
>> way needs to stay around for a while, though.
>>
>> Reported-by: Seth Forshee <seth.forshee@canonical.com>
>> Cc: Andy Lutomirski <luto@amacapital.net>
>> Cc: Will Drewry <wad@chromium.org>
>> Cc: Shuah Khan <shuah@kernel.org>
>> Cc: linux-kselftest@vger.kernel.org
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>> ---
>> Seth, can you double check this to confirm it works for you too? This builds
>> and tests correctly for me on both Ubuntu 17.10 (-proposed) with glibc 2.26
>> and with earlier distros with 2.24, etc.
>
> It builds and tests correctly for me too, with both glibc 2.26 and 2.24.
>
> Tested-by: Seth Forshee <seth.forshee@canonical.com>

Awesome, thanks!

Shuah, is it possible to land this for v4.14? If it has to wait,
that's probably okay, as I've marked it for -stable, so it'll get
where it needs to be eventually. :)

Thanks!

-Kees

-- 
Kees Cook
Pixel Security

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests/seccomp: Support glibc 2.26 siginfo_t.h
  2017-09-08  3:36   ` Kees Cook
@ 2017-09-20 22:02     ` Kees Cook
  2017-09-20 22:42       ` Shuah Khan
  0 siblings, 1 reply; 5+ messages in thread
From: Kees Cook @ 2017-09-20 22:02 UTC (permalink / raw)
  To: Seth Forshee, Shuah Khan
  Cc: Andy Lutomirski, Will Drewry, open list:KERNEL SELFTEST FRAMEWORK, LKML

On Thu, Sep 7, 2017 at 8:36 PM, Kees Cook <keescook@chromium.org> wrote:
> On Thu, Sep 7, 2017 at 8:19 PM, Seth Forshee <seth.forshee@canonical.com> wrote:
>> On Thu, Sep 07, 2017 at 04:32:46PM -0700, Kees Cook wrote:
>>> The 2.26 release of glibc changed how siginfo_t is defined, and the earlier
>>> work-around to using the kernel definition are no longer needed. The old
>>> way needs to stay around for a while, though.
>>>
>>> Reported-by: Seth Forshee <seth.forshee@canonical.com>
>>> Cc: Andy Lutomirski <luto@amacapital.net>
>>> Cc: Will Drewry <wad@chromium.org>
>>> Cc: Shuah Khan <shuah@kernel.org>
>>> Cc: linux-kselftest@vger.kernel.org
>>> Cc: stable@vger.kernel.org
>>> Signed-off-by: Kees Cook <keescook@chromium.org>
>>> ---
>>> Seth, can you double check this to confirm it works for you too? This builds
>>> and tests correctly for me on both Ubuntu 17.10 (-proposed) with glibc 2.26
>>> and with earlier distros with 2.24, etc.
>>
>> It builds and tests correctly for me too, with both glibc 2.26 and 2.24.
>>
>> Tested-by: Seth Forshee <seth.forshee@canonical.com>
>
> Awesome, thanks!
>
> Shuah, is it possible to land this for v4.14? If it has to wait,
> that's probably okay, as I've marked it for -stable, so it'll get
> where it needs to be eventually. :)

Friendly ping, Shuah, are you able to take this?

Thanks!

-Kees

-- 
Kees Cook
Pixel Security

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests/seccomp: Support glibc 2.26 siginfo_t.h
  2017-09-20 22:02     ` Kees Cook
@ 2017-09-20 22:42       ` Shuah Khan
  0 siblings, 0 replies; 5+ messages in thread
From: Shuah Khan @ 2017-09-20 22:42 UTC (permalink / raw)
  To: Kees Cook, Seth Forshee
  Cc: Andy Lutomirski, Will Drewry,
	open list:KERNEL SELFTEST FRAMEWORK, LKML, Shuah Khan,
	Shuah Khan

On 09/20/2017 04:02 PM, Kees Cook wrote:
> On Thu, Sep 7, 2017 at 8:36 PM, Kees Cook <keescook@chromium.org> wrote:
>> On Thu, Sep 7, 2017 at 8:19 PM, Seth Forshee <seth.forshee@canonical.com> wrote:
>>> On Thu, Sep 07, 2017 at 04:32:46PM -0700, Kees Cook wrote:
>>>> The 2.26 release of glibc changed how siginfo_t is defined, and the earlier
>>>> work-around to using the kernel definition are no longer needed. The old
>>>> way needs to stay around for a while, though.
>>>>
>>>> Reported-by: Seth Forshee <seth.forshee@canonical.com>
>>>> Cc: Andy Lutomirski <luto@amacapital.net>
>>>> Cc: Will Drewry <wad@chromium.org>
>>>> Cc: Shuah Khan <shuah@kernel.org>
>>>> Cc: linux-kselftest@vger.kernel.org
>>>> Cc: stable@vger.kernel.org
>>>> Signed-off-by: Kees Cook <keescook@chromium.org>
>>>> ---
>>>> Seth, can you double check this to confirm it works for you too? This builds
>>>> and tests correctly for me on both Ubuntu 17.10 (-proposed) with glibc 2.26
>>>> and with earlier distros with 2.24, etc.
>>>
>>> It builds and tests correctly for me too, with both glibc 2.26 and 2.24.
>>>
>>> Tested-by: Seth Forshee <seth.forshee@canonical.com>
>>
>> Awesome, thanks!
>>
>> Shuah, is it possible to land this for v4.14? If it has to wait,
>> that's probably okay, as I've marked it for -stable, so it'll get
>> where it needs to be eventually. :)
> 
> Friendly ping, Shuah, are you able to take this?
> 
> Thanks!
> 
> -Kees
> 

Yes I can this into 4.14-rc2 or rc3. Thanks for the ping.

-- Shuah

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-09-20 22:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-07 23:32 [PATCH] selftests/seccomp: Support glibc 2.26 siginfo_t.h Kees Cook
2017-09-08  3:19 ` Seth Forshee
2017-09-08  3:36   ` Kees Cook
2017-09-20 22:02     ` Kees Cook
2017-09-20 22:42       ` Shuah Khan

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).