Bug 450551 - OCaml binaries give rpmlint warning about executable-stack
OCaml binaries give rpmlint warning about executable-stack
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: ocaml (Show other bugs)
10
All Linux
low Severity low
: ---
: ---
Assigned To: Richard W.M. Jones
Fedora Extras Quality Assurance
:
Depends On:
Blocks: 444428
  Show dependency treegraph
 
Reported: 2008-06-09 11:26 EDT by Richard W.M. Jones
Modified: 2009-11-18 08:09 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-11-18 08:09:32 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Richard W.M. Jones 2008-06-09 11:26:01 EDT
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 11:46:47 EDT
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 13:36:36 EDT
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 13:46:34 EDT
OK, verified this fixes the warning in 3.10.2 as well.
Comment 4 Richard W.M. Jones 2008-06-09 13:51:42 EDT
Submitted upstream:
http://caml.inria.fr/mantis/view.php?id=4564
Comment 5 Richard W.M. Jones 2008-06-09 14:44:06 EDT
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 17:16:26 EDT
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-30 22:56:43 EDT
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 17:29:57 EDT
Upstream have actually added a part of my patch in (what
will become) OCaml 3.11.
Comment 9 Bug Zapper 2008-11-25 21:23:40 EST
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 07:32:59 EST
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 08:09:32 EST
Closing - this is upstream & in recent Fedora.

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