diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-04 18:36:55 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-04 18:37:34 +0200 |
| commit | 947b2391c07f8a11f7bd4658f77cd03172fc221a (patch) | |
| tree | c1cdedad593852a481778ffb41e30d42f03a4767 | |
| parent | 83d7785e413bbfc4c639c855a6e47f64bdc5da9a (diff) | |
| download | busybox-w32-947b2391c07f8a11f7bd4658f77cd03172fc221a.tar.gz busybox-w32-947b2391c07f8a11f7bd4658f77cd03172fc221a.tar.bz2 busybox-w32-947b2391c07f8a11f7bd4658f77cd03172fc221a.zip | |
pmap: tweak help text, show usage if no params are given
Noticed while auditing nofork/noexec status
function old new delta
pmap_main 70 80 +10
packed_usage 31747 31744 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | NOFORK_NOEXEC.lst | 60 | ||||
| -rw-r--r-- | procps/pmap.c | 3 |
2 files changed, 32 insertions, 31 deletions
diff --git a/NOFORK_NOEXEC.lst b/NOFORK_NOEXEC.lst index d6959e363..730f2cc3c 100644 --- a/NOFORK_NOEXEC.lst +++ b/NOFORK_NOEXEC.lst | |||
| @@ -135,7 +135,7 @@ freeramdisk - leaks: open+ioctl_or_perror_and_die | |||
| 135 | fsck - interactive, longterm | 135 | fsck - interactive, longterm |
| 136 | fsck.minix | 136 | fsck.minix |
| 137 | fsfreeze - noexec candidate (it's very simple), leaks: open+xioctl | 137 | fsfreeze - noexec candidate (it's very simple), leaks: open+xioctl |
| 138 | fstrim - noexec candidate (it's very simple), leaks: open+xioctl | 138 | fstrim - noexec candidate (it's very simple), leaks: open+xioctl, find_block_device -> readdir+xstrdup |
| 139 | fsync - NOFORK | 139 | fsync - NOFORK |
| 140 | ftpd - daemon | 140 | ftpd - daemon |
| 141 | ftpget - runner | 141 | ftpget - runner |
| @@ -153,7 +153,7 @@ hdparm - complex, rare | |||
| 153 | head - noexec. runner | 153 | head - noexec. runner |
| 154 | hexdump - noexec. runner | 154 | hexdump - noexec. runner |
| 155 | hostid - NOFORK | 155 | hostid - NOFORK |
| 156 | hostname - DNS resolution may trigger, need ^C | 156 | hostname - needs ^C (may talk to DNS servers, which may be down) |
| 157 | httpd - daemon | 157 | httpd - daemon |
| 158 | hush - interactive, longterm | 158 | hush - interactive, longterm |
| 159 | hwclock - talks to hardware (xioctl(RTC_RD_TIME)) - needs ^C | 159 | hwclock - talks to hardware (xioctl(RTC_RD_TIME)) - needs ^C |
| @@ -222,40 +222,40 @@ mdev - daemon | |||
| 222 | mesg | 222 | mesg |
| 223 | microcom - interactive, longterm | 223 | microcom - interactive, longterm |
| 224 | mkdir - NOFORK | 224 | mkdir - NOFORK |
| 225 | mkdosfs | 225 | mkdosfs - needs ^C |
| 226 | mke2fs | 226 | mke2fs - needs ^C |
| 227 | mkfifo - noexec | 227 | mkfifo - noexec |
| 228 | mkfs.ext2 | 228 | mkfs.ext2 - needs ^C |
| 229 | mkfs.minix | 229 | mkfs.minix - needs ^C |
| 230 | mkfs.vfat | 230 | mkfs.vfat - needs ^C |
| 231 | mknod - noexec | 231 | mknod - noexec |
| 232 | mkpasswd | 232 | mkpasswd - changes state: with --password-fd=N, moves N to stdin. Also, "rare" category. Can be noexec. |
| 233 | mkswap | 233 | mkswap - needs ^C |
| 234 | mktemp - noexec. leaks: xstrdup+concat_path_file | 234 | mktemp - noexec. leaks: xstrdup+concat_path_file |
| 235 | modinfo - noexec | 235 | modinfo - noexec |
| 236 | modprobe - noexec | 236 | modprobe - noexec |
| 237 | more - interactive, longterm | 237 | more - interactive, longterm |
| 238 | mount - suid | 238 | mount - suid |
| 239 | mountpoint | 239 | mountpoint - noexec candidate, leaks: option -n "print dev name": find_block_device -> readdir+xstrdup |
| 240 | mpstat | 240 | mpstat - noexec candidate (it's a measuring tool, putting less load by itself is good), complex |
| 241 | mt | 241 | mt - rare |
| 242 | mv - runner (can be noexec?) | 242 | mv - runner (can be noexec?) |
| 243 | nameif | 243 | nameif |
| 244 | nbd-client | 244 | nbd-client |
| 245 | nc - runner | 245 | nc - runner |
| 246 | netstat - runner with -c | 246 | netstat - runner with -c |
| 247 | nice - spawner | 247 | nice - noexec candidate, spawner |
| 248 | nl - runner | 248 | nl - runner |
| 249 | nmeter - runner | 249 | nmeter - longterm |
| 250 | nohup - spawner | 250 | nohup - noexec candidate (maybe free concat_path_file result?), spawner |
| 251 | nproc - NOFORK | 251 | nproc - NOFORK |
| 252 | ntpd - daemon | 252 | ntpd - daemon |
| 253 | od - runner | 253 | od - runner |
| 254 | openvt - spawner | 254 | openvt - spawner |
| 255 | partprobe | 255 | partprobe - noexec candidate (simple), leaks: open+ioctl_or_perror_and_die(BLKRRPART) |
| 256 | passwd - suid | 256 | passwd - suid |
| 257 | paste - noexec. runner | 257 | paste - noexec. runner |
| 258 | patch | 258 | patch - needs ^C |
| 259 | pgrep - nofork candidate(xregcomp, procps_scan - are they ok?) | 259 | pgrep - nofork candidate(xregcomp, procps_scan - are they ok?) |
| 260 | pidof - nofork candidate(uses find_pid_by_name, is that ok?) | 260 | pidof - nofork candidate(uses find_pid_by_name, is that ok?) |
| 261 | ping - suid, runner | 261 | ping - suid, runner |
| @@ -263,7 +263,7 @@ ping6 - suid, runner | |||
| 263 | pipe_progress | 263 | pipe_progress |
| 264 | pivot_root | 264 | pivot_root |
| 265 | pkill - nofork candidate(xregcomp, procps_scan - are they ok?) | 265 | pkill - nofork candidate(xregcomp, procps_scan - are they ok?) |
| 266 | pmap | 266 | pmap - noexec candidate, leaks: open+xstrdup |
| 267 | popmaildir - runner | 267 | popmaildir - runner |
| 268 | poweroff - rare | 268 | poweroff - rare |
| 269 | powertop - interactive, longterm | 269 | powertop - interactive, longterm |
| @@ -275,8 +275,8 @@ pstree | |||
| 275 | pwd - NOFORK | 275 | pwd - NOFORK |
| 276 | pwdx - NOFORK | 276 | pwdx - NOFORK |
| 277 | raidautorun | 277 | raidautorun |
| 278 | rdate | 278 | rdate - needs ^C (may talk to DNS servers, which may be down) |
| 279 | rdev | 279 | rdev - leaks: find_block_device -> readdir+xstrdup |
| 280 | readlink - NOFORK | 280 | readlink - NOFORK |
| 281 | readprofile | 281 | readprofile |
| 282 | realpath - NOFORK | 282 | realpath - NOFORK |
| @@ -284,16 +284,16 @@ reboot - rare | |||
| 284 | reformime - runner | 284 | reformime - runner |
| 285 | remove-shell | 285 | remove-shell |
| 286 | renice - nofork candidate(uses getpwnam, is that ok?) | 286 | renice - nofork candidate(uses getpwnam, is that ok?) |
| 287 | reset - spawner (execs "stty") | 287 | reset - noexec candidate, spawner (execs "stty") |
| 288 | resize - noexec. changes state (signal handlers) | 288 | resize - noexec. changes state (signal handlers) |
| 289 | rev - runner | 289 | rev - runner |
| 290 | rm - noexec. rm -i interactive | 290 | rm - noexec. rm -i interactive |
| 291 | rmdir - NOFORK | 291 | rmdir - NOFORK |
| 292 | rmmod - noexec | 292 | rmmod - noexec |
| 293 | route | 293 | route - needs ^C (may talk to DNS servers, which may be down) |
| 294 | rpm - runner | 294 | rpm - runner |
| 295 | rpm2cpio - runner | 295 | rpm2cpio - runner |
| 296 | rtcwake - puts system to sleep, optimizing this for speed is pointless | 296 | rtcwake - longterm: puts system to sleep, optimizing this for speed is pointless |
| 297 | run-parts | 297 | run-parts |
| 298 | runlevel - noexec. can be nofork if "endutxent()" is called unconditionally, but too rare to bother? | 298 | runlevel - noexec. can be nofork if "endutxent()" is called unconditionally, but too rare to bother? |
| 299 | runsv - daemon | 299 | runsv - daemon |
| @@ -321,27 +321,27 @@ showkey - interactive, longterm | |||
| 321 | shred - runner | 321 | shred - runner |
| 322 | shuf - noexec. runner | 322 | shuf - noexec. runner |
| 323 | slattach | 323 | slattach |
| 324 | sleep - runner | 324 | sleep - runner, longterm |
| 325 | smemcap - runner | 325 | smemcap - runner |
| 326 | softlimit - spawner | 326 | softlimit - noexec candidate, spawner |
| 327 | sort - noexec. runner | 327 | sort - noexec. runner |
| 328 | split - runner | 328 | split - runner |
| 329 | ssl_client - network | 329 | ssl_client - longterm |
| 330 | start-stop-daemon | 330 | start-stop-daemon |
| 331 | stat - nofork candidate(needs fewer allocs) | 331 | stat - nofork candidate(needs fewer allocs) |
| 332 | strings - runner | 332 | strings - runner |
| 333 | stty | 333 | stty - noexec/nofork candidate. has no allocs or opens except xmove_fd(xopen("-F DEVICE"),STDIN). tcsetattr(STDIN) is not a problem: it would work the same across processes sharing this fd |
| 334 | su - suid, spawner | 334 | su - suid, spawner |
| 335 | sulogin - spawner | 335 | sulogin - spawner |
| 336 | sum - runner | 336 | sum - runner |
| 337 | sv | 337 | sv - noexec candidate, needs ^C (uses usleep(420000)) |
| 338 | svc | 338 | svc - noexec candidate, needs ^C (uses usleep(420000)) |
| 339 | svlogd - daemon | 339 | svlogd - daemon |
| 340 | swapoff - rare | 340 | swapoff - rare |
| 341 | swapon - rare | 341 | swapon - rare |
| 342 | switch_root - spawner, rare, changes state | 342 | switch_root - spawner, rare, changes state |
| 343 | sync - NOFORK | 343 | sync - NOFORK |
| 344 | sysctl | 344 | sysctl - noexec candidate, leaks: xstrdup+xmalloc_read |
| 345 | syslogd - daemon | 345 | syslogd - daemon |
| 346 | tac - noexec. runner | 346 | tac - noexec. runner |
| 347 | tail - runner | 347 | tail - runner |
diff --git a/procps/pmap.c b/procps/pmap.c index c8f728897..3dc733974 100644 --- a/procps/pmap.c +++ b/procps/pmap.c | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | //kbuild:lib-$(CONFIG_PMAP) += pmap.o | 18 | //kbuild:lib-$(CONFIG_PMAP) += pmap.o |
| 19 | 19 | ||
| 20 | //usage:#define pmap_trivial_usage | 20 | //usage:#define pmap_trivial_usage |
| 21 | //usage: "[-xq] PID" | 21 | //usage: "[-xq] PID..." |
| 22 | //usage:#define pmap_full_usage "\n\n" | 22 | //usage:#define pmap_full_usage "\n\n" |
| 23 | //usage: "Display process memory usage" | 23 | //usage: "Display process memory usage" |
| 24 | //usage: "\n" | 24 | //usage: "\n" |
| @@ -96,6 +96,7 @@ int pmap_main(int argc UNUSED_PARAM, char **argv) | |||
| 96 | unsigned opts; | 96 | unsigned opts; |
| 97 | int ret; | 97 | int ret; |
| 98 | 98 | ||
| 99 | opt_complementary = "-1"; /* min one arg */ | ||
| 99 | opts = getopt32(argv, "xq"); | 100 | opts = getopt32(argv, "xq"); |
| 100 | argv += optind; | 101 | argv += optind; |
| 101 | 102 | ||
