[RESEND PATCH 0/2][SRU][DISCO][EOAN] seccomp: fix selftests compilation

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[RESEND PATCH 0/2][SRU][DISCO][EOAN] seccomp: fix selftests compilation

Christian Brauner-3
Hey everyone,

BugLink: https://bugs.launchpad.net/bugs/1849281

This contains two small fixes for the seccomp selftests so they can be
compiled on older kernels.
The first patch is upstream, the second one is in Kees tree targeted for
inclusion in v5.5. The latter one needs to be backported because we
backported the SECCOMP_USER_NOTIF_FLAG_CONTINUE feature
(cf. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1847744)

Thanks!
Christian

Christian Brauner (1):
  UBUNTU: SAUCE: seccomp: fix SECCOMP_USER_NOTIF_FLAG_CONTINUE test

Tycho Andersen (1):
  selftests/seccomp: fix build on older kernels

 tools/testing/selftests/seccomp/seccomp_bpf.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

--
2.23.0


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[RESEND PATCH 1/2][SRU][DISCO][EOAN] selftests/seccomp: fix build on older kernels

Christian Brauner-3
From: Tycho Andersen <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1849281

[ Upstream commit 88282297fff00796e81f5e67734a6afdfb31fbc4 ]

The seccomp selftest goes to some length to build against older kernel
headers, viz. all the #ifdefs at the beginning of the file.

Commit 201766a20e30 ("ptrace: add PTRACE_GET_SYSCALL_INFO request")
introduces some additional macros, but doesn't do the #ifdef dance.
Let's add that dance here to avoid:

gcc -Wl,-no-as-needed -Wall  seccomp_bpf.c -lpthread -o seccomp_bpf
In file included from seccomp_bpf.c:51:
seccomp_bpf.c: In function ‘tracer_ptrace’:
seccomp_bpf.c:1787:20: error: ‘PTRACE_EVENTMSG_SYSCALL_ENTRY’ undeclared (first use in this function); did you mean ‘PTRACE_EVENT_CLONE’?
  EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../kselftest_harness.h:608:13: note: in definition of macro ‘__EXPECT’
  __typeof__(_expected) __exp = (_expected); \
             ^~~~~~~~~
seccomp_bpf.c:1787:2: note: in expansion of macro ‘EXPECT_EQ’
  EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY
  ^~~~~~~~~
seccomp_bpf.c:1787:20: note: each undeclared identifier is reported only once for each function it appears in
  EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../kselftest_harness.h:608:13: note: in definition of macro ‘__EXPECT’
  __typeof__(_expected) __exp = (_expected); \
             ^~~~~~~~~
seccomp_bpf.c:1787:2: note: in expansion of macro ‘EXPECT_EQ’
  EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY
  ^~~~~~~~~
seccomp_bpf.c:1788:6: error: ‘PTRACE_EVENTMSG_SYSCALL_EXIT’ undeclared (first use in this function); did you mean ‘PTRACE_EVENT_EXIT’?
    : PTRACE_EVENTMSG_SYSCALL_EXIT, msg);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../kselftest_harness.h:608:13: note: in definition of macro ‘__EXPECT’
  __typeof__(_expected) __exp = (_expected); \
             ^~~~~~~~~
seccomp_bpf.c:1787:2: note: in expansion of macro ‘EXPECT_EQ’
  EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY
  ^~~~~~~~~
make: *** [Makefile:12: seccomp_bpf] Error 1

[[hidden email]: Fix checkpatch error in commit log]
Signed-off-by: Tycho Andersen <[hidden email]>
Fixes: 201766a20e30 ("ptrace: add PTRACE_GET_SYSCALL_INFO request")
Acked-by: Kees Cook <[hidden email]>
Signed-off-by: Shuah Khan <[hidden email]>
Signed-off-by: Christian Brauner <[hidden email]>
---
 tools/testing/selftests/seccomp/seccomp_bpf.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 7e448d5b608a..6021baecb386 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -204,6 +204,11 @@ struct seccomp_notif_sizes {
 };
 #endif
 
