<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>177390</bug_id>
          
          <creation_ts>2007-05-07 00:01 0000</creation_ts>
          <short_desc>app-emulation/e-uae crashed with hardened-sources.</short_desc>
          <delta_ts>2007-05-09 20:55:57 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Hardened</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>yaroslav.isakov@gmail.com</reporter>
          <assigned_to>dholm@gentoo.org</assigned_to>
          <cc>hardened@gentoo.org</cc>
    
    <cc>pva@gentoo.org</cc>

      

      
          <long_desc isprivate="0">
            <who>yaroslav.isakov@gmail.com</who>
            <bug_when>2007-05-07 00:01:35 0000</bug_when>
            <thetext>Hello, I found that app-emulation/e-uae need &quot;pax-mark m e-uae&quot; with hardened-sources, because of this:

PAX: execution attempt in: &lt;anonymous mapping&gt;, 08357000-0aa23000 08357000
PAX: terminating task: /usr/bin/e-uae(e-uae):30268, uid/euid: 1000/1000, PC: 0aa08000, SP: 5b25079c
PAX: bytes at PC: 50 51 52 53 8b 05 90 cd 44 08 0f a2 89 05 8c cd 44 08 89 1d
PAX: bytes at SP-4: 0a3071d0 08245858 00000000 00000000 00000000 00000000 0a3071d4 0a3071d8 0a3071d0 0a3071d0 0a3071d0 0833fb4d 00000001 08245954 0a3071d8 0a3071d4 00000000 00000000 00000000 00000000 00000000

My emerge --info is in bug #177387</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>kevquinn@gentoo.org</who>
            <bug_when>2007-05-07 10:19:01 0000</bug_when>
            <thetext>David, Peter - this just needs a simple call to pax-mark as suggested by Yaroslav.

----
inherit ... pax-utils

...
src_install() {
    pax-mark m ${D}/usr/bin/uae
    ...
}
----

should do the trick.  I don&apos;t have Amiga images so I haven&apos;t tried it myself, but I fully expect that to work; it&apos;s normal for emulators to do just-in-time compilation for example, which would need the mprotect() restriction relaxed.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>pva@gentoo.org</who>
            <bug_when>2007-05-07 13:05:05 0000</bug_when>
            <thetext>Kevin, I do not have hardened sources to test. Could you commit it by yourself?

Of course, if you wish, I can commit and you test but I think it&apos;s much easier to fix and test in one place... :)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>kevquinn@gentoo.org</who>
            <bug_when>2007-05-07 16:23:09 0000</bug_when>
            <thetext>ok; done, although I don&apos;t have kick.rom to try properly.
Yaroslav, give it half an hour, then please sync up and check for us.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>yaroslav.isakov@gmail.com</who>
            <bug_when>2007-05-07 21:35:30 0000</bug_when>
            <thetext>Thanks, it works. BTW, does it really need trampolines emulation (I see --mxE- in output of scanelf)?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>pva@gentoo.org</who>
            <bug_when>2007-05-08 08:47:54 0000</bug_when>
            <thetext>May be not, but as far as I understood it&apos;s how code works now.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>yaroslav.isakov@gmail.com</who>
            <bug_when>2007-05-08 21:20:28 0000</bug_when>
            <thetext>It&apos;s probably from binutils which set flags based on some (unclean for me) reasons. Maybe it&apos;s wrong? I paxctl -e e-uae and it&apos;s works as usual...</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>kevquinn@gentoo.org</who>
            <bug_when>2007-05-08 21:25:09 0000</bug_when>
            <thetext>The upstream build explicitly sets &apos;-Wa,execstack&apos; everywhere, which is why it ends up with the execstack marking.  Whether that&apos;s because upstream believe it enables executable heap or not, I don&apos;t know (it certainly doesn&apos;t for us).  Some systems don&apos;t differentiate between executable stack and executable heap; although for the pure threat model there&apos;s no difference

The software doesn&apos;t contain any trampolines, so it&apos;s safe to reset to -e (adding &apos;-Wtrampolines&apos; to CFLAGS will show this; grep the build log for &quot;generating trampoline&quot; - comment out the &apos;strip-flags&apos; in the ebuild to see it in action, otherwise it&apos;ll be stripped out).</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>kevquinn@gentoo.org</who>
            <bug_when>2007-05-08 21:26:44 0000</bug_when>
            <thetext>Ahem - didn&apos;t finish the sentence:

...although for the pure threat model there&apos;s no difference, in practice forbidding executable stack while allowing executable heap does raise a barrier to stack overflow exploits.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>yaroslav.isakov@gmail.com</who>
            <bug_when>2007-05-08 21:51:40 0000</bug_when>
            <thetext>Yes, you&apos;re right. So, maybe &quot;pax-mark me e-uae&quot;?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>kevquinn@gentoo.org</who>
            <bug_when>2007-05-09 20:14:00 0000</bug_when>
            <thetext>I had a further thought - it may be that it needs the -Wa,execstack for systems using RedHat&apos;s execshield, like RHEL (execshield is a sort of poor-man&apos;s PaX, in our view - although RedHat obviously disagree with us!).  Resetting -E to -e won&apos;t affect execshield (which uses the PT_GNU_STACK header, that we leave alone), so I&apos;ll tweak it accordingly.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>yaroslav.isakov@gmail.com</who>
            <bug_when>2007-05-09 20:55:57 0000</bug_when>
            <thetext>Thanks
</thetext>
          </long_desc>
      
    </bug>

</bugzilla>