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

system.h: Remove conflicting kernel header include #23

Closed
wants to merge 1 commit into from
Closed

system.h: Remove conflicting kernel header include #23

wants to merge 1 commit into from

Conversation

somasis
Copy link

@somasis somasis commented Jan 1, 2016

This fixes building on musl libc, since musl does not include kernel
headers. I've tested this as working on both glibc and musl.

Signed-off-by: Kylie McClain [email protected]

@anarchpenguin
Copy link

This isn't a proper fix either as now you are gonna have used without defines on a glibc system.

@somasis
Copy link
Author

somasis commented Jan 2, 2016

libseccomp compiled and passed all its tests on a system using glibc-2.22 with linux-headers-4.3, so I'm not entirely sure why it wouldn't be a proper fix.

It could just be surrounded with #ifdef __GLIBC__ if it's really a problem, though.

@anarchpenguin
Copy link

warning: implicit declaration of function 'prctl' [-Wimplicit-function-declaration]

@somasis
Copy link
Author

somasis commented Jan 2, 2016

I don't get a single warning compiling with gcc 5.3.0 (on the same glibc system).

@anarchpenguin
Copy link

/var/tmp/tmpfs/portage/sys-libs/libseccomp-2.2.3/work/libseccomp-2.2.3/src/system.c: In function 'sys_filter_load':
/var/tmp/tmpfs/portage/sys-libs/libseccomp-2.2.3/work/libseccomp-2.2.3/src/system.c:74:8: warning: implicit declaration of function 'prctl' [-Wimplicit-function-declaration]
rc = prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);

That is gcc-5.3.0 glibc-2.22 linux-headers-4.3

@anarchpenguin
Copy link

You most likely are not passing -Wimplicit-function-declaration hense your failure to see them.

@somasis
Copy link
Author

somasis commented Jan 3, 2016

Not a single warning with -Wimplict-function-declaration. Regardless, I'll add an #ifdef.

@somasis somasis changed the title system.h: Remove conflicting kernel header include system.h: Only include prctl.h on glibc Jan 3, 2016
@anarchpenguin
Copy link

ignore my last, I had a bad merge on my tree still sorry for the noise.

@anarchpenguin
Copy link

somasis please use your original patch it will work as well and be just fine. Less ifdef's make life easier

@somasis
Copy link
Author

somasis commented Jan 3, 2016

Alright.

This fixes building on musl libc, since musl does not include kernel
headers. I've tested this as working on both glibc and musl.

Signed-off-by: Kylie McClain <[email protected]>
@somasis somasis changed the title system.h: Only include prctl.h on glibc system.h: Remove conflicting kernel header include Jan 3, 2016
@anarchpenguin
Copy link

Thank you, and once again my apology for the noise. I should have pulled a clean tree and tested it earlier.

@somasis
Copy link
Author

somasis commented Jan 3, 2016

s'all good

@bkuhls
Copy link

bkuhls commented Jan 30, 2016

Positively tested the patch for buildroot: https://patchwork.ozlabs.org/patch/576066/

@pcmoore
Copy link
Member

pcmoore commented Feb 10, 2016

Thanks for your help with resolving the problem but I would rather resolve this by using sys/prctl.h instead of removing the include entirely, see faf6919 for my proposed fix.

@pcmoore pcmoore closed this Feb 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants