Bug 450551 - OCaml binaries give rpmlint warning about executable-stack
Summary: OCaml binaries give rpmlint warning about executable-stack
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: ocaml
Version: 10
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 444428
TreeView+ depends on / blocked
 
Reported: 2008-06-09 15:26 UTC by Richard W.M. Jones
Modified: 2009-11-18 13:09 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-11-18 13:09:32 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
ocaml-3.11-dev12-no-executable-stack.patch (11.02 KB, patch)
2008-06-09 17:36 UTC, Richard W.M. Jones
no flags Details | Diff

Description Richard W.M. Jones 2008-06-09 15:26:01 UTC
For example:

ocaml-gettext-devel.x86_64: W: executable-stack /usr/bin/ocaml-gettext
The binary declares the stack as executable.  Executable stack is usually an
error as it is only needed if the code contains GCC trampolines or similar
constructs which uses code on the stack.  One common source for needlessly
executable stack cases are object files built from assembler files which don't
define a proper .note.GNU-stack section.

This seems to happen with any binary built with ocamlopt on Rawhide.  It
seems like a new restriction introduced by rpmlint rather than anything
that has changed about OCaml / Rawhide.

I'm going to ask upstream if they know if executable stacks are necessary
and/or could add the GNU note to disable them if that's possible.

Comment 1 Richard W.M. Jones 2008-06-09 15:46:47 UTC
I find that this has already been discussed upstream:

http://caml.inria.fr/pub/ml-archives/caml-list/2006/11/2678e935e05e0298cc2e5352b966c262.en.html

Useful Gentoo page on the subject:

http://www.gentoo.org/proj/en/hardened/gnu-stack.xml

Upstream asked Gentoo to come up with a solution, but as far as I'm aware they didn't,
so I'll investigate making a patch for the ocamlopt compiler to resolve this.

Comment 2 Richard W.M. Jones 2008-06-09 17:36:36 UTC
Created attachment 308730 [details]
ocaml-3.11-dev12-no-executable-stack.patch

Candidate patch for 3.11-dev12.

I successfully generated a binary with a non-executable stack.	Now I need to
backport this patch to 3.10.2 (for Rawhide) so I can check that it makes
rpmlint happy.

Comment 3 Richard W.M. Jones 2008-06-09 17:46:34 UTC
OK, verified this fixes the warning in 3.10.2 as well.


Comment 4 Richard W.M. Jones 2008-06-09 17:51:42 UTC
Submitted upstream:
http://caml.inria.fr/mantis/view.php?id=4564


Comment 5 Richard W.M. Jones 2008-06-09 18:44:06 UTC
Rebuilt with this patch in Rawhide (ocaml-3.10.2-4).
http://koji.fedoraproject.org/koji/taskinfo?taskID=654110


Comment 6 Richard W.M. Jones 2008-06-16 21:16:26 UTC
From upstream:

> I posted a patch which should fix the issue that ocamlopt generates
> binaries with executable stacks:
>
>   http://caml.inria.fr/mantis/view.php?id=4564
>
> However this patch affects every assembly target, far more than I
> could possibly test.  Could people using OCaml on non-Linux platforms
> have a look at the patch, or even test it for me?

I'm pretty sure this patch is Linux-specific.  My fear is that it
might be specific to particular versions of binutils and/or particular
Linux distributions...  I smell a portability nightmare!

Note that in 3.11, the "configure" script will have options to specify
how to call the assembler (for ocamlopt-generated assembly code and
for the hand-written asm files in the runtime system).  So it might be
sufficient to configure the Gentoo packages with e.g.

configure -as "as --noexecstack" -aspp "gcc -c -Wa,--noexecstack"

This could be one of the rare cases where addressing the issue at the
level of the packages is safer than by changing the source distribution.

- Xavier Leroy


Comment 7 David A. Wheeler 2008-07-31 02:56:43 UTC
In the meantime, package builds that use OCaml can modify their ELF files by
doing "execstack -c"; then the programs will run without an executable stack.


Comment 8 Richard W.M. Jones 2008-08-03 21:29:57 UTC
Upstream have actually added a part of my patch in (what
will become) OCaml 3.11.

Comment 9 Bug Zapper 2008-11-26 02:23:40 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 10 Bug Zapper 2009-11-18 12:32:59 UTC
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 11 Richard W.M. Jones 2009-11-18 13:09:32 UTC
Closing - this is upstream & in recent Fedora.


Note You need to log in before you can comment on or make changes to this bug.