Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 436626 - dev-libs/libffi-3.0.x fail PROT_EXEC on hardened PaX Kernel
Summary: dev-libs/libffi-3.0.x fail PROT_EXEC on hardened PaX Kernel
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 Team
URL: http://sourceware.org/ml/libffi-discu...
Whiteboard:
Keywords:
Depends on:
Blocks: 329499
  Show dependency tree
 
Reported: 2012-09-30 00:54 UTC by Magnus Granberg
Modified: 2013-02-10 13:56 UTC (History)
5 users (show)

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


Attachments
libffi gentoo patch of the upstream patch (libffi-emutramp.patch,3.04 KB, text/plain)
2012-09-30 00:54 UTC, Magnus Granberg
Details
diff of the ebuild (diff-libffi.ebuild.patch,1016 bytes, patch)
2012-09-30 00:59 UTC, Magnus Granberg
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Granberg gentoo-dev 2012-09-30 00:54:13 UTC
Created attachment 325350 [details]
libffi gentoo patch of the upstream patch

Libffi fail to use PROT_EXEC in mmap and creat files to use when TPE is enable or if the filesystem is readonly systems. For now all apps that use the lib need MPROTECT disable. This patch make it work with MPROTECT on. We use the EMUTRAMP option. The patch is send upstream but looks like it is ignored.
Comment 1 Magnus Granberg gentoo-dev 2012-09-30 00:59:45 UTC
Created attachment 325352 [details, diff]
diff of the ebuild

Diff of the ebuild.
Comment 2 SpanKY gentoo-dev 2012-10-09 21:58:51 UTC
(In reply to comment #1)

i'm not sure why this is a configure option at all.  wouldn't it be better to check the return of the mmap and the errno value ?

seems like all code using libffi will continue to crash unless someone exports FFI_DISABLE_EMUTRAMP ahead of time.  that isn't a good user interface.
Comment 3 Anthony Basile gentoo-dev 2012-10-10 00:38:38 UTC
(In reply to comment #2)
> (In reply to comment #1)
> 
> i'm not sure why this is a configure option at all.  wouldn't it be better
> to check the return of the mmap and the errno value ?
> 
> seems like all code using libffi will continue to crash unless someone
> exports FFI_DISABLE_EMUTRAMP ahead of time.  that isn't a good user
> interface.

yes you're right, it would be better to check the return value.  this also addresses the situation where someone doesn't enable the configure option because they don't think they'll be running a pax kernel and then they boot into one and suddenly libffi is borked.
Comment 4 Samuli Suominen (RETIRED) gentoo-dev 2013-02-10 13:55:44 UTC
this fix is in tree as 3.0.12_rc3, the final is out like within days