ia64/xen-unstable

changeset 19481:f6fd1c2e4da6

stubdom: Add newlib-chk.patch

From: "George S. Coker, II" <gscoker@alpha.ncsc.mil>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 31 18:37:58 2009 +0100 (2009-03-31)
parents d669f5d1f876
children dbc4014882d0
files stubdom/newlib-chk.patch
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/stubdom/newlib-chk.patch	Tue Mar 31 18:37:58 2009 +0100
     1.3 @@ -0,0 +1,159 @@
     1.4 +diff -Naur newlib-1.16.0/newlib/libc/stdio/fprintf_chk.c newlib-1.16.0/newlib/libc/stdio/fprintf_chk.c
     1.5 +--- newlib-1.16.0/newlib/libc/stdio/fprintf_chk.c	1969-12-31 19:00:00.000000000 -0500
     1.6 ++++ newlib-1.16.0/newlib/libc/stdio/fprintf_chk.c	2009-02-26 19:02:53.000000000 -0500
     1.7 +@@ -0,0 +1,21 @@
     1.8 ++#include <stdarg.h>
     1.9 ++#include <stdio.h>
    1.10 ++
    1.11 ++/*
    1.12 ++ * Stub implementation of __fprintf_chk adapted from glibc 2.7.  This 
    1.13 ++ * doesn't actually implement any buffer overflow protection.  It just makes
    1.14 ++ * the linker happy :)
    1.15 ++*/
    1.16 ++int
    1.17 ++__fprintf_chk (FILE *fp, int flag, const char *format, ...)
    1.18 ++{
    1.19 ++  va_list ap;
    1.20 ++  int done;
    1.21 ++
    1.22 ++  va_start (ap, format);
    1.23 ++  done = vfprintf (fp, format, ap);
    1.24 ++  va_end (ap);
    1.25 ++
    1.26 ++  return done;
    1.27 ++}
    1.28 ++
    1.29 +diff -Naur newlib-1.16.0/newlib/libc/stdio/Makefile.am newlib-1.16.0/newlib/libc/stdio/Makefile.am
    1.30 +--- ./newlib-1.16.0/newlib/libc/stdio/Makefile.am	2007-08-02 16:23:06.000000000 -0400
    1.31 ++++ ./newlib-1.16.0/newlib/libc/stdio/Makefile.am	2009-02-26 18:14:53.000000000 -0500
    1.32 +@@ -20,6 +20,7 @@
    1.33 + 	flags.c			\
    1.34 + 	fopen.c			\
    1.35 + 	fprintf.c			\
    1.36 ++	fprintf_chk.c		\
    1.37 + 	fputc.c			\
    1.38 + 	fputs.c			\
    1.39 + 	fread.c			\
    1.40 +@@ -65,6 +66,7 @@
    1.41 + 	sniprintf.c			\
    1.42 + 	snprintf.c			\
    1.43 + 	sprintf.c			\
    1.44 ++	sprintf_chk.c			\
    1.45 + 	sscanf.c			\
    1.46 + 	stdio.c			\
    1.47 + 	tmpfile.c			\
    1.48 +diff -Naur newlib-1.16.0/newlib/libc/stdio/Makefile.in newlib-1.16.0/newlib/libc/stdio/Makefile.in
    1.49 +--- newlib-1.16.0/newlib/libc/stdio/Makefile.in	2007-12-19 17:36:38.000000000 -0500
    1.50 ++++ newlib-1.16.0/newlib/libc/stdio/Makefile.in	2009-02-26 18:43:52.000000000 -0500
    1.51 +@@ -63,7 +63,8 @@
    1.52 + 	lib_a-fgets.$(OBJEXT) lib_a-fileno.$(OBJEXT) \
    1.53 + 	lib_a-findfp.$(OBJEXT) lib_a-fiprintf.$(OBJEXT) \
    1.54 + 	lib_a-flags.$(OBJEXT) lib_a-fopen.$(OBJEXT) \
    1.55 +-	lib_a-fprintf.$(OBJEXT) lib_a-fputc.$(OBJEXT) \
    1.56 ++	lib_a-fprintf.$(OBJEXT) lib_a-fprintf_chk.$(OBJEXT) \
    1.57 ++	lib_a-fputc.$(OBJEXT) \
    1.58 + 	lib_a-fputs.$(OBJEXT) lib_a-fread.$(OBJEXT) \
    1.59 + 	lib_a-freopen.$(OBJEXT) lib_a-fscanf.$(OBJEXT) \
    1.60 + 	lib_a-fiscanf.$(OBJEXT) lib_a-fseek.$(OBJEXT) \
    1.61 +@@ -86,6 +87,7 @@
    1.62 + 	lib_a-setvbuf.$(OBJEXT) lib_a-siprintf.$(OBJEXT) \
    1.63 + 	lib_a-siscanf.$(OBJEXT) lib_a-sniprintf.$(OBJEXT) \
    1.64 + 	lib_a-snprintf.$(OBJEXT) lib_a-sprintf.$(OBJEXT) \
    1.65 ++	lib_a-sprintf_chk.$(OBJEXT) \
    1.66 + 	lib_a-sscanf.$(OBJEXT) lib_a-stdio.$(OBJEXT) \
    1.67 + 	lib_a-tmpfile.$(OBJEXT) lib_a-tmpnam.$(OBJEXT) \
    1.68 + 	lib_a-ungetc.$(OBJEXT) lib_a-vdiprintf.$(OBJEXT) \
    1.69 +@@ -122,15 +124,15 @@
    1.70 + LTLIBRARIES = $(noinst_LTLIBRARIES)
    1.71 + am__objects_4 = clearerr.lo fclose.lo fdopen.lo feof.lo ferror.lo \
    1.72 + 	fflush.lo fgetc.lo fgetpos.lo fgets.lo fileno.lo findfp.lo \
    1.73 +-	fiprintf.lo flags.lo fopen.lo fprintf.lo fputc.lo fputs.lo \
    1.74 +-	fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \
    1.75 ++	fiprintf.lo flags.lo fopen.lo fprintf.lo fprintf_chk.lo fputc.lo \
    1.76 ++	fputs.lo fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \
    1.77 + 	ftell.lo fvwrite.lo fwalk.lo fwrite.lo getc.lo getchar.lo \
    1.78 + 	getc_u.lo getchar_u.lo getdelim.lo getline.lo gets.lo \
    1.79 + 	iprintf.lo iscanf.lo makebuf.lo perror.lo printf.lo putc.lo \
    1.80 + 	putchar.lo putc_u.lo putchar_u.lo puts.lo refill.lo remove.lo \
    1.81 + 	rename.lo rewind.lo rget.lo scanf.lo sccl.lo setbuf.lo \
    1.82 + 	setbuffer.lo setlinebuf.lo setvbuf.lo siprintf.lo siscanf.lo \
    1.83 +-	sniprintf.lo snprintf.lo sprintf.lo sscanf.lo stdio.lo \
    1.84 ++	sniprintf.lo snprintf.lo sprintf.lo sprintf_chk.lo sscanf.lo stdio.lo \
    1.85 + 	tmpfile.lo tmpnam.lo ungetc.lo vdiprintf.lo vdprintf.lo \
    1.86 + 	viprintf.lo viscanf.lo vprintf.lo vscanf.lo vsiprintf.lo \
    1.87 + 	vsiscanf.lo vsnprintf.lo vsniprintf.lo vsprintf.lo vsscanf.lo \
    1.88 +@@ -344,6 +346,7 @@
    1.89 + 	flags.c			\
    1.90 + 	fopen.c			\
    1.91 + 	fprintf.c			\
    1.92 ++	fprintf_chk.c			\
    1.93 + 	fputc.c			\
    1.94 + 	fputs.c			\
    1.95 + 	fread.c			\
    1.96 +@@ -389,6 +392,7 @@
    1.97 + 	sniprintf.c			\
    1.98 + 	snprintf.c			\
    1.99 + 	sprintf.c			\
   1.100 ++	sprintf_chk.c			\
   1.101 + 	sscanf.c			\
   1.102 + 	stdio.c			\
   1.103 + 	tmpfile.c			\
   1.104 +@@ -508,6 +512,7 @@
   1.105 + 	siprintf.def		\
   1.106 + 	siscanf.def		\
   1.107 + 	sprintf.def		\
   1.108 ++	sprintf_chk.def		\
   1.109 + 	sscanf.def		\
   1.110 + 	tmpfile.def		\
   1.111 + 	tmpnam.def		\
   1.112 +@@ -678,6 +683,12 @@
   1.113 + lib_a-fprintf.obj: fprintf.c
   1.114 + 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf.obj `if test -f 'fprintf.c'; then $(CYGPATH_W) 'fprintf.c'; else $(CYGPATH_W) '$(srcdir)/fprintf.c'; fi`
   1.115 + 
   1.116 ++lib_a-fprintf_chk.o: fprintf_chk.c
   1.117 ++	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.o `test -f 'fprintf_chk.c' || echo '$(srcdir)/'`fprintf_chk.c
   1.118 ++
   1.119 ++lib_a-fprintf_chk.obj: fprintf_chk.c
   1.120 ++	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.obj `if test -f 'fprintf_chk.c'; then $(CYGPATH_W) 'fprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/fprintf_chk.c'; fi`
   1.121 ++
   1.122 + lib_a-fputc.o: fputc.c
   1.123 + 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fputc.o `test -f 'fputc.c' || echo '$(srcdir)/'`fputc.c
   1.124 + 
   1.125 +@@ -948,6 +959,12 @@
   1.126 + lib_a-sprintf.obj: sprintf.c
   1.127 + 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf.obj `if test -f 'sprintf.c'; then $(CYGPATH_W) 'sprintf.c'; else $(CYGPATH_W) '$(srcdir)/sprintf.c'; fi`
   1.128 + 
   1.129 ++lib_a-sprintf_chk.o: sprintf_chk.c
   1.130 ++	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.o `test -f 'sprintf_chk.c' || echo '$(srcdir)/'`sprintf_chk.c
   1.131 ++
   1.132 ++lib_a-sprintf_chk.obj: sprintf_chk.c
   1.133 ++	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.obj `if test -f 'sprintf_chk.c'; then $(CYGPATH_W) 'sprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/sprintf_chk.c'; fi`
   1.134 ++
   1.135 + lib_a-sscanf.o: sscanf.c
   1.136 + 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sscanf.o `test -f 'sscanf.c' || echo '$(srcdir)/'`sscanf.c
   1.137 + 
   1.138 +diff -Naur ./newlib-1.16.0/newlib/libc/stdio/sprintf_chk.c ../newlib-1.16.0/newlib/libc/stdio/sprintf_chk.c
   1.139 +--- newlib-1.16.0/newlib/libc/stdio/sprintf_chk.c	1969-12-31 19:00:00.000000000 -0500
   1.140 ++++ newlib-1.16.0/newlib/libc/stdio/sprintf_chk.c	2009-02-26 19:02:26.000000000 -0500
   1.141 +@@ -0,0 +1,21 @@
   1.142 ++#include <stdarg.h>
   1.143 ++#include <stdio.h>
   1.144 ++
   1.145 ++/*
   1.146 ++ * Stub implementation of __sprintf_chk adapted from glibc 2.7.  This 
   1.147 ++ * doesn't actually implement any buffer overflow protection.  It just makes
   1.148 ++ * the linker happy :)
   1.149 ++*/
   1.150 ++int
   1.151 ++__sprintf_chk (char *s, int flags, size_t slen, const char *format, ...)
   1.152 ++{
   1.153 ++  va_list arg;
   1.154 ++  int done;
   1.155 ++
   1.156 ++  va_start (arg, format);
   1.157 ++  done = vsprintf (s, format, arg);
   1.158 ++  va_end (arg);
   1.159 ++
   1.160 ++  return done;
   1.161 ++}
   1.162 ++