Patrick Williams | b58112e | 2024-03-07 11:16:36 -0600 | [diff] [blame] | 1 | From 4f05492ac07a7bbaf06dd8265b9cba329e1b53e9 Mon Sep 17 00:00:00 2001 |
| 2 | From: Ross Burton <ross.burton@arm.com> |
| 3 | Date: Wed, 30 Aug 2017 15:05:16 +0800 |
| 4 | Subject: [PATCH] lsof: remove host information from version.h |
| 5 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 6 | lsof doesn't embed the username or hostname in the build if SOURCE_DATE_EPOCH is |
| 7 | defined, but this still embeds build paths. Delete all of the host details to |
| 8 | ensure that no host information is leaked into the binary. |
| 9 | |
| 10 | Upstream-Status: Inappropriate |
| 11 | Signed-off-by: Ross Burton <ross.burton@arm.com> |
Patrick Williams | b58112e | 2024-03-07 11:16:36 -0600 | [diff] [blame] | 12 | Signed-off-by: Alexander Kanavin <alex@linutronix.de> |
| 13 | --- |
| 14 | autotools/version.h.in | 16 ++++----- |
| 15 | lib/dialects/linux/Makefile | 69 ++++++------------------------------- |
| 16 | 2 files changed, 19 insertions(+), 66 deletions(-) |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 17 | |
Patrick Williams | b58112e | 2024-03-07 11:16:36 -0600 | [diff] [blame] | 18 | diff --git a/autotools/version.h.in b/autotools/version.h.in |
| 19 | index aac0b80..2e635a5 100644 |
| 20 | --- a/autotools/version.h.in |
| 21 | +++ b/autotools/version.h.in |
| 22 | @@ -37,13 +37,13 @@ |
| 23 | |
| 24 | #include "config.h" |
| 25 | #define LSOF_VERSION PACKAGE_VERSION |
| 26 | -#define LSOF_HOST "@host@" |
| 27 | -#define LSOF_LOGNAME "@logname@" |
| 28 | -#define LSOF_USER "@user@" |
| 29 | -#define LSOF_CC "@cc@" |
| 30 | -#define LSOF_CCV "@ccv@" |
| 31 | -#define LSOF_CCFLAGS "@ccflags@" |
| 32 | -#define LSOF_LDFLAGS "@ldflags@" |
| 33 | -#define LSOF_SYSINFO "@sysinfo@" |
| 34 | +#define LSOF_HOST "" |
| 35 | +#define LSOF_LOGNAME "" |
| 36 | +#define LSOF_USER "" |
| 37 | +#define LSOF_CC "" |
| 38 | +#define LSOF_CCV "" |
| 39 | +#define LSOF_CCFLAGS "" |
| 40 | +#define LSOF_LDFLAGS "" |
| 41 | +#define LSOF_SYSINFO "" |
| 42 | |
| 43 | #endif |
| 44 | diff --git a/lib/dialects/linux/Makefile b/lib/dialects/linux/Makefile |
| 45 | index f8adaa6..7a79ca7 100644 |
| 46 | --- a/lib/dialects/linux/Makefile |
| 47 | +++ b/lib/dialects/linux/Makefile |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 48 | @@ -83,64 +83,17 @@ ${LIB}: FRC |
| 49 | version.h: FRC |
| 50 | @echo Constructing version.h |
| 51 | @rm -f version.h |
| 52 | - @echo '#define LSOF_BLDCMT "${LSOF_BLDCMT}"' > version.h; |
| 53 | - @echo '#define LSOF_CC "${CC}"' >> version.h |
| 54 | - @echo '#define LSOF_CCV "${CCV}"' >> version.h |
| 55 | - @echo '#define LSOF_CCFLAGS "'`echo ${CFLAGS} | sed 's/\\\\(/\\(/g' | sed 's/\\\\)/\\)/g' | sed 's/"/\\\\"/g'`'"' >> version.h |
| 56 | - @echo '#define LSOF_CINFO "${CINFO}"' >> version.h |
| 57 | - @if [ "X${LSOF_HOST}" = "X" ]; then \ |
| 58 | - if [ "X${SOURCE_DATE_EPOCH}" = "X" ]; then \ |
| 59 | - echo '#define LSOF_HOST "'`uname -n`'"' >> version.h; \ |
| 60 | - else \ |
| 61 | - echo '#define LSOF_HOST ""' >> version.h; \ |
| 62 | - fi \ |
| 63 | - else \ |
| 64 | - if [ "${LSOF_HOST}" = "none" ]; then \ |
| 65 | - echo '#define LSOF_HOST ""' >> version.h; \ |
| 66 | - else \ |
| 67 | - echo '#define LSOF_HOST "${LSOF_HOST}"' >> version.h; \ |
| 68 | - fi \ |
| 69 | - fi |
| 70 | - @echo '#define LSOF_LDFLAGS "${CFGL}"' >> version.h |
| 71 | - @if [ "X${LSOF_LOGNAME}" = "X" ]; then \ |
| 72 | - if [ "X${SOURCE_DATE_EPOCH}" = "X" ]; then \ |
| 73 | - echo '#define LSOF_LOGNAME "${LOGNAME}"' >> version.h; \ |
| 74 | - else \ |
| 75 | - echo '#define LSOF_LOGNAME ""' >> version.h; \ |
| 76 | - fi \ |
| 77 | - else \ |
| 78 | - if [ "${LSOF_LOGNAME}" = "none" ]; then \ |
| 79 | - echo '#define LSOF_LOGNAME ""' >> version.h; \ |
| 80 | - else \ |
| 81 | - echo '#define LSOF_LOGNAME "${LSOF_LOGNAME}"' >> version.h; \ |
| 82 | - fi; \ |
| 83 | - fi |
| 84 | - @if [ "X${LSOF_SYSINFO}" = "X" ]; then \ |
| 85 | - if [ "X${SOURCE_DATE_EPOCH}" = "X" ]; then \ |
| 86 | - echo '#define LSOF_SYSINFO "'`uname -a`'"' >> version.h; \ |
| 87 | - else \ |
| 88 | - echo '#define LSOF_SYSINFO ""' >> version.h; \ |
| 89 | - fi \ |
| 90 | - else \ |
| 91 | - if [ "${LSOF_SYSINFO}" = "none" ]; then \ |
| 92 | - echo '#define LSOF_SYSINFO ""' >> version.h; \ |
| 93 | - else \ |
| 94 | - echo '#define LSOF_SYSINFO "${LSOF_SYSINFO}"' >> version.h; \ |
| 95 | - fi \ |
| 96 | - fi |
| 97 | - @if [ "X${LSOF_USER}" = "X" ]; then \ |
| 98 | - if [ "X${SOURCE_DATE_EPOCH}" = "X" ]; then \ |
| 99 | - echo '#define LSOF_USER "${USER}"' >> version.h; \ |
| 100 | - else \ |
| 101 | - echo '#define LSOF_USER ""' >> version.h; \ |
| 102 | - fi \ |
| 103 | - else \ |
| 104 | - if [ "${LSOF_USER}" = "none" ]; then \ |
| 105 | - echo '#define LSOF_USER ""' >> version.h; \ |
| 106 | - else \ |
| 107 | - echo '#define LSOF_USER "${LSOF_USER}"' >> version.h; \ |
| 108 | - fi \ |
| 109 | - fi |
| 110 | + |
| 111 | + @echo '#define LSOF_BLDCMT ""' > version.h; |
| 112 | + @echo '#define LSOF_CC ""' >> version.h |
| 113 | + @echo '#define LSOF_CCV ""' >> version.h |
| 114 | + @echo '#define LSOF_CCFLAGS ""' >> version.h |
| 115 | + @echo '#define LSOF_CINFO ""' >> version.h |
| 116 | + @echo '#define LSOF_HOST ""' >> version.h |
| 117 | + @echo '#define LSOF_LDFLAGS ""' >> version.h |
| 118 | + @echo '#define LSOF_LOGNAME ""' >> version.h |
| 119 | + @echo '#define LSOF_SYSINFO ""' >> version.h |
| 120 | + @echo '#define LSOF_USER ""' >> version.h |
| 121 | @sed '/VN/s/.ds VN \(.*\)/#define LSOF_VERSION "\1"/' < version >> version.h |
| 122 | |
| 123 | FRC: |