+#ifndef PTRACE_EVENTMSG_SYSCALL_ENTRY
+#define PTRACE_EVENTMSG_SYSCALL_ENTRY 1
+#define PTRACE_EVENTMSG_SYSCALL_EXIT 2
+#endif
+
 #ifndef seccomp
 int seccomp(unsigned int op, unsigned int flags, void *args)
 {
--
2.23.0


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[RESEND PATCH 2/2][SRU][DISCO][EOAN] UBUNTU: SAUCE: seccomp: fix SECCOMP_USER_NOTIF_FLAG_CONTINUE test

Christian Brauner-3
In reply to this post by Christian Brauner-3
BugLink: https://bugs.launchpad.net/bugs/1849281

The ifndef for SECCOMP_USER_NOTIF_FLAG_CONTINUE was placed under the
ifndef for the SECCOMP_FILTER_FLAG_NEW_LISTENER feature. This will not
work on systems that do support SECCOMP_FILTER_FLAG_NEW_LISTENER but do not
support SECCOMP_USER_NOTIF_FLAG_CONTINUE. So move the latter ifndef out of
the former ifndef's scope.

2019-10-20 11:14:01 make run_tests -C seccomp
make: Entering directory '/usr/src/perf_selftests-x86_64-rhel-7.6-0eebfed2954f152259cae0ad57b91d3ea92968e8/tools/testing/selftests/seccomp'
gcc -Wl,-no-as-needed -Wall  seccomp_bpf.c -lpthread -o seccomp_bpf
seccomp_bpf.c: In function ‘user_notification_continue’:
seccomp_bpf.c:3562:15: error: ‘SECCOMP_USER_NOTIF_FLAG_CONTINUE’ undeclared (first use in this function)
  resp.flags = SECCOMP_USER_NOTIF_FLAG_CONTINUE;
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
seccomp_bpf.c:3562:15: note: each undeclared identifier is reported only once for each function it appears in
Makefile:12: recipe for target 'seccomp_bpf' failed
make: *** [seccomp_bpf] Error 1
make: Leaving directory '/usr/src/perf_selftests-x86_64-rhel-7.6-0eebfed2954f152259cae0ad57b91d3ea92968e8/tools/testing/selftests/seccomp'

Reported-by: kernel test robot <[hidden email]>
Fixes: 0eebfed2954f ("seccomp: test SECCOMP_USER_NOTIF_FLAG_CONTINUE")
Cc: [hidden email]
Signed-off-by: Christian Brauner <[hidden email]>
Reviewed-by: Tycho Andersen <[hidden email]>
Link: https://lore.kernel.org/r/20191021091055.4644-1-christian.brauner@...
Signed-off-by: Kees Cook <[hidden email]>
(cherry picked from commit 2aa8d8d04ca29c3269154e1d48855e498be8882f
 https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git)
Signed-off-by: Christian Brauner <[hidden email]>
---
 tools/testing/selftests/seccomp/seccomp_bpf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 6021baecb386..bf834ee02b69 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -167,10 +167,6 @@ struct seccomp_metadata {
 
 #define SECCOMP_RET_USER_NOTIF 0x7fc00000U
 
-#ifndef SECCOMP_USER_NOTIF_FLAG_CONTINUE
-#define SECCOMP_USER_NOTIF_FLAG_CONTINUE 0x00000001
-#endif
-
 #define SECCOMP_IOC_MAGIC '!'
 #define SECCOMP_IO(nr) _IO(SECCOMP_IOC_MAGIC, nr)
 #define SECCOMP_IOR(nr, type) _IOR(SECCOMP_IOC_MAGIC, nr, type)
@@ -209,6 +205,10 @@ struct seccomp_notif_sizes {
 #define PTRACE_EVENTMSG_SYSCALL_EXIT 2
 #endif
 
+#ifndef SECCOMP_USER_NOTIF_FLAG_CONTINUE
+#define SECCOMP_USER_NOTIF_FLAG_CONTINUE 0x00000001
+#endif
+
 #ifndef seccomp
 int seccomp(unsigned int op, unsigned int flags, void *args)
 {
--
2.23.0


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK / APPLIED[Unstable]: [RESEND PATCH 0/2][SRU][DISCO][EOAN] seccomp: fix selftests compilation

Seth Forshee
In reply to this post by Christian Brauner-3
On Tue, Oct 22, 2019 at 11:36:32AM +0200, Christian Brauner wrote:

> Hey everyone,
>
> BugLink: https://bugs.launchpad.net/bugs/1849281
>
> This contains two small fixes for the seccomp selftests so they can be
> compiled on older kernels.
> The first patch is upstream, the second one is in Kees tree targeted for
> inclusion in v5.5. The latter one needs to be backported because we
> backported the SECCOMP_USER_NOTIF_FLAG_CONTINUE feature
> (cf. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1847744)

Acked-by: Seth Forshee <[hidden email]>

Applied to unstable/master, thanks!

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [RESEND PATCH 1/2][SRU][DISCO][EOAN] selftests/seccomp: fix build on older kernels

Kleber Souza
In reply to this post by Christian Brauner-3
On 22.10.19 11:36, Christian Brauner wrote:

> From: Tycho Andersen <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/bugs/1849281
>
> [ Upstream commit 88282297fff00796e81f5e67734a6afdfb31fbc4 ]
>
> The seccomp selftest goes to some length to build against older kernel
> headers, viz. all the #ifdefs at the beginning of the file.
>
> Commit 201766a20e30 ("ptrace: add PTRACE_GET_SYSCALL_INFO request")
> introduces some additional macros, but doesn't do the #ifdef dance.
> Let's add that dance here to avoid:
>
> gcc -Wl,-no-as-needed -Wall  seccomp_bpf.c -lpthread -o seccomp_bpf
> In file included from seccomp_bpf.c:51:
> seccomp_bpf.c: In function ‘tracer_ptrace’:
> seccomp_bpf.c:1787:20: error: ‘PTRACE_EVENTMSG_SYSCALL_ENTRY’ undeclared (first use in this function); did you mean ‘PTRACE_EVENT_CLONE’?
>   EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY
>                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../kselftest_harness.h:608:13: note: in definition of macro ‘__EXPECT’
>   __typeof__(_expected) __exp = (_expected); \
>              ^~~~~~~~~
> seccomp_bpf.c:1787:2: note: in expansion of macro ‘EXPECT_EQ’
>   EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY
>   ^~~~~~~~~
> seccomp_bpf.c:1787:20: note: each undeclared identifier is reported only once for each function it appears in
>   EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY
>                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../kselftest_harness.h:608:13: note: in definition of macro ‘__EXPECT’
>   __typeof__(_expected) __exp = (_expected); \
>              ^~~~~~~~~
> seccomp_bpf.c:1787:2: note: in expansion of macro ‘EXPECT_EQ’
>   EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY
>   ^~~~~~~~~
> seccomp_bpf.c:1788:6: error: ‘PTRACE_EVENTMSG_SYSCALL_EXIT’ undeclared (first use in this function); did you mean ‘PTRACE_EVENT_EXIT’?
>     : PTRACE_EVENTMSG_SYSCALL_EXIT, msg);
>       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../kselftest_harness.h:608:13: note: in definition of macro ‘__EXPECT’
>   __typeof__(_expected) __exp = (_expected); \
>              ^~~~~~~~~
> seccomp_bpf.c:1787:2: note: in expansion of macro ‘EXPECT_EQ’
>   EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY
>   ^~~~~~~~~
> make: *** [Makefile:12: seccomp_bpf] Error 1
>
> [[hidden email]: Fix checkpatch error in commit log]
> Signed-off-by: Tycho Andersen <[hidden email]>
> Fixes: 201766a20e30 ("ptrace: add PTRACE_GET_SYSCALL_INFO request")
> Acked-by: Kees Cook <[hidden email]>
> Signed-off-by: Shuah Khan <[hidden email]>
> Signed-off-by: Christian Brauner <[hidden email]>

Hi Christian,

It seems this is a cherry-pick or backport of a patch from one of the stable
upstream branches. In that case, we also need to add the provenance of the patch,
the sha1 from where you are cherry-picking/backport (apart from upstream commit
up there ^).

You don't need to resend the patch, please add the additional information
in a reply email.


Thanks,
Kleber

> ---
>  tools/testing/selftests/seccomp/seccomp_bpf.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
> index 7e448d5b608a..6021baecb386 100644
> --- a/tools/testing/selftests/seccomp/seccomp_bpf.c
> +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
> @@ -204,6 +204,11 @@ struct seccomp_notif_sizes {
>  };
>  #endif
>  
> +#ifndef PTRACE_EVENTMSG_SYSCALL_ENTRY
> +#define PTRACE_EVENTMSG_SYSCALL_ENTRY 1
> +#define PTRACE_EVENTMSG_SYSCALL_EXIT 2
> +#endif
> +
>  #ifndef seccomp
>  int seccomp(unsigned int op, unsigned int flags, void *args)
>  {
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [RESEND PATCH 0/2][SRU][DISCO][EOAN] seccomp: fix selftests compilation

Kleber Souza
In reply to this post by Christian Brauner-3
On 22.10.19 11:36, Christian Brauner wrote:

> Hey everyone,
>
> BugLink: https://bugs.launchpad.net/bugs/1849281
>
> This contains two small fixes for the seccomp selftests so they can be
> compiled on older kernels.
> The first patch is upstream, the second one is in Kees tree targeted for
> inclusion in v5.5. The latter one needs to be backported because we
> backported the SECCOMP_USER_NOTIF_FLAG_CONTINUE feature
> (cf. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1847744)
>
> Thanks!
> Christian
>
> Christian Brauner (1):
>   UBUNTU: SAUCE: seccomp: fix SECCOMP_USER_NOTIF_FLAG_CONTINUE test
>
> Tycho Andersen (1):
>   selftests/seccomp: fix build on older kernels
>
>  tools/testing/selftests/seccomp/seccomp_bpf.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>

Hi Christian,

When compiling your seccomp testcase I get the following error
when doing it in a disco VM (with or without these follow up
fixes):

make[1]: Entering directory '/home/ubuntu/disco/linux/tools/testing/selftests/seccomp'
gcc -Wl,-no-as-needed -Wall  seccomp_bpf.c -lpthread -o seccomp_bpf
seccomp_bpf.c: In function ‘user_notification_continue’:
seccomp_bpf.c:3074:26: warning: overflow in conversion from ‘long int’ to ‘__s32’ {aka ‘int’} changes value from ‘116983961184613’ to ‘1936943461’ [-Woverflow]
 #define USER_NOTIF_MAGIC 116983961184613L
                          ^~~~~~~~~~~~~~~~
seccomp_bpf.c:3535:15: note: in expansion of macro ‘USER_NOTIF_MAGIC’
  resp.error = USER_NOTIF_MAGIC;
               ^~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccNnI8Ei.o: in function `user_notification_continue':
seccomp_bpf.c:(.text+0x2e226): undefined reference to `BIT'


Interesting fact is that I don't get this error in a disco
chroot (they compile fine with the fixes).


Could you please investigate it?


Thanks,
Kleber

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [RESEND PATCH 0/2][SRU][DISCO][EOAN] seccomp: fix selftests compilation

Christian Brauner-3
On Mon, Oct 28, 2019 at 05:40:04PM +0100, Kleber Souza wrote:

> On 22.10.19 11:36, Christian Brauner wrote:
> > Hey everyone,
> >
> > BugLink: https://bugs.launchpad.net/bugs/1849281
> >
> > This contains two small fixes for the seccomp selftests so they can be
> > compiled on older kernels.
> > The first patch is upstream, the second one is in Kees tree targeted for
> > inclusion in v5.5. The latter one needs to be backported because we
> > backported the SECCOMP_USER_NOTIF_FLAG_CONTINUE feature
> > (cf. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1847744)
> >
> > Thanks!
> > Christian
> >
> > Christian Brauner (1):
> >   UBUNTU: SAUCE: seccomp: fix SECCOMP_USER_NOTIF_FLAG_CONTINUE test
> >
> > Tycho Andersen (1):
> >   selftests/seccomp: fix build on older kernels
> >
> >  tools/testing/selftests/seccomp/seccomp_bpf.c | 13 +++++++++----
> >  1 file changed, 9 insertions(+), 4 deletions(-)
> >
>
> Hi Christian,
>
> When compiling your seccomp testcase I get the following error
> when doing it in a disco VM (with or without these follow up
> fixes):
>
> make[1]: Entering directory '/home/ubuntu/disco/linux/tools/testing/selftests/seccomp'
> gcc -Wl,-no-as-needed -Wall  seccomp_bpf.c -lpthread -o seccomp_bpf
> seccomp_bpf.c: In function ‘user_notification_continue’:
> seccomp_bpf.c:3074:26: warning: overflow in conversion from ‘long int’ to ‘__s32’ {aka ‘int’} changes value from ‘116983961184613’ to ‘1936943461’ [-Woverflow]
>  #define USER_NOTIF_MAGIC 116983961184613L

Ah yeah, I sent a fix for that upstream too. Yes, that's a problem
that's been around since 5.0. The fix for it is in Kees tree as
223e660bc763 ("seccomp: avoid overflow in implicit constant conversion")
https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?h=for-next/seccomp&id=223e660bc7638d126a0e4fbace4f33f2895788c4

Sorry, that would need to be backported as well. :(

Thanks!
Christian

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

NAK: [RESEND PATCH 0/2][SRU][DISCO][EOAN] seccomp: fix selftests compilation

Kleber Souza
In reply to this post by Christian Brauner-3
On 2019-10-22 11:36, Christian Brauner wrote:

> Hey everyone,
>
> BugLink: https://bugs.launchpad.net/bugs/1849281
>
> This contains two small fixes for the seccomp selftests so they can be
> compiled on older kernels.
> The first patch is upstream, the second one is in Kees tree targeted for
> inclusion in v5.5. The latter one needs to be backported because we
> backported the SECCOMP_USER_NOTIF_FLAG_CONTINUE feature
> (cf. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1847744)
>
> Thanks!
> Christian
>
> Christian Brauner (1):
>   UBUNTU: SAUCE: seccomp: fix SECCOMP_USER_NOTIF_FLAG_CONTINUE test
>
> Tycho Andersen (1):
>   selftests/seccomp: fix build on older kernels
>
>  tools/testing/selftests/seccomp/seccomp_bpf.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>


Hi Christian,

Can you please re-send the patches with the provenance fixed for
patch #1 and with all the follow up fixes?


Thanks,
Kleber

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [RESEND PATCH 0/2][SRU][DISCO][EOAN] seccomp: fix selftests compilation

Kleber Souza
In reply to this post by Christian Brauner-3
On 2019-10-28 18:25, Christian Brauner wrote:

> On Mon, Oct 28, 2019 at 05:40:04PM +0100, Kleber Souza wrote:
>> On 22.10.19 11:36, Christian Brauner wrote:
>>> Hey everyone,
>>>
>>> BugLink: https://bugs.launchpad.net/bugs/1849281
>>>
>>> This contains two small fixes for the seccomp selftests so they can be
>>> compiled on older kernels.
>>> The first patch is upstream, the second one is in Kees tree targeted for
>>> inclusion in v5.5. The latter one needs to be backported because we
>>> backported the SECCOMP_USER_NOTIF_FLAG_CONTINUE feature
>>> (cf. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1847744)
>>>
>>> Thanks!
>>> Christian
>>>
>>> Christian Brauner (1):
>>>   UBUNTU: SAUCE: seccomp: fix SECCOMP_USER_NOTIF_FLAG_CONTINUE test
>>>
>>> Tycho Andersen (1):
>>>   selftests/seccomp: fix build on older kernels
>>>
>>>  tools/testing/selftests/seccomp/seccomp_bpf.c | 13 +++++++++----
>>>  1 file changed, 9 insertions(+), 4 deletions(-)
>>>
>>
>> Hi Christian,
>>
>> When compiling your seccomp testcase I get the following error
>> when doing it in a disco VM (with or without these follow up
>> fixes):
>>
>> make[1]: Entering directory '/home/ubuntu/disco/linux/tools/testing/selftests/seccomp'
>> gcc -Wl,-no-as-needed -Wall  seccomp_bpf.c -lpthread -o seccomp_bpf
>> seccomp_bpf.c: In function ‘user_notification_continue’:
>> seccomp_bpf.c:3074:26: warning: overflow in conversion from ‘long int’ to ‘__s32’ {aka ‘int’} changes value from ‘116983961184613’ to ‘1936943461’ [-Woverflow]
>>  #define USER_NOTIF_MAGIC 116983961184613L
>
> Ah yeah, I sent a fix for that upstream too. Yes, that's a problem
> that's been around since 5.0. The fix for it is in Kees tree as
> 223e660bc763 ("seccomp: avoid overflow in implicit constant conversion")
> https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?h=for-next/seccomp&id=223e660bc7638d126a0e4fbace4f33f2895788c4
>
> Sorry, that would need to be backported as well. :(

Even after applying the 3 patches you mentioned:

 * selftests/seccomp: fix build on older kernels
 * UBUNTU: SAUCE: seccomp: fix SECCOMP_USER_NOTIF_FLAG_CONTINUE test
 * seccomp: avoid overflow in implicit constant conversion

I still get the error:

$ make -C tools/testing/selftests/
[...]
make[1]: Entering directory '/home/ubuntu/disco-git/tools/testing/selftests/seccomp'
gcc -Wl,-no-as-needed -Wall  seccomp_bpf.c -lpthread -o seccomp_bpf
/usr/bin/ld: /tmp/ccVoJj77.o: in function `user_notification_continue':
seccomp_bpf.c:(.text+0x2e1e4): undefined reference to `BIT'


It seems we also need your other patch:

 * seccomp: rework define for SECCOMP_USER_NOTIF_FLAG_CONTINUE
   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?h=for-next/seccomp&id=23b2c96fad21886c53f5e1a4ffedd45ddd2e85ba

because compiling selftests from the source pkg will include
'/usr/include/linux/seccomp.h', which is installed by linux-libc-dev.


Thanks,
Kleber

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [RESEND PATCH 0/2][SRU][DISCO][EOAN] seccomp: fix selftests compilation

Christian Brauner-3
On Tue, Oct 29, 2019 at 01:36:30PM +0100, Kleber Souza wrote:

> On 2019-10-28 18:25, Christian Brauner wrote:
> > On Mon, Oct 28, 2019 at 05:40:04PM +0100, Kleber Souza wrote:
> >> On 22.10.19 11:36, Christian Brauner wrote:
> >>> Hey everyone,
> >>>
> >>> BugLink: https://bugs.launchpad.net/bugs/1849281
> >>>
> >>> This contains two small fixes for the seccomp selftests so they can be
> >>> compiled on older kernels.
> >>> The first patch is upstream, the second one is in Kees tree targeted for
> >>> inclusion in v5.5. The latter one needs to be backported because we
> >>> backported the SECCOMP_USER_NOTIF_FLAG_CONTINUE feature
> >>> (cf. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1847744)
> >>>
> >>> Thanks!
> >>> Christian
> >>>
> >>> Christian Brauner (1):
> >>>   UBUNTU: SAUCE: seccomp: fix SECCOMP_USER_NOTIF_FLAG_CONTINUE test
> >>>
> >>> Tycho Andersen (1):
> >>>   selftests/seccomp: fix build on older kernels
> >>>
> >>>  tools/testing/selftests/seccomp/seccomp_bpf.c | 13 +++++++++----
> >>>  1 file changed, 9 insertions(+), 4 deletions(-)
> >>>
> >>
> >> Hi Christian,
> >>
> >> When compiling your seccomp testcase I get the following error
> >> when doing it in a disco VM (with or without these follow up
> >> fixes):
> >>
> >> make[1]: Entering directory '/home/ubuntu/disco/linux/tools/testing/selftests/seccomp'
> >> gcc -Wl,-no-as-needed -Wall  seccomp_bpf.c -lpthread -o seccomp_bpf
> >> seccomp_bpf.c: In function ‘user_notification_continue’:
> >> seccomp_bpf.c:3074:26: warning: overflow in conversion from ‘long int’ to ‘__s32’ {aka ‘int’} changes value from ‘116983961184613’ to ‘1936943461’ [-Woverflow]
> >>  #define USER_NOTIF_MAGIC 116983961184613L
> >
> > Ah yeah, I sent a fix for that upstream too. Yes, that's a problem
> > that's been around since 5.0. The fix for it is in Kees tree as
> > 223e660bc763 ("seccomp: avoid overflow in implicit constant conversion")
> > https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?h=for-next/seccomp&id=223e660bc7638d126a0e4fbace4f33f2895788c4
> >
> > Sorry, that would need to be backported as well. :(
>
> Even after applying the 3 patches you mentioned:
>
>  * selftests/seccomp: fix build on older kernels
>  * UBUNTU: SAUCE: seccomp: fix SECCOMP_USER_NOTIF_FLAG_CONTINUE test
>  * seccomp: avoid overflow in implicit constant conversion
>
> I still get the error:
>
> $ make -C tools/testing/selftests/
> [...]
> make[1]: Entering directory '/home/ubuntu/disco-git/tools/testing/selftests/seccomp'
> gcc -Wl,-no-as-needed -Wall  seccomp_bpf.c -lpthread -o seccomp_bpf
> /usr/bin/ld: /tmp/ccVoJj77.o: in function `user_notification_continue':
> seccomp_bpf.c:(.text+0x2e1e4): undefined reference to `BIT'
>
>
> It seems we also need your other patch:

Yes, that just got applied two days ago and I haven't been able to
create a new SRU request for that and likely won't be able to until next
week. Unless you want to take this off my hands. :)

Thanks!
Christian

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team