<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://webfault.org/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>Michael VERGOZ - Tag - SSP</title>
  <link>http://webfault.org/</link>
  <atom:link href="http://www.webfault.org/feed/tag/SSP/rss2" rel="self" type="application/rss+xml"/>
  <description></description>
  <language>fr</language>
  <pubDate>Mon, 09 May 2011 11:04:41 +0100</pubDate>
  <copyright>Copyright 2007 - Michael Vergoz</copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>Compiler Apache sans SSP</title>
    <link>http://webfault.org/post/2007/09/16/Compiler-Apache-sans-SSP</link>
    <guid isPermaLink="false">urn:md5:d5479b129953074cc9daa2091c1dcb57</guid>
    <pubDate>Sun, 16 Sep 2007 10:44:00 +0000</pubDate>
    <dc:creator>Michael Vergoz</dc:creator>
        <category>Portage / Cross dev</category>
        <category>Apache</category><category>APR</category><category>SSP</category>    
    <description>    &lt;p&gt;Un autre petit tip pour compiler &lt;a href=&quot;http://webfault.org/index.php?tag/Apache&quot;&gt;Apache&lt;/a&gt; 1.3 sans &lt;a href=&quot;http://webfault.org/index.php?tag/SSP&quot;&gt;SSP&lt;/a&gt;.&lt;/p&gt;

&lt;pre&gt;
$ ./configure --prefix=/je/sais/pas --exec-prefix=/je/sais/pas --enable-module=so
$ make CC=&amp;quot;gcc -fno-stack-protector -DEAPI&amp;quot; LD=&amp;quot;ld -fno-stack-protector&amp;quot;
$ readelf -a src/httpd | grep stack_chk
&lt;/pre&gt;


&lt;p&gt;Et voila plus de &lt;a href=&quot;http://webfault.org/index.php?tag/SSP&quot;&gt;SSP&lt;/a&gt; dans &lt;a href=&quot;http://webfault.org/index.php?tag/Apache&quot;&gt;Apache&lt;/a&gt; :)&lt;/p&gt;


&lt;p&gt;Pour &lt;a href=&quot;http://webfault.org/index.php?tag/Apache&quot;&gt;Apache&lt;/a&gt; &amp;gt; 2.0 et pour &lt;a href=&quot;http://webfault.org/index.php?tag/APR&quot;&gt;APR&lt;/a&gt; il ne faut pas utiliser CC et LD mais CFLAGS, et LDFLAGS.
En fait à l'époque Apache 1.3 ne gérait pas ces deux dernières variables.&lt;/p&gt;

&lt;pre&gt;
$ make CFLAGS='-fno-stack-protector' LDFLAGS='-fno-stack-protector'
&lt;/pre&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>GCC et le SSP</title>
    <link>http://webfault.org/post/2007/09/14/Test</link>
    <guid isPermaLink="false">urn:md5:78d3cfc1b8c8d4dc043046f56f6056b6</guid>
    <pubDate>Fri, 14 Sep 2007 15:48:00 +0000</pubDate>
    <dc:creator>Michael Vergoz</dc:creator>
        <category>Portage / Cross dev</category>
        <category>GCC</category><category>glibc</category><category>SSP</category>    
    <description>    &lt;p&gt;Depuis la version 2.4 de la &lt;a href=&quot;http://webfault.org/index.php?tag/glibc&quot;&gt;glibc&lt;/a&gt; des symboles de controle ( comme __stack_chk_fail ) sont intégrés par defaut dans tous les binaires compilés.
C'est le &lt;a href=&quot;http://webfault.org/index.php?tag/SSP&quot;&gt;SSP&lt;/a&gt; dans &lt;a href=&quot;http://webfault.org/index.php?tag/GCC&quot;&gt;GCC&lt;/a&gt; qui est responsable de cette action et il est possible de désactiver ce &lt;a href=&quot;http://webfault.org/index.php?tag/SSP&quot;&gt;SSP&lt;/a&gt; avec l'option &lt;strong&gt;-fno-stack-protector&lt;/strong&gt;.&lt;/p&gt;


&lt;p&gt;Un petit code C comme exemple&amp;nbsp;:&lt;/p&gt;
&lt;pre&gt;[c]
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;pthread.h&amp;gt;

int main() {
        pthread_mutex_t fastmutex = PTHREAD_MUTEX_INITIALIZER;
        pthread_mutex_lock(&amp;amp;fastmutex);
        printf(&amp;quot;Tst\n&amp;quot;);
        pthread_mutex_unlock(&amp;amp;fastmutex);
}
&lt;/pre&gt;


&lt;p&gt;Ensuite on teste&amp;nbsp;:&lt;/p&gt;
&lt;pre&gt;
none@zef:~# gcc -O2 -o test.bin test.c
none@zef:~# readelf -a test.bin | grep _stack_
080496c8  00000507 R_386_JUMP_SLOT   00000000   __stack_chk_fail
     5: 00000000    70 FUNC    GLOBAL DEFAULT  UND __stack_chk_fail@GLIBC_2.4 (3)
    75: 00000000    70 FUNC    GLOBAL DEFAULT  UND __stack_chk_fail@@GLIBC_2
none@zef:~# gcc -O2 -fno-stack-protector -o test.bin test.c
none@zef:~# readelf -a test.bin | grep _stack_
none@zef:~# 
&lt;/pre&gt;


&lt;p&gt;Ca rend de fait portable le binaire pour des glibc &amp;gt; 2.3 :)&lt;/p&gt;

&lt;pre&gt;
none@zef:~# file /lib/libc-2.5.so
/lib/libc-2.5.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.0, stripped
none@zef:~# gcc -O2 -o test.bin test.c
none@zef:~# readelf -a test.bin | grep -i GLIBC_2.4
     5: 00000000    70 FUNC    GLOBAL DEFAULT  UND __stack_chk_fail@GLIBC_2.4 (3)
  004:   2 (GLIBC_2.0)     3 (GLIBC_2.4)     2 (GLIBC_2.0)     1 (*global*)
  0x0010:   Name: GLIBC_2.4  Flags: none  Version: 3
none@zef:~# gcc -O2 -fno-stack-protector -o test.bin test.c
none@zef:~# readelf -a test.bin | grep -i GLIBC_2.4
none@zef:~#
&lt;/pre&gt;</description>
    
    
    
      </item>
    
</channel>
</rss>
