This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Allow %n in -D_FORTIFY_SOURCE=2 linux programs if /proc is not mounted


Hi!

If /proc is not mounted, it is IMHO better to be less protected than
fail on legitimate %n uses.

2004-10-20  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/readonly-area.c (__readonly_area): If /proc
	is not mounted, return 1.

--- libc/sysdeps/unix/sysv/linux/readonly-area.c.jj	2004-10-18 06:17:11.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/readonly-area.c	2004-10-20 12:03:41.082904624 +0200
@@ -33,7 +33,10 @@ __readonly_area (const char *ptr, size_t
 
   FILE *fp = fopen ("/proc/self/maps", "rc");
   if (fp == NULL)
-    return -1;
+    /* We don't know.  Returning 1 here means that programs using %n
+       and -D_FORTIFY_SOURCE=2 will work even when /proc is not mounted,
+       but will allow %n even in writable areas.  */
+    return 1;
 
   /* We need no locking.  */
   __fsetlocking (fp, FSETLOCKING_BYCALLER);

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]