Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 497140 - sys-kernel/hardened-sources-3.12.6-r4 CONFIG_GRKERNSEC_HARDEN_IPC=y breaks alsalib, qpdfview and okular.
Summary: sys-kernel/hardened-sources-3.12.6-r4 CONFIG_GRKERNSEC_HARDEN_IPC=y breaks al...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Hardened (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: The Gentoo Linux Hardened Kernel Team (OBSOLETE)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-05 14:21 UTC by Martin Väth
Modified: 2015-05-10 14:40 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Väth 2014-01-05 14:21:13 UTC
With hardened-sources-3.12.6-r4 any attempt to play sound over alsa (mplayer2, skype, ...) fails with the error that an IPC semaphores cannot be created.
Obviously, it is grsec/pax-related since the log says:

grsec: denied write of overly-permissive IPC object with creator uid 0 by ...

Even running as root and given all permissions to the program with paxctl-ng does not change the situation; also pax softmode does not help.

hardened-sources-3.12.6-r2 had no such problem.
(hardened-sources-3.12.6-r3 did not compile for me).
Comment 1 Mark Wright gentoo-dev 2014-01-10 13:19:24 UTC
The output of

strace -f -o strace-f-o-qpdfview.txt qpdfview

with CONFIG_GRKERNSEC_HARDEN_IPC=y ends with:

22021 shmget(IPC_PRIVATE, 4590736, IPC_CREAT|0700) = 282296347
22021 shmat(282296347, 0, 0)            = -1 EACCES (Permission denied)
22021 write(2, "QNativeImage: Unable to attach t"..., 58) = 58
22021 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xfffffffffffffff7} ---
22021 +++ killed by SIGSEGV +++

Thanks to amade for suggesting changing CONFIG_GRKERNSEC_HARDEN_IPC=n
in the linux-3.12.6-hardened-r4 kernel configuration, then rebooting,
then qpdfview (and okular) work fine.
Comment 2 Martin Väth 2014-01-10 15:49:43 UTC
Does this mean that CONFIG_GRKERNSEC_HARDEN_IPC=y did not work at all in <hardened-sources-3.12.6-r4 or does this mean that CONFIG_GRKERNSEC_HARDEN_IPC=y got an additional enforcement in hardened-sources-3.12.6-r4?

In the latter case, it would perhaps make sense to give a separate kernel option to this additional enforcement so that people needing audio or poppler need not completely switch off that feature but can still use the "less enforced" version of CONFIG_GRKERNSEC_HARDEN_IPC=y from <hardened-sources-3.12.6-r4.
Comment 3 Martin Väth 2014-01-22 18:47:03 UTC
Just for the records:

Since hardened-sources-3.12.8 (I have not retried with earlier versions) it is for many things (avidemux3_qt, mplayer2, ...) not sufficient to unset harden_ipc in the systctl kernel interface - it is really necessary to compile the kernel without CONFIG_GRKERNSEC_HARDEN_IPC to make them work.
Comment 4 Anthony Basile gentoo-dev 2014-09-14 00:21:41 UTC
Is this still an issue with the latest hardened-sources?
Comment 5 Martin Väth 2014-09-14 09:18:00 UTC
I did just a brief test on x86 (hardened-sources-3.16.2-r1 with HARDENED_IPC):
mplayer (w/ alsa) worked fine.

On amd64 there is still the same issue (with same settings):
No sound with mplayer, and the log message of comment #1 appears
Comment 6 Mathias Krause 2014-09-14 09:33:40 UTC
The feature CONFIG_GRKERNSEC_HARDEN_IPC had a bug in those kernel versions up to grsecurity-3.0-3.13.5-201403022155.patch where it would deny the shmat() if the harden_ipc sysctl was set to 0. It got the logic wrong in this case (returned "deny" instead of "allow" in gr_ipc_permitted()). This was fixed in the afore mentioned patch.
Comment 7 Alpha Bravo 2014-10-21 16:37:25 UTC
On amd64/no-multilib with hardened-sources-3.17.1 and CONFIG_GRKERNSEC_HARDEN_IPC=y and qpdfview-0.4.11.1-r1

# strace -f -o strace-f-o-qpdfview.txt qpdfview

I don't get an error, it only says

iconTheme "nameofmyicontheme"

and the program starts.
mplayer works as well (alsa-lib-1.0.28), i do have sound
Comment 8 Anthony Basile gentoo-dev 2014-10-21 16:51:50 UTC
Okay pinging upstream pax
Comment 9 Anthony Basile gentoo-dev 2015-05-10 14:40:35 UTC
forgot to close this.