summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/prelink/prelink
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-03 16:48:56 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-05 12:26:36 +0000
commita242274d98e6f0f8d2aa21f778df690de7b42144 (patch)
treeff784d0fb2d5ca91387da92db7379cf18ab54707 /meta/recipes-devtools/prelink/prelink
parentc98fc3933142783db2ed735d971a8c5b8408344c (diff)
downloadpoky-a242274d98e6f0f8d2aa21f778df690de7b42144.tar.gz
prelink: Drop support for it
Prelink is being dropped by glibc in 2.36. It already causes issues with binary corruption, has a number of open bugs and is of questionable benefit without disabling load address randomization and PIE executables. We disabled it by default a while back but left people able to use it. We would be unable to maintain it alone without glibc support so remove the remaining pieces. (From OE-Core rev: 23c0be78106f1d1e2bb9c724174a1bb8c56c2469) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/prelink/prelink')
-rw-r--r--meta/recipes-devtools/prelink/prelink/0001-Add-MIPS-gnu-hash-support.patch110
-rw-r--r--meta/recipes-devtools/prelink/prelink/macros.prelink5
-rw-r--r--meta/recipes-devtools/prelink/prelink/prelink.conf18
-rw-r--r--meta/recipes-devtools/prelink/prelink/prelink.cron.daily40
-rw-r--r--meta/recipes-devtools/prelink/prelink/prelink.default22
5 files changed, 0 insertions, 195 deletions
diff --git a/meta/recipes-devtools/prelink/prelink/0001-Add-MIPS-gnu-hash-support.patch b/meta/recipes-devtools/prelink/prelink/0001-Add-MIPS-gnu-hash-support.patch
deleted file mode 100644
index da0275bfcd..0000000000
--- a/meta/recipes-devtools/prelink/prelink/0001-Add-MIPS-gnu-hash-support.patch
+++ /dev/null
@@ -1,110 +0,0 @@
1From 05240e13668422c4f9118f2cde953ec875d0d68f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 14 Jan 2020 01:37:22 -0800
4Subject: [PATCH] Add MIPS gnu hash support
5
6Upstream-Status: Pending
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 src/arch-mips.c | 1 +
10 src/prelink.c | 1 +
11 src/prelink.h | 5 +++++
12 3 files changed, 7 insertions(+)
13
14--- a/src/arch-mips.c
15+++ b/src/arch-mips.c
16@@ -324,6 +324,7 @@ mips_adjust_dyn (DSO *dso, int n, GElf_D
17 case DT_MIPS_BASE_ADDRESS:
18 case DT_MIPS_RLD_MAP:
19 case DT_MIPS_OPTIONS:
20+ case DT_MIPS_XHASH:
21 if (dyn->d_un.d_ptr >= start)
22 dyn->d_un.d_ptr += adjust;
23 return 1;
24--- a/src/prelink.c
25+++ b/src/prelink.c
26@@ -425,6 +425,7 @@ prelink_prepare (DSO *dso)
27 {
28 case SHT_HASH:
29 case SHT_GNU_HASH:
30+ case SHT_MIPS_XHASH:
31 case SHT_DYNSYM:
32 case SHT_REL:
33 case SHT_RELA:
34--- a/src/prelink.h
35+++ b/src/prelink.h
36@@ -114,6 +114,11 @@ typedef uint8_t Elf64_Byte;
37 #define SHT_MIPS_ABIFLAGS 0x7000002a
38 #endif
39
40+#ifndef SHT_MIPS_XHASH
41+#define DT_MIPS_XHASH 0x70000036
42+#define SHT_MIPS_XHASH 0x7000002b
43+#endif
44+
45 #ifndef RSS_UNDEF
46 #define RSS_UNDEF 0
47 #endif
48--- a/src/dso.c
49+++ b/src/dso.c
50@@ -109,6 +109,11 @@ read_dynamic (DSO *dso)
51 dso->info_DT_GNU_HASH = dyn.d_un.d_val;
52 dso->info_set_mask |= (1ULL << DT_GNU_HASH_BIT);
53 }
54+ else if (dyn.d_tag == DT_MIPS_XHASH)
55+ {
56+ dso->info_DT_GNU_HASH = dyn.d_un.d_val;
57+ dso->info_set_mask |= (1ULL << DT_GNU_HASH_BIT);
58+ }
59 else if (dyn.d_tag == DT_TLSDESC_PLT)
60 {
61 dso->info_DT_TLSDESC_PLT = dyn.d_un.d_val;
62@@ -1463,6 +1468,7 @@ adjust_dso (DSO *dso, GElf_Addr start, G
63 break;
64 case SHT_HASH:
65 case SHT_GNU_HASH:
66+ case SHT_MIPS_XHASH:
67 case SHT_NOBITS:
68 case SHT_STRTAB:
69 break;
70--- a/src/space.c
71+++ b/src/space.c
72@@ -61,6 +61,7 @@ print_sections (DSO *dso, GElf_Ehdr *ehd
73 { SHT_GNU_versym, "VERSYM" },
74 { SHT_GNU_LIBLIST, "LIBLIST" },
75 { SHT_GNU_HASH, "GNU_HASH" },
76+ { SHT_MIPS_XHASH, "MIPS_XHASH" },
77 { 0, NULL }
78 };
79
80@@ -183,6 +184,7 @@ readonly_is_movable (DSO *dso, GElf_Ehdr
81 {
82 case SHT_HASH:
83 case SHT_GNU_HASH:
84+ case SHT_MIPS_XHASH:
85 case SHT_DYNSYM:
86 case SHT_REL:
87 case SHT_RELA:
88@@ -558,6 +560,7 @@ find_readonly_space (DSO *dso, GElf_Shdr
89 {
90 case SHT_HASH:
91 case SHT_GNU_HASH:
92+ case SHT_MIPS_XHASH:
93 case SHT_DYNSYM:
94 case SHT_STRTAB:
95 case SHT_GNU_verdef:
96--- a/src/exec.c
97+++ b/src/exec.c
98@@ -65,7 +65,11 @@ update_dynamic_tags (DSO *dso, GElf_Shdr
99 || (dynamic_info_is_set (dso, DT_GNU_HASH_BIT)
100 && dso->info_DT_GNU_HASH == old_shdr[j].sh_addr
101 && old_shdr[j].sh_type == SHT_GNU_HASH
102- && set_dynamic (dso, DT_GNU_HASH, shdr[i].sh_addr, 1)))
103+ && set_dynamic (dso, DT_GNU_HASH, shdr[i].sh_addr, 1))
104+ || (dynamic_info_is_set (dso, DT_GNU_HASH_BIT)
105+ && dso->info_DT_GNU_HASH == old_shdr[j].sh_addr
106+ && old_shdr[j].sh_type == SHT_MIPS_XHASH
107+ && set_dynamic (dso, DT_MIPS_XHASH, shdr[i].sh_addr, 1)))
108 return 1;
109 }
110
diff --git a/meta/recipes-devtools/prelink/prelink/macros.prelink b/meta/recipes-devtools/prelink/prelink/macros.prelink
deleted file mode 100644
index cb16695885..0000000000
--- a/meta/recipes-devtools/prelink/prelink/macros.prelink
+++ /dev/null
@@ -1,5 +0,0 @@
1# rpm-4.1 verifies prelinked libraries using a prelink undo helper.
2# Note: The 2nd token is used as argv[0] and "library" is a
3# placeholder that will be deleted and replaced with the appropriate
4# library file path.
5%__prelink_undo_cmd /usr/sbin/prelink prelink -y library
diff --git a/meta/recipes-devtools/prelink/prelink/prelink.conf b/meta/recipes-devtools/prelink/prelink/prelink.conf
deleted file mode 100644
index 562f23c59d..0000000000
--- a/meta/recipes-devtools/prelink/prelink/prelink.conf
+++ /dev/null
@@ -1,18 +0,0 @@
1# This config file contains a list of directories both with binaries
2# and libraries prelink should consider by default.
3# If a directory name is prefixed with `-l ', the directory hierarchy
4# will be walked as long as filesystem boundaries are not crossed.
5# If a directory name is prefixed with `-h ', symbolic links in a
6# directory hierarchy are followed.
7-l /usr/local/sbin
8-l /sbin
9-l /usr/sbin
10-l /usr/local/bin
11-l /bin
12-l /usr/bin
13-l /usr/X11R6/bin
14-l /usr/games
15-l /usr/local/lib{,32,64,x32}
16-l /lib{,32,64,x32}
17-l /usr/lib{,32,64,x32}
18-l /usr/X11R6/lib{,32,64,x32}
diff --git a/meta/recipes-devtools/prelink/prelink/prelink.cron.daily b/meta/recipes-devtools/prelink/prelink/prelink.cron.daily
deleted file mode 100644
index 0b3c07322c..0000000000
--- a/meta/recipes-devtools/prelink/prelink/prelink.cron.daily
+++ /dev/null
@@ -1,40 +0,0 @@
1#!/bin/sh
2
3. /etc/default/prelink
4
5renice +19 -p $$ >/dev/null 2>&1
6
7if [ "$PRELINKING" != yes ]; then
8 if [ -f /etc/prelink.cache ]; then
9 echo /usr/sbin/prelink -uav > /var/log/prelink.log
10 /usr/sbin/prelink -uav >> /var/log/prelink.log 2>&1
11 rm -f /etc/prelink.cache
12 # Restart init if needed
13 [ -n "$(find `ldd /sbin/init | awk '{ print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u
14 fi
15 exit 0
16fi
17
18if [ ! -f /etc/prelink.cache -o -f /var/lib/misc/prelink.force ] \
19 || grep -q '^prelink-ELF0.[0-2]' /etc/prelink.cache; then
20 # If cache does not exist or is from older prelink versions or
21 # if we were asked to explicitely, force full prelinking
22 rm -f /etc/prelink.cache /var/lib/misc/prelink.force
23 PRELINK_OPTS="$PRELINK_OPTS -f"
24 date > /var/lib/misc/prelink.full
25elif [ -n "$PRELINK_FULL_TIME_INTERVAL" \
26 -a "`find /var/lib/misc/prelink.full -mtime -${PRELINK_FULL_TIME_INTERVAL} 2>/dev/null`" \
27 = /var/lib/misc/prelink.full ]; then
28 # If prelink without -q has been run in the last
29 # PRELINK_FULL_TIME_INTERVAL days, just use quick mode
30 PRELINK_OPTS="$PRELINK_OPTS -q"
31else
32 date > /var/lib/misc/prelink.full
33fi
34
35echo /usr/sbin/prelink -av $PRELINK_OPTS > /var/log/prelink.log
36/usr/sbin/prelink -av $PRELINK_OPTS >> /var/log/prelink.log 2>&1
37# Restart init if needed
38[ -n "$(find `ldd /sbin/init | awk '{ print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u
39
40exit 0
diff --git a/meta/recipes-devtools/prelink/prelink/prelink.default b/meta/recipes-devtools/prelink/prelink/prelink.default
deleted file mode 100644
index d8802f820a..0000000000
--- a/meta/recipes-devtools/prelink/prelink/prelink.default
+++ /dev/null
@@ -1,22 +0,0 @@
1# Set this to no to disable prelinking altogether
2# or to yes to enable it.
3# (if you change this from yes to no prelink -ua
4# will be run next night to undo prelinking)
5PRELINKING=yes
6
7# Options to pass to prelink
8# -m Try to conserve virtual memory by allowing overlapping
9# assigned virtual memory slots for libraries which
10# never appear together in one binary
11# -R Randomize virtual memory slot assignments for libraries.
12# This makes it slightly harder for various buffer overflow
13# attacks, since library addresses will be different on each
14# host using -R.
15PRELINK_OPTS=-mR
16
17# How often should full prelink be run (in days)
18# Normally, prelink will be run in quick mode, every
19# $PRELINK_FULL_TIME_INTERVAL days it will be run
20# in normal mode. Comment this line out if prelink
21# should be run in normal mode always.
22PRELINK_FULL_TIME_INTERVAL=14