mass redigest and update

This commit is contained in:
Mario Fetka
2011-12-03 21:16:15 +01:00
parent c3958843c9
commit f598ca3564
46 changed files with 2871 additions and 38 deletions

View File

@@ -0,0 +1,14 @@
diff -Nru dietlibc-0.23.orig/include/dirent.h dietlibc-0.23/include/dirent.h
--- dietlibc-0.23.orig/include/dirent.h 2003-08-19 12:22:52.000000000 -0400
+++ dietlibc-0.23/include/dirent.h 2003-09-12 20:40:03.000000000 -0400
@@ -37,8 +37,8 @@
struct dirent *readdir (DIR *__dirp) __THROW;
struct dirent64 *readdir64 (DIR *__dirp) __THROW;
void rewinddir (DIR *__dirp) __THROW;
-void seekdir (DIR *__dirp, long int __pos) __THROW;
-long int telldir (DIR *__dirp) __THROW;
+void seekdir (DIR *__dirp, off_t __pos) __THROW;
+off_t telldir (DIR *__dirp) __THROW;
int scandir(const char *dir, struct dirent ***namelist,
int (*selection)(const struct dirent *),

View File

@@ -0,0 +1,54 @@
diff -Nrup dietlibc-0.26.orig/i386/start.S dietlibc-0.26/i386/start.S
--- dietlibc-0.26.orig/i386/start.S 2003-04-17 09:55:39.000000000 -0400
+++ dietlibc-0.26/i386/start.S 2004-08-07 18:50:52.000000000 -0400
@@ -50,7 +50,9 @@ _start:
PUT_VAR %edi, __vsyscall, %edx
1:
#endif
-
+#ifdef __dietlibc__
+ call __guard_setup
+#endif
#ifdef WANT_DYNAMIC
call _dyn_start
#else
diff -Nrup dietlibc-0.26.orig/sparc/start.S dietlibc-0.26/sparc/start.S
--- dietlibc-0.26.orig/sparc/start.S 2003-08-22 08:16:23.000000000 -0400
+++ dietlibc-0.26/sparc/start.S 2004-08-07 18:55:26.000000000 -0400
@@ -29,6 +29,9 @@ _start:
be NULL. */
/* Let libc do the rest of the initialization, and call main. */
+#if 0 /* FIXME: __dietlibc__ */
+ call __guard_setup
+#endif
#ifdef WANT_DYNAMIC
call dyn_start
#else
diff -Nrup dietlibc-0.26.orig/sparc64/start.S dietlibc-0.26/sparc64/start.S
--- dietlibc-0.26.orig/sparc64/start.S 2003-08-22 08:16:23.000000000 -0400
+++ dietlibc-0.26/sparc64/start.S 2004-08-07 18:55:36.000000000 -0400
@@ -29,6 +29,9 @@ _start:
be NULL. */
/* Let libc do the rest of the initialization, and call main. */
+#if 0 /* FIXME: __dietlibc__ */
+ call __guard_setup
+#endif
#ifdef WANT_DYNAMIC
call dyn_start
#else
diff -Nrup dietlibc-0.26.orig/x86_64/start.S dietlibc-0.26/x86_64/start.S
--- dietlibc-0.26.orig/x86_64/start.S 2003-02-05 09:29:19.000000000 -0500
+++ dietlibc-0.26/x86_64/start.S 2004-08-07 18:52:39.000000000 -0400
@@ -35,6 +35,10 @@ _start:
popq %rdi
#endif
+#if 0 /* FIXME: __dietlibc__ */
+ call __guard_setup
+#endif
+
#ifdef WANT_DYNAMIC
call _dyn_start
#else

View File

@@ -0,0 +1,28 @@
--- Makefile
+++ Makefile
@@ -1,5 +1,5 @@
INSTALL=install
-prefix?=/opt/diet
+prefix=/usr/diet
# Set the following to install to a different root
#DESTDIR=/tmp/fefix
# Use "make DEBUG=1" to compile a debug version.
@@ -95,7 +95,6 @@
profiling: $(OBJDIR)/libgmon.a $(OBJDIR)/pstart.o
-CFLAGS=-pipe -nostdinc
CROSS=
CC=gcc
@@ -126,10 +125,6 @@
LIBMATHOBJ=$(patsubst %,$(OBJDIR)/%,$(LIBMATH))
-ifeq ($(CFLAGS),-pipe -nostdinc)
-CFLAGS+=-O -fomit-frame-pointer
-endif
-
ifneq ($(DEBUG),)
CFLAGS = -g
COMMENT = :

View File

@@ -0,0 +1,11 @@
--- Makefile.orig 2004-03-25 08:24:20.420425000 -0700
+++ Makefile 2004-03-25 08:27:02.730425000 -0700
@@ -8,7 +8,7 @@
BINDIR=${prefix}/bin
MAN1DIR=${prefix}/man/man1
-MYARCH:=$(shell uname -m | sed -e 's/i[4-9]86/i386/' -e 's/armv[3-6][lb]/arm/')
+MYARCH:=$(shell uname -m | sed -e 's/i[4-9]86/i386/' -e 's/armv[3-6][lb]/arm/' -e 's/sparc64/sparc/')
# This extra-ugly cruft is here so make will not run uname and sed each
# time it looks at $(OBJDIR). This alone sped up running make when

View File

@@ -0,0 +1,16 @@
--- diet.c
+++ diet.c
@@ -26,8 +26,13 @@
static const char* Os[] = {
"i386","-Os","-mpreferred-stack-boundary=2",
+#if __GNUC__ >= 3
+ "-falign-functions=1","-falign-jumps=1",
+ "-falign-loops=1","-fomit-frame-pointer",0,
+#else
"-malign-functions=1","-malign-jumps=1",
"-malign-loops=1","-fomit-frame-pointer",0,
+#endif
"x86_64","-Os","-fno-omit-frame-pointer",0,
"sparc","-Os","-mcpu=supersparc",0,
"sparc64","-Os","-m64",0,

View File

@@ -0,0 +1,129 @@
/*
* Distributed under the terms of the GNU General Public License v2
* $Header: /var/cvsroot/gentoo-x86/dev-libs/dietlibc/files/ssp.c,v 1.2 2004/12/05 19:25:40 solar Exp $
*
* This is a modified version of Hiroaki Etoh's stack smashing routines
* implemented for glibc.
*
* The following people have contributed input to this code.
* Ned Ludd - <solar[@]gentoo.org>
* Alexander Gabert - <pappy[@]gentoo.org>
* The PaX Team - <pageexec[@]freemail.hu>
* Peter S. Mazinger - <ps.m[@]gmx.net>
* Yoann Vandoorselaere - <yoann[@]prelude-ids.org>
* Robert Connolly - <robert[@]linuxfromscratch.org>
* Cory Visi <cory@visi.name>
*
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/time.h>
#ifdef __PROPOLICE_BLOCK_SEGV__
#define SSP_SIGTYPE SIGSEGV
#elif __PROPOLICE_BLOCK_KILL__
#define SSP_SIGTYPE SIGKILL
#else
#define SSP_SIGTYPE SIGABRT
#endif
unsigned long __guard = 0UL;
void
__guard_setup (void)
{
size_t size;
if (__guard != 0UL)
return;
#ifndef __SSP_QUICK_CANARY__
/*
* Attempt to open kernel pseudo random device if one exists before
* opening urandom to avoid system entropy depletion.
*/
{
int fd;
#ifdef HAVE_DEV_ERANDOM
if ((fd = open ("/dev/erandom", O_RDONLY)) == (-1))
#endif
fd = open ("/dev/urandom", O_RDONLY);
if (fd != (-1))
{
size = read (fd, (char *) &__guard, sizeof (__guard));
close (fd);
if (size == sizeof (__guard))
return;
}
}
#endif
/* If sysctl was unsuccessful, use the "terminator canary". */
__guard = 0xFF0A0D00UL;
{
/* Everything failed? Or we are using a weakened model of the
* terminator canary */
struct timeval tv;
gettimeofday (&tv, NULL);
__guard ^= tv.tv_usec ^ tv.tv_sec;
}
}
void
__stack_smash_handler (char func[], int damaged)
{
struct sigaction sa;
const char message[] = ": stack smashing attack in function ";
int bufsz, len;
char buf[512];
static char *__progname = "dietapp";
sigset_t mask;
sigfillset (&mask);
sigdelset (&mask, SSP_SIGTYPE); /* Block all signal handlers */
sigprocmask (SIG_BLOCK, &mask, NULL); /* except SIGABRT */
bufsz = sizeof (buf);
strcpy (buf, "<2>");
len = 3;
strncat (buf, __progname, sizeof (buf) - 4);
len = strlen (buf);
if (bufsz > len)
{
strncat (buf, message, bufsz - len - 1);
len = strlen (buf);
}
if (bufsz > len)
{
strncat (buf, func, bufsz - len - 1);
len = strlen (buf);
}
/* print error message */
write (STDERR_FILENO, buf + 3, len - 3);
write (STDERR_FILENO, "()\n", 3);
/* Make sure the default handler is associated with the our signal handler */
memset (&sa, 0, sizeof (struct sigaction));
sigfillset (&sa.sa_mask); /* Block all signals */
sa.sa_flags = 0;
sa.sa_handler = SIG_DFL;
sigaction (SSP_SIGTYPE, &sa, NULL);
(void) kill (getpid (), SSP_SIGTYPE);
_exit (127);
}