[lfs-fr] r1404 - in trunk/hlfs: . chapter01 chapter06

jmengual at linuxfromscratch.org jmengual at linuxfromscratch.org
Sam 20 Aou 03:41:35 PDT 2011


Author: jmengual
Date: 2011-08-20 12:41:35 +0200 (Sat, 20 Aug 2011)
New Revision: 1404

Modified:
   trunk/hlfs/chapter01/changelog.xml
   trunk/hlfs/chapter06/gcc.xml
   trunk/hlfs/general.ent
Log:
Rajout d'un test a gcc.


Modified: trunk/hlfs/chapter01/changelog.xml
===================================================================
--- trunk/hlfs/chapter01/changelog.xml	2011-08-19 12:15:57 UTC (rev 1403)
+++ trunk/hlfs/chapter01/changelog.xml	2011-08-20 10:41:35 UTC (rev 1404)
@@ -39,6 +39,15 @@
 -->
  
     <listitem>
+      <para>20-08-2011</para>
+      <itemizedlist>
+        <listitem>
+          <para>[robert] - Ajout de deux tests de solidité au chapitre 6, gcc.</para>
+        </listitem>
+      </itemizedlist>
+    </listitem>
+ 
+    <listitem>
       <para>19-08-2011</para>
       <itemizedlist>
         <listitem>

Modified: trunk/hlfs/chapter06/gcc.xml
===================================================================
--- trunk/hlfs/chapter06/gcc.xml	2011-08-19 12:15:57 UTC (rev 1403)
+++ trunk/hlfs/chapter06/gcc.xml	2011-08-20 10:41:35 UTC (rev 1404)
@@ -315,6 +315,69 @@
     href="readjusting.xml"
     xpointer="xpointer(//*[@os='v'])"/>
 
+    <para>Vérifiez que <option>-D_FORTIFY_SOURCE=2</option> fonctionne :</para>
+
+<screen><userinput>cat > memcpy.c << "EOF"
+<literal>/* Issu de NetBSD usr/src/regress/lib/libc/ssp/memcpy/memcp.c */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+  char b[10];
+  int len = atoi(argv[1]);
+  (void)memcpy(b, "1020202020202", len);
+  (void)printf("%*.*s\n", len, len, b);
+  return 0;
+}</literal>
+EOF
+gcc -o memcpy memcpy.c -Wall -O2
+./memcpy 10
+./memcpy 11
+rm -v memcpy memcpy.c</userinput></screen>
+
+    <para>Ceci devrait donner les résultats suivants :</para>
+
+<screen><computeroutput># ./memcpy 10
+1020202020
+# ./memcpy 11
+*** buffer overflow detected ***: ./memcpy terminated
+...</computeroutput></screen>
+
+    <para>Vérifiez que <option>-fstack-protector-all</option> fonctionne :</para>
+
+    <screen><userinput>cat > ssptest.c << "EOF"
+ <literal>/* Issu de Ashish http://old.nabble.com/gcc--fstack-protector-all-option-to5867717.html */
+#include <stdio.h>
+#include <stdlib.h>
+
+void buffer_overflow ( )
+{
+  long int        i = 0;
+  char    str[29];
+  for ( i = 0; i < 50; i++){
+    str[i] = '\0';
+  }
+}
+int main ()
+{
+  buffer_overflow ( );
+  exit ( 0);
+} 
+</literal>
+EOF
+gcc -o ssptest ssptest.c -Wall
+./ssptest
+rm -v ssptest ssptest.c</userinput></screen>
+
+    <para>Ceci devrait donner les résultats suivants :</para>
+
+<screen><computeroutput># ./ssptest
+*** stack smashing detected ***: ./ssptest terminated
+...</computeroutput></screen>
+
   </sect2>
 
   <sect2 id="contents-gcc" role="content">

Modified: trunk/hlfs/general.ent
===================================================================
--- trunk/hlfs/general.ent	2011-08-19 12:15:57 UTC (rev 1403)
+++ trunk/hlfs/general.ent	2011-08-20 10:41:35 UTC (rev 1404)
@@ -1,5 +1,5 @@
-<!ENTITY version "SVN-20110818">
-<!ENTITY releasedate "18 août 2011">
+<!ENTITY version "SVN-20110820">
+<!ENTITY releasedate "20 août 2011">
 <!ENTITY copyrightdate "1999-2011"><!-- jhalfs needs a literal dash, not – -->
 <!ENTITY milestone "1.0">
 <!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" -->




More information about the lfs-traducfr mailing list