Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: 11-basic-basic_errors failed with Ubuntu Bionic 4.15 kernel #336

Closed
Cypresslin opened this issue Sep 2, 2021 · 7 comments
Closed

Q: 11-basic-basic_errors failed with Ubuntu Bionic 4.15 kernel #336

Cypresslin opened this issue Sep 2, 2021 · 7 comments

Comments

@Cypresslin
Copy link

Hello,

we have found that the recent commit, fcc6012, to the 11-basic-basic_errors test case will cause failure on Ubuntu Bionic 4.15 kernel.

 batch name: 11-basic-basic_errors
 test mode:  c
 test type:  basic
Test 11-basic-basic_errors%%001-00001 result:   FAILURE 11-basic-basic_errors rc=255

Kernel version:

Linux glameow 4.15.0-156-generic #163 SMP Mon Aug 30 08:02:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Do you know if there is some kernel patch we need to pick up? Or if this is a test case issue?
Thank you!

https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/1940261

@pcmoore pcmoore changed the title 11-basic-basic_errors failed with Ubuntu Bionic 4.15 kernel Q: 11-basic-basic_errors failed with Ubuntu Bionic 4.15 kernel Sep 3, 2021
@pcmoore
Copy link
Member

pcmoore commented Sep 3, 2021

We know that the test case works on modern kernels, and they should also be safe on older kernels as well, although it is possible that when cherry-picking kernel patches the distro creates an off franken-kernel which doesn't behave as one would expect an upstream kernel to behave.

I don't have an Ubuntu Bionic system handy to test this, but could you trace through the test to see where it is failing? That might help us identify the root cause.

@drakenclimber
Copy link
Member

drakenclimber commented Sep 3, 2021

$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
...

$ uname -r
4.15.0-154-generic

It looks like Ubuntu 18.04 is failing on this line:

rc = syscall(__NR_seccomp, SECCOMP_GET_NOTIF_SIZES, 0, &sizes);

The rc is -1 and errno is set to EINVAL. I don't know what the aforementioned Ubuntu kernel is doing. I'll leave that as an exercise for the reader :)

@pcmoore
Copy link
Member

pcmoore commented Sep 3, 2021

Hmm, yeah, it looks like the seccomp_notify_alloc() call in test 11 needs to be put behind an API level check and only tested if the API level is at "5" or above.

Not sure if that is the original reporters problem, but it is a problem.

@Cypresslin
Copy link
Author

Sorry for the late reply,
yes this is failing with case rc = seccomp_notify_alloc(NULL, NULL); in 11-basic-basic_errors.c. The api level is 4 as reported in api.c.
And rc = -1 like drakenclimber commented above.

This issue can be reproduced on mainline kernel 4.19.211-0419211-generic as well.
This issue does not exist on Ubuntu Bionic 5.4.0

Thanks.

@pcmoore
Copy link
Member

pcmoore commented Oct 15, 2021

@Cypresslin can you try PR #346 to see if that fixes the problem you are seeing?

@Cypresslin
Copy link
Author

Hi @pcmoore,
PR #346 tested with 4.15.0-159-generic #167-Ubuntu, this test will be skipped.

Test 10-sim-syscall_priority_post%%008-00001 result:   SUCCESS
 batch name: 11-basic-basic_errors
 test mode:  c
 test type:  basic
Test 11-basic-basic_errors%%001-00001 result:   SUCCESS
 batch name: 12-sim-basic_masked_ops
 test mode:  c
 test type:  bpf-sim
Test 12-sim-basic_masked_ops%%001-00001 result:   SUCCESS

Thanks for the fix.

@pcmoore
Copy link
Member

pcmoore commented Oct 18, 2021

Thanks for checking @Cypresslin, since we've merged that PR into both the main and release-2.5 stable branch I'm going to close this issue; the fix will be included in the next libseccomp v2.5.x release.

@pcmoore pcmoore closed this as completed Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants