mbox series

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

Message ID 20191022093634.27281-1-christian.brauner@ubuntu.com
Headers show
Series seccomp: fix selftests compilation | expand

Message

Christian Brauner Oct. 22, 2019, 9:36 a.m. UTC
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(-)

Comments

Seth Forshee Oct. 22, 2019, 8:39 p.m. UTC | #1
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 <seth.forshee@canonical.com>

Applied to unstable/master, thanks!
Kleber Sacilotto de Souza Oct. 28, 2019, 4:40 p.m. UTC | #2
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
Christian Brauner Oct. 28, 2019, 5:25 p.m. UTC | #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
Kleber Sacilotto de Souza Oct. 29, 2019, 10:02 a.m. UTC | #4
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
Kleber Sacilotto de Souza Oct. 29, 2019, 12:36 p.m. UTC | #5
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
Christian Brauner Oct. 30, 2019, 10:53 a.m. UTC | #6
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