diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-05 22:25:00 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-05 22:25:00 +0200 |
commit | 00c1811d87ea9019c2beda0d182150792c6bb053 (patch) | |
tree | 43f1af035419b1d197e24fa25486ccbfad3eb26a /procps/ps.c | |
parent | 99125c04950a7ba2ac90dc21c3d924fe9dd95651 (diff) | |
download | busybox-w32-00c1811d87ea9019c2beda0d182150792c6bb053.tar.gz busybox-w32-00c1811d87ea9019c2beda0d182150792c6bb053.tar.bz2 busybox-w32-00c1811d87ea9019c2beda0d182150792c6bb053.zip |
pstree: make it NOEXEC
While at it, documet why ps can't be NOEXEC.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps/ps.c')
-rw-r--r-- | procps/ps.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/procps/ps.c b/procps/ps.c index 081479b33..afd981313 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
@@ -15,7 +15,7 @@ | |||
15 | //config: ps gives a snapshot of the current processes. | 15 | //config: ps gives a snapshot of the current processes. |
16 | //config: | 16 | //config: |
17 | //config:config FEATURE_PS_WIDE | 17 | //config:config FEATURE_PS_WIDE |
18 | //config: bool "Enable wide output option (-w)" | 18 | //config: bool "Enable wide output (-w)" |
19 | //config: default y | 19 | //config: default y |
20 | //config: depends on PS && !DESKTOP | 20 | //config: depends on PS && !DESKTOP |
21 | //config: help | 21 | //config: help |
@@ -24,7 +24,7 @@ | |||
24 | //config: than once, the length is unlimited. | 24 | //config: than once, the length is unlimited. |
25 | //config: | 25 | //config: |
26 | //config:config FEATURE_PS_LONG | 26 | //config:config FEATURE_PS_LONG |
27 | //config: bool "Enable long output option (-l)" | 27 | //config: bool "Enable long output (-l)" |
28 | //config: default y | 28 | //config: default y |
29 | //config: depends on PS && !DESKTOP | 29 | //config: depends on PS && !DESKTOP |
30 | //config: help | 30 | //config: help |
@@ -32,11 +32,16 @@ | |||
32 | //config: Adds fields PPID, RSS, START, TIME & TTY | 32 | //config: Adds fields PPID, RSS, START, TIME & TTY |
33 | //config: | 33 | //config: |
34 | //config:config FEATURE_PS_TIME | 34 | //config:config FEATURE_PS_TIME |
35 | //config: bool "Support -o time and -o etime output specifiers" | 35 | //config: bool "Enable -o time and -o etime specifiers" |
36 | //config: default y | 36 | //config: default y |
37 | //config: depends on PS && DESKTOP | 37 | //config: depends on PS && DESKTOP |
38 | //config: select PLATFORM_LINUX | 38 | //config: select PLATFORM_LINUX |
39 | //config: | 39 | //config: |
40 | //config:config FEATURE_PS_ADDITIONAL_COLUMNS | ||
41 | //config: bool "Enable -o rgroup, -o ruser, -o nice specifiers" | ||
42 | //config: default y | ||
43 | //config: depends on PS && DESKTOP | ||
44 | //config: | ||
40 | //config:config FEATURE_PS_UNUSUAL_SYSTEMS | 45 | //config:config FEATURE_PS_UNUSUAL_SYSTEMS |
41 | //config: bool "Support Linux prior to 2.4.0 and non-ELF systems" | 46 | //config: bool "Support Linux prior to 2.4.0 and non-ELF systems" |
42 | //config: default n | 47 | //config: default n |
@@ -44,13 +49,9 @@ | |||
44 | //config: help | 49 | //config: help |
45 | //config: Include support for measuring HZ on old kernels and non-ELF systems | 50 | //config: Include support for measuring HZ on old kernels and non-ELF systems |
46 | //config: (if you are on Linux 2.4.0+ and use ELF, you don't need this) | 51 | //config: (if you are on Linux 2.4.0+ and use ELF, you don't need this) |
47 | //config: | ||
48 | //config:config FEATURE_PS_ADDITIONAL_COLUMNS | ||
49 | //config: bool "Support -o rgroup, -o ruser, -o nice specifiers" | ||
50 | //config: default y | ||
51 | //config: depends on PS && DESKTOP | ||
52 | 52 | ||
53 | //applet:IF_PS(APPLET(ps, BB_DIR_BIN, BB_SUID_DROP)) | 53 | //applet:IF_PS(APPLET(ps, BB_DIR_BIN, BB_SUID_DROP)) |
54 | /* can't be NOEXEC: uses ELF aux vector. To have it, we must be a normal, execed process */ | ||
54 | 55 | ||
55 | //kbuild:lib-$(CONFIG_PS) += ps.o | 56 | //kbuild:lib-$(CONFIG_PS) += ps.o |
56 | 57 | ||
@@ -202,6 +203,7 @@ struct globals { | |||
202 | 203 | ||
203 | #if ENABLE_FEATURE_PS_TIME | 204 | #if ENABLE_FEATURE_PS_TIME |
204 | /* for ELF executables, notes are pushed before environment and args */ | 205 | /* for ELF executables, notes are pushed before environment and args */ |
206 | /* try "LD_SHOW_AUXV=1 /bin/true" */ | ||
205 | static uintptr_t find_elf_note(uintptr_t findme) | 207 | static uintptr_t find_elf_note(uintptr_t findme) |
206 | { | 208 | { |
207 | uintptr_t *ep = (uintptr_t *) environ; | 209 | uintptr_t *ep = (uintptr_t *) environ; |
@@ -217,7 +219,7 @@ static uintptr_t find_elf_note(uintptr_t findme) | |||
217 | return -1; | 219 | return -1; |
218 | } | 220 | } |
219 | 221 | ||
220 | #if ENABLE_FEATURE_PS_UNUSUAL_SYSTEMS | 222 | # if ENABLE_FEATURE_PS_UNUSUAL_SYSTEMS |
221 | static unsigned get_HZ_by_waiting(void) | 223 | static unsigned get_HZ_by_waiting(void) |
222 | { | 224 | { |
223 | struct timeval tv1, tv2; | 225 | struct timeval tv1, tv2; |
@@ -260,13 +262,13 @@ static unsigned get_HZ_by_waiting(void) | |||
260 | 262 | ||
261 | return r; | 263 | return r; |
262 | } | 264 | } |
263 | #else | 265 | # else |
264 | static inline unsigned get_HZ_by_waiting(void) | 266 | static inline unsigned get_HZ_by_waiting(void) |
265 | { | 267 | { |
266 | /* Better method? */ | 268 | /* Better method? */ |
267 | return 100; | 269 | return 100; |
268 | } | 270 | } |
269 | #endif | 271 | # endif |
270 | 272 | ||
271 | static unsigned get_kernel_HZ(void) | 273 | static unsigned get_kernel_HZ(void) |
272 | { | 274 | { |