View | Details | Raw Unified
Collapse All | Expand All

(-) dietlibc-0.27.ebuild (-3 / +9 lines)
 Lines 32-50   src_unpack() { Link Here 
	# ${FILESDIR}/ssp.c is integrated with upstream as of dietlibc-0.26
	# ${FILESDIR}/ssp.c is integrated with upstream as of dietlibc-0.26
	# - robbat2 (Oct 01 2004)
	# - robbat2 (Oct 01 2004)
	# Ok so let's make dietlibc ssp aware (Aug 7 2004) -solar
	# ${FILESDIR}/ssp.c does not appear to be integrated with
	# upstream as of dietlibc-0.27 bug 73112 - solar (Dec 05 2004)
	cp ${FILESDIR}/ssp.c ${S}/lib/ || die "Failed to copy ssp.c into lib for compile"
	# start with sparc/sparc64/x86_64/i386 for now.
	# start with sparc/sparc64/x86_64/i386 for now.
	# apply to all arches for crazy cross-compiling - robbat2 (Oct 01 2004)
	# apply to all arches for crazy cross-compiling - robbat2 (Oct 01 2004)
	epatch ${FILESDIR}/dietlibc-0.26-ssp.patch
	epatch ${FILESDIR}/dietlibc-0.26-ssp.patch
	append-flags -D__dietlibc__
	# end ssp block code
	# Fix for 45716
	# Fix for 45716
	replace-sparc64-flags
	replace-sparc64-flags
	# be very careful to only effect the CFLAGS used for optimization
	# be very careful to only effect the CFLAGS used for optimization
	# and not any of the other CFLAGS. - robbat2 (Oct 01 2004)
	# and not any of the other CFLAGS. - robbat2 (Oct 01 2004)
	# Shifted ssp exclusion logic into sed expression. - solar (Dec 05 2004)
	sed -i \
	sed -i \
		-e "s:^CFLAGS+=-O -fomit-frame-pointer:CFLAGS += ${CFLAGS}:" \
		-e "s:^CFLAGS+=-O -fomit-frame-pointer:CFLAGS += ${CFLAGS} -D__dietlibc__:" \
		-e "s:^CFLAGS=-pipe -nostdinc:CFLAGS=-pipe -nostdinc -D__dietlibc__ -fno-stack-protector-all -fno-stack-protector:" \
		-e "s:^prefix.*:prefix=/usr/diet:" \
		-e "s:^prefix.*:prefix=/usr/diet:" \
		Makefile \
		Makefile \
		|| die "sed Makefile failed"
		|| die "sed Makefile failed"
(-) files/ssp.c (-38 / +1 lines)
 Lines 28-40    Link Here 
#include <sys/types.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/un.h>
#include <sys/syslog.h>
#include <sys/time.h>
#include <sys/time.h>
#include <sys/sysctl.h>
#ifndef _PATH_LOG
#define _PATH_LOG "/dev/log"
#endif
#ifdef __PROPOLICE_BLOCK_SEGV__
#ifdef __PROPOLICE_BLOCK_SEGV__
#define SSP_SIGTYPE SIGSEGV
#define SSP_SIGTYPE SIGSEGV
 Lines 50-74   void Link Here 
__guard_setup (void)
__guard_setup (void)
{
{
  size_t size;
  size_t size;
#ifdef HAVE_DEV_ERANDOM
  int mib[3];
#endif
  if (__guard != 0UL)
  if (__guard != 0UL)
    return;
    return;
#ifndef __SSP_QUICK_CANARY__
#ifndef __SSP_QUICK_CANARY__
#ifdef HAVE_DEV_ERANDOM
  /* Random is another depth in Linux, hence an array of 3. */
  mib[0] = CTL_KERN;
  mib[1] = KERN_RANDOM;
  mib[2] = RANDOM_ERANDOM;
  size = sizeof (unsigned long);
  if (__sysctl (mib, 3, &__guard, &size, NULL, 0) != (-1))
    if (__guard != 0UL)
      return;
#endif
  /* 
  /* 
   * Attempt to open kernel pseudo random device if one exists before 
   * Attempt to open kernel pseudo random device if one exists before 
   * opening urandom to avoid system entropy depletion.
   * opening urandom to avoid system entropy depletion.
 Lines 109-121   __stack_smash_handler (char func[], int Link Here 
  const char message[] = ": stack smashing attack in function ";
  const char message[] = ": stack smashing attack in function ";
  int bufsz, len;
  int bufsz, len;
  char buf[512];
  char buf[512];
#ifndef __dietlibc__
  struct sockaddr_un sock;	/* AF_UNIX address of local logger */
  int log;
  extern char *__progname;
#else
  static char *__progname = "dietapp";
  static char *__progname = "dietapp";
#endif
  sigset_t mask;
  sigset_t mask;
  sigfillset (&mask);
  sigfillset (&mask);
 Lines 144-161   __stack_smash_handler (char func[], int Link Here 
  /* print error message */
  /* print error message */
  write (STDERR_FILENO, buf + 3, len - 3);
  write (STDERR_FILENO, buf + 3, len - 3);
  write (STDERR_FILENO, "()\n", 3);
  write (STDERR_FILENO, "()\n", 3);
#ifndef __dietlibc__
  if ((log = socket (AF_UNIX, SOCK_DGRAM, 0)) != -1)
    {
      /* Send "found" message to the "/dev/log" path */
      sock.sun_family = AF_UNIX;
      (void) strncpy (sock.sun_path, _PATH_LOG, sizeof (sock.sun_path) - 1);
      sock.sun_path[sizeof (sock.sun_path) - 1] = '\0';
      sendto (log, buf, len, 0, (struct sockaddr *) &sock, sizeof (sock));
    }
#endif
  /* Make sure the default handler is associated with the our signal handler */
  /* Make sure the default handler is associated with the our signal handler */
  memset (&sa, 0, sizeof (struct sigaction));
  memset (&sa, 0, sizeof (struct sigaction));
  sigfillset (&sa.sa_mask);	/* Block all signals */
  sigfillset (&sa.sa_mask);	/* Block all signals */
  sa.sa_flags = 0;
  sa.sa_flags = 0;