From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- .../files/prelink-20130503-libiberty-md5.patch | 61 ++++++++++++++++++++++ .../files/prelink-20130503-prelink-conf.patch | 39 ++++++++++++++ .../files/prelink-armhf-dynamic-linker.patch | 12 +++++ sys-devel/prelink/files/prelink.confd | 43 +++++++++++++++ sys-devel/prelink/files/prelink.cron | 61 ++++++++++++++++++++++ 5 files changed, 216 insertions(+) create mode 100644 sys-devel/prelink/files/prelink-20130503-libiberty-md5.patch create mode 100644 sys-devel/prelink/files/prelink-20130503-prelink-conf.patch create mode 100644 sys-devel/prelink/files/prelink-armhf-dynamic-linker.patch create mode 100644 sys-devel/prelink/files/prelink.confd create mode 100644 sys-devel/prelink/files/prelink.cron (limited to 'sys-devel/prelink/files') diff --git a/sys-devel/prelink/files/prelink-20130503-libiberty-md5.patch b/sys-devel/prelink/files/prelink-20130503-libiberty-md5.patch new file mode 100644 index 000000000000..5a9fffb838f9 --- /dev/null +++ b/sys-devel/prelink/files/prelink-20130503-libiberty-md5.patch @@ -0,0 +1,61 @@ +From 8eeb9da6d017761037bf757780ea544dfeabbad8 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger +Date: Tue, 31 Jul 2012 09:02:35 +0000 +Subject: [PATCH] libiberty/md5: fix strict alias warnings +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Current libiberty md5 code triggers these warnings with gcc-4.7.1 for me: + +libiberty/md5.c: In function ‘md5_finish_ctx’: +libiberty/md5.c:117:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] +libiberty/md5.c:118:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] + +The change below fixes things for me. The optimized output (-O2) is the same +before/after my change on x86_64-linux. I imagine it'll be the same for most +targets. It seems simpler than using a union on the md5_ctx buffer since these +are the only two locations in the code where this occurs. +--- + libiberty/ChangeLog | 5 +++++ + libiberty/md5.c | 12 ++++++++---- + 2 files changed, 13 insertions(+), 4 deletions(-) + +2012-07-31 Mike Frysinger + + * md5.c (md5_finish_ctx): Declare swap_bytes. Assign SWAP() output + to swap_bytes, and then call memcpy to move it to ctx->buffer. + +diff --git a/libiberty/md5.c b/libiberty/md5.c +index 0db8fc8..8cc0cb5 100644 +--- a/src/md5.c ++++ b/src/md5.c +@@ -103,6 +103,7 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) + { + /* Take yet unprocessed bytes into account. */ + md5_uint32 bytes = ctx->buflen; ++ md5_uint32 swap_bytes; + size_t pad; + + /* Now count remaining bytes. */ +@@ -113,10 +114,13 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) + pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; + memcpy (&ctx->buffer[bytes], fillbuf, pad); + +- /* Put the 64-bit file length in *bits* at the end of the buffer. */ +- *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3); +- *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) | +- (ctx->total[0] >> 29)); ++ /* Put the 64-bit file length in *bits* at the end of the buffer. ++ Use memcpy to avoid aliasing problems. On most systems, this ++ will be optimized away to the same code. */ ++ swap_bytes = SWAP (ctx->total[0] << 3); ++ memcpy (&ctx->buffer[bytes + pad], &swap_bytes, sizeof (swap_bytes)); ++ swap_bytes = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); ++ memcpy (&ctx->buffer[bytes + pad + 4], &swap_bytes, sizeof (swap_bytes)); + + /* Process last bytes. */ + md5_process_block (ctx->buffer, bytes + pad + 8, ctx); +-- +1.8.2.1 + diff --git a/sys-devel/prelink/files/prelink-20130503-prelink-conf.patch b/sys-devel/prelink/files/prelink-20130503-prelink-conf.patch new file mode 100644 index 000000000000..9233a4114827 --- /dev/null +++ b/sys-devel/prelink/files/prelink-20130503-prelink-conf.patch @@ -0,0 +1,39 @@ +--- a/doc/prelink.conf ++++ b/doc/prelink.conf +@@ -5,6 +5,7 @@ + # If a directory name is prefixed with `-h ', symbolic links in a + # directory hierarchy are followed. + # Directories or files with `-b ' prefix will be blacklisted. ++-c /etc/prelink.conf.d/*.conf + -b *.la + -b *.png + -b *.py +@@ -16,8 +16,11 @@ + -b *.a + -b *.js + -b /lib/modules +--b /usr/lib/locale +--b /usr/X11R6/lib{,64}/X11/xfig ++-b /usr/lib{,x32,32,64}/locale ++-b /usr/lib{,x32,32,64}/wine ++-b /usr/lib{,x32,32,64}/valgrind ++-b /usr/X11R6/lib{,x32,32,64}/X11/xfig ++-b /usr/src + -l /bin + -l /usr/bin + -l /sbin +@@ -27,9 +30,9 @@ + -l /usr/games + -l /usr/libexec + -l /var/ftp/bin +--l /lib{,64} +--l /usr/lib{,64} +--l /usr/X11R6/lib{,64} +--l /usr/kerberos/lib{,64} ++-l /lib{,x32,32,64} ++-l /usr/lib{,x32,32,64} ++-l /usr/X11R6/lib{,x32,32,64} ++-l /usr/kerberos/lib{,x32,32,64} + -l /usr/X11R6/LessTif +--l /var/ftp/lib{,64} ++-l /var/ftp/lib{,x32,32,64} diff --git a/sys-devel/prelink/files/prelink-armhf-dynamic-linker.patch b/sys-devel/prelink/files/prelink-armhf-dynamic-linker.patch new file mode 100644 index 000000000000..896101040b5b --- /dev/null +++ b/sys-devel/prelink/files/prelink-armhf-dynamic-linker.patch @@ -0,0 +1,12 @@ +diff -urNp prelink_orig/src/arch-arm.c prelink/src/arch-arm.c +--- prelink_orig/src/arch-arm.c 2011-08-26 03:20:49.000000000 -0400 ++++ prelink/src/arch-arm.c 2012-11-28 23:59:28.030164736 -0500 +@@ -832,7 +832,7 @@ PL_ARCH = { + .R_COPY = R_ARM_COPY, + .R_RELATIVE = R_ARM_RELATIVE, + .rtype_class_valid = RTYPE_CLASS_VALID, +- .dynamic_linker = "/lib/ld-linux.so.3", ++ .dynamic_linker = "/lib/ld-linux-armhf.so.3", + .adjust_dyn = arm_adjust_dyn, + .adjust_rel = arm_adjust_rel, + .adjust_rela = arm_adjust_rela, diff --git a/sys-devel/prelink/files/prelink.confd b/sys-devel/prelink/files/prelink.confd new file mode 100644 index 000000000000..6b89b8c1f1fd --- /dev/null +++ b/sys-devel/prelink/files/prelink.confd @@ -0,0 +1,43 @@ +# For an in depth prelinking guide, please see: +# http://www.gentoo.org/doc/en/prelink-howto.xml + +# Control prelinking behavior in the cronjob. +# yes - automatically prelink the system +# no - automatically un-prelink the system +# "" - do nothing at all (user manages) +# (if you change this from yes to no prelink -ua +# will be run next night to undo prelinking) +PRELINKING="" + +# Options to pass to prelink +# -m Try to conserve virtual memory by allowing overlapping +# assigned virtual memory slots for libraries which +# never appear together in one binary +# -R Randomize virtual memory slot assignments for libraries. +# This makes it slightly harder for various buffer overflow +# attacks, since library addresses will be different on each +# host using -R. +PRELINK_OPTS=-mR + +# How often should full prelink be run (in days) +# Normally, prelink will be run in quick mode, every +# $PRELINK_FULL_TIME_INTERVAL days it will be run +# in normal mode. Comment it out if it should be run +# in normal mode always. +PRELINK_FULL_TIME_INTERVAL=14 + +# How often should prelink run (in days) even if +# no packages have been upgraded via portage. +# If $PRELINK_FULL_TIME_INTERVAL days have not elapsed +# yet since last normal mode prelinking, last +# quick mode prelinking happened less than +# $PRELINK_NOEMER_CHECK_INTERVAL days ago +# and no packages have been upgraded by portage +# since last quick mode prelinking, prelink +# will not do anything. +# Change to +# PRELINK_NOEMER_CHECK_INTERVAL=0 +# if you want to disable the portage database timestamp +# check (especially if you don't use portage +# exclusively to upgrade system libraries and/or binaries). +PRELINK_NOEMER_CHECK_INTERVAL=7 diff --git a/sys-devel/prelink/files/prelink.cron b/sys-devel/prelink/files/prelink.cron new file mode 100644 index 000000000000..a3edc429fee7 --- /dev/null +++ b/sys-devel/prelink/files/prelink.cron @@ -0,0 +1,61 @@ +#!/bin/sh + +. /etc/conf.d/prelink +log="/var/log/prelink.log" + +case $PRELINKING in + yes|no);; + *) exit 0;; +esac + +ionice -c3 -p $$ >/dev/null 2>&1 +renice +19 -p $$ >/dev/null 2>&1 + +if [ "$PRELINKING" != yes ]; then + sed -ri '/^[[:space:]]*#?[[:space:]]*KDE_IS_PRELINKED=/s:.*:#KDE_IS_PRELINKED=1:' /etc/env.d/*kde* 2>/dev/null + if [ -f /etc/prelink.cache ]; then + echo /usr/sbin/prelink -uav > ${log} + /usr/sbin/prelink -uav >> ${log} 2>&1 \ + || echo Prelink failed with return value $? >> ${log} + rm -f /etc/prelink.cache + # Restart init if needed + [ -n "$(find `ldd /sbin/init | awk 'NF == 4 { print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u + fi + exit 0 +fi + +sed -ri '/^[[:space:]]*#?[[:space:]]*KDE_IS_PRELINKED=/s:.*:KDE_IS_PRELINKED=1:' /etc/env.d/*kde* 2>/dev/null + +if [ ! -f /etc/prelink.cache -o -f /var/lib/misc/prelink.force ] \ + || grep -q '^prelink-ELF0.[0-2]' /etc/prelink.cache; then + # If cache does not exist or is from older prelink versions or + # if we were asked to explicitely, force full prelinking + rm -f /etc/prelink.cache /var/lib/misc/prelink.force + PRELINK_OPTS="$PRELINK_OPTS -f" + date > /var/lib/misc/prelink.full + cp -a /var/lib/misc/prelink.full /var/lib/misc/prelink.quick +elif [ -n "$PRELINK_FULL_TIME_INTERVAL" \ + -a "`find /var/lib/misc/prelink.full -mtime -${PRELINK_FULL_TIME_INTERVAL} 2>/dev/null`" \ + = /var/lib/misc/prelink.full ]; then + # If no more than PRELINK_NOEMER_CHECK_INTERVAL days elapsed from last prelink + # (be it full or quick) and no packages have been upgraded via rpm since then, + # don't do anything. + [ "`find /var/lib/misc/prelink.quick -mtime -${PRELINK_NOEMER_CHECK_INTERVAL:-7} 2>/dev/null`" \ + -a -f /var/cache/edb/counter \ + -a /var/cache/edb/counter -ot /var/lib/misc/prelink.quick ] && exit 0 + date > /var/lib/misc/prelink.quick + # If prelink without -q has been run in the last + # PRELINK_FULL_TIME_INTERVAL days, just use quick mode + PRELINK_OPTS="$PRELINK_OPTS -q" +else + date > /var/lib/misc/prelink.full + cp -a /var/lib/misc/prelink.full /var/lib/misc/prelink.quick +fi + +echo /usr/sbin/prelink -av $PRELINK_OPTS > ${log} +/usr/sbin/prelink -av $PRELINK_OPTS >> ${log} 2>&1 \ + || echo Prelink failed with return value $? >> ${log} +# Restart init if needed +[ -n "$(find `ldd /sbin/init | awk 'NF == 4 { print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u + +exit 0 -- cgit v1.2.3