pmap: tweak help text, show usage if no params are given
[oweals/busybox.git] / NOFORK_NOEXEC.lst
1 Why an applet can't be NOFORK or NOEXEC?
2
3 Why can't be NOFORK:
4 interactive: may wait for user input, ^C has to work
5 spawner: "tool PROG ARGS" which changes program state and execs - must fork
6 changes state: e.g. environment, signal handlers
7 alloc+xfunc: xmalloc, then xfunc - leaks memory if xfunc dies
8 open+xfunc: opens fd, then calls xfunc - fd is leaked if xfunc dies
9 leaks: does not free allocated memory or opened fds
10 runner: sometimes may run for long(ish) time, and/or works with network:
11         ^C has to work (cat BIGFILE, chmod -R, ftpget, nc)
12
13 "runners" can become eligible after shell is taught ^C to interrupt NOFORKs,
14 need to be inspected that they do not fall into alloc+xfunc, open+xfunc,
15 leak categories.
16
17 Why can't be NOEXEC:
18 suid: runs under different uid - must fork+exec
19
20 Why shouldn't be NOFORK/NOEXEC:
21 rare: not started often enough to bother optimizing (example: poweroff)
22 daemon: runs indefinitely; these are also always fit "rare" category
23 longterm: often runs for a long time (many seconds), execing would make
24         memory footprint smaller
25 complex: no immediately obvious reason why NOFORK wouldn't work,
26         but does some non-obvoius operations (example: fuser, lsof, losetup);
27         detailed audit often turns out that it's a leaker
28
29 Interesting example of "interactive" applet which is nevertheless can be
30 (and is) NOEXEC is "rm". Yes, "rm -i" is interactive - but it's not that typical
31 for users to keep it waiting for many minutes, whereas running "rm" in shell
32 is very typical, and speeding up this common use via NOEXEC is useful.
33 IOW: rm is "interactive", but not "longterm".
34
35
36 [ - NOFORK
37 [[ - NOFORK
38 acpid - daemon
39 add-shell
40 addgroup
41 adduser
42 adjtimex
43 ar - runner
44 arch - NOFORK
45 arp - complex, rare
46 arping - runner
47 ash - interactive, longterm
48 awk - noexec. runner
49 base64 - runner
50 basename - NOFORK
51 beep
52 blkdiscard
53 blkid
54 blockdev
55 bootchartd - daemon
56 brctl
57 bunzip2 - runner
58 busybox
59 bzcat - runner
60 bzip2 - runner
61 cal - runner: cal -n9999
62 cat - runner
63 chat - needs ^C to work
64 chattr - runner
65 chgrp - noexec. runner
66 chmod - noexec. runner
67 chown - noexec. runner
68 chpasswd - runner (list of "user:password"s from stdin)
69 chpst - noexec candidate, spawner
70 chroot - noexec candidate, spawner
71 chrt - noexec candidate, spawner
72 chvt - leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds. Also, "rare" category. Can be noexec.
73 cksum - noexec. runner
74 clear - NOFORK
75 cmp - runner
76 comm - runner
77 conspy - interactive, longterm
78 cp - noexec. runner
79 cpio - runner
80 crond - daemon
81 crontab
82 cryptpw - changes state: with --password-fd=N, moves N to stdin. Also, "rare" category. Can be noexec.
83 cttyhack - noexec candidate, spawner
84 cut - noexec. runner
85 date - noexec. nofork candidate(needs to stop messing up env, free xasprintf result, not use xfuncs after xasprintf)
86 dc - runner (eats stdin if no params)
87 dd - noexec. runner
88 deallocvt - leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds. Also, "rare" category. Can be noexec.
89 delgroup
90 deluser
91 depmod - complex, rare
92 devmem - runner, complex (access to device memory may hang)
93 df - leaks: nested allocs
94 dhcprelay - daemon
95 diff - runner
96 dirname - NOFORK
97 dmesg - runner
98 dnsd - daemon
99 dnsdomainname - needs ^C (may talk to DNS servers, which may be down)
100 dos2unix - noexec. runner
101 dpkg - runner
102 du - runner
103 dumpkmap - leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds. Also, "rare" category. Can be noexec.
104 dumpleases
105 echo - NOFORK
106 ed - interactive, longterm
107 egrep - longterm runner ("CMD | egrep ..."  may run indefinitely, better to exec to conserve memory)
108 eject - leaks: open+ioctl_or_perror_and_die, changes state (moves fds)
109 env - noexec. spawner, changes state (env)
110 envdir - noexec candidate, spawner
111 envuidgid - noexec candidate, spawner
112 expand - runner
113 expr - leaks: nested allocs
114 factor - runner (eats stdin if no params)
115 fakeidentd - daemon
116 false - NOFORK
117 fatattr - leaks: open+xioctl, complex
118 fbset - leaks: open+xfunc, complex, rare
119 fbsplash - runner, longterm
120 fdflush - leaks: open+ioctl_or_perror_and_die, needs ^C (floppy may be unresponsive), rare
121 fdformat - needs ^C (floppy may be unresponsive), longterm, rare
122 fdisk - interactive, longterm
123 fgconsole - leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds. Also, "rare" category. Can be noexec.
124 fgrep - longterm runner ("CMD | fgrep ..."  may run indefinitely, better to exec to conserve memory)
125 find - noexec. runner
126 findfs - suid
127 flash_eraseall
128 flash_lock
129 flash_unlock
130 flashcp
131 flock - spawner, changes state (file locks)
132 fold - noexec. runner
133 free - nofork candidate(struct globals, needs to close /proc/meminfo fd)
134 freeramdisk - leaks: open+ioctl_or_perror_and_die
135 fsck - interactive, longterm
136 fsck.minix
137 fsfreeze - 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
140 ftpd - daemon
141 ftpget - runner
142 ftpput - runner
143 fuser - complex
144 getopt - noexec. leaks: many allocs
145 getty - interactive, longterm
146 grep - longterm runner ("CMD | grep ..."  may run indefinitely, better to exec to conserve memory)
147 groups - noexec
148 gunzip - runner
149 gzip - runner
150 halt - rare
151 hd - noexec. runner
152 hdparm - complex, rare
153 head - noexec. runner
154 hexdump - noexec. runner
155 hostid - NOFORK
156 hostname - needs ^C (may talk to DNS servers, which may be down)
157 httpd - daemon
158 hush - interactive, longterm
159 hwclock - talks to hardware (xioctl(RTC_RD_TIME)) - needs ^C
160 i2cdetect
161 i2cdump
162 i2cget
163 i2cset
164 id - noexec
165 ifconfig
166 ifenslave
167 ifplugd - daemon
168 inetd - daemon
169 init - daemon
170 inotifyd - daemon
171 insmod - noexec
172 install - runner
173 ionice - spawner
174 iostat - runner
175 ip - noexec candidate
176 ipaddr - noexec candidate
177 ipcalc - noexec candidate
178 ipcrm - noexec candidate
179 ipcs - noexec candidate
180 iplink - noexec candidate
181 ipneigh - noexec candidate
182 iproute - noexec candidate
183 iprule - noexec candidate
184 iptunnel - noexec candidate
185 kbd_mode
186 kill - NOFORK
187 killall - NOFORK
188 killall5 - NOFORK
189 klogd - daemon
190 last - runner (I've got 1300 lines of output when tried it)
191 less - interactive, longterm
192 link - NOFORK
193 linux32 - spawner
194 linux64 - spawner
195 linuxrc - daemon
196 ln - noexec
197 loadfont
198 loadkmap - leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds. Also, "rare" category. Can be noexec.
199 logger - runner
200 login - suid, interactive, longterm
201 logname - NOFORK
202 losetup - complex
203 lpd - daemon
204 lpq - runner
205 lpr - runner
206 ls - noexec. runner
207 lsattr - runner. noexec candidate (ls is, why not this one?)
208 lsmod - noexec
209 lsof - complex
210 lspci - noexec candidate, too rare to bother for nofork
211 lsscsi - noexec candidate, too rare to bother for nofork
212 lsusb - noexec candidate, too rare to bother for nofork
213 lzcat - runner
214 lzma - runner
215 lzop - runner
216 lzopcat - runner
217 makedevs
218 makemime - runner
219 man - spawner, interactive, longterm
220 md5sum - noexec. runner
221 mdev - daemon
222 mesg
223 microcom - interactive, longterm
224 mkdir - NOFORK
225 mkdosfs - needs ^C
226 mke2fs - needs ^C
227 mkfifo - noexec
228 mkfs.ext2 - needs ^C
229 mkfs.minix - needs ^C
230 mkfs.vfat - needs ^C
231 mknod - noexec
232 mkpasswd - changes state: with --password-fd=N, moves N to stdin. Also, "rare" category. Can be noexec.
233 mkswap - needs ^C
234 mktemp - noexec. leaks: xstrdup+concat_path_file
235 modinfo - noexec
236 modprobe - noexec
237 more - interactive, longterm
238 mount - suid
239 mountpoint - noexec candidate, leaks: option -n "print dev name": find_block_device -> readdir+xstrdup
240 mpstat - noexec candidate (it's a measuring tool, putting less load by itself is good), complex
241 mt - rare
242 mv - runner (can be noexec?)
243 nameif
244 nbd-client
245 nc - runner
246 netstat - runner with -c
247 nice - noexec candidate, spawner
248 nl - runner
249 nmeter - longterm
250 nohup - noexec candidate (maybe free concat_path_file result?), spawner
251 nproc - NOFORK
252 ntpd - daemon
253 od - runner
254 openvt - spawner
255 partprobe - noexec candidate (simple), leaks: open+ioctl_or_perror_and_die(BLKRRPART)
256 passwd - suid
257 paste - noexec. runner
258 patch - needs ^C
259 pgrep - nofork candidate(xregcomp, procps_scan - are they ok?)
260 pidof - nofork candidate(uses find_pid_by_name, is that ok?)
261 ping - suid, runner
262 ping6 - suid, runner
263 pipe_progress
264 pivot_root
265 pkill - nofork candidate(xregcomp, procps_scan - are they ok?)
266 pmap - noexec candidate, leaks: open+xstrdup
267 popmaildir - runner
268 poweroff - rare
269 powertop - interactive, longterm
270 printenv - NOFORK
271 printf - NOFORK
272 ps - noexec candidate
273 pscan - longterm
274 pstree
275 pwd - NOFORK
276 pwdx - NOFORK
277 raidautorun
278 rdate - needs ^C (may talk to DNS servers, which may be down)
279 rdev - leaks: find_block_device -> readdir+xstrdup
280 readlink - NOFORK
281 readprofile
282 realpath - NOFORK
283 reboot - rare
284 reformime - runner
285 remove-shell
286 renice - nofork candidate(uses getpwnam, is that ok?)
287 reset - noexec candidate, spawner (execs "stty")
288 resize - noexec. changes state (signal handlers)
289 rev - runner
290 rm - noexec. rm -i interactive
291 rmdir - NOFORK
292 rmmod - noexec
293 route - needs ^C (may talk to DNS servers, which may be down)
294 rpm - runner
295 rpm2cpio - runner
296 rtcwake - longterm: puts system to sleep, optimizing this for speed is pointless
297 run-parts
298 runlevel - noexec. can be nofork if "endutxent()" is called unconditionally, but too rare to bother?
299 runsv - daemon
300 runsvdir - daemon
301 rx - runner
302 script
303 scriptreplay
304 sed - runner
305 sendmail - runner
306 seq - noexec. runner
307 setarch - spawner
308 setconsole
309 setfont
310 setkeycodes
311 setlogcons
312 setpriv - spawner
313 setserial
314 setsid - spawner
315 setuidgid
316 sha1sum - noexec. runner
317 sha256sum - noexec. runner
318 sha3sum - noexec. runner
319 sha512sum - noexec. runner
320 showkey - interactive, longterm
321 shred - runner
322 shuf - noexec. runner
323 slattach
324 sleep - runner, longterm
325 smemcap - runner
326 softlimit - noexec candidate, spawner
327 sort - noexec. runner
328 split - runner
329 ssl_client - longterm
330 start-stop-daemon
331 stat - nofork candidate(needs fewer allocs)
332 strings - runner
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
335 sulogin - spawner
336 sum - runner
337 sv - noexec candidate, needs ^C (uses usleep(420000))
338 svc - noexec candidate, needs ^C (uses usleep(420000))
339 svlogd - daemon
340 swapoff - rare
341 swapon - rare
342 switch_root - spawner, rare, changes state
343 sync - NOFORK
344 sysctl - noexec candidate, leaks: xstrdup+xmalloc_read
345 syslogd - daemon
346 tac - noexec. runner
347 tail - runner
348 tar - runner
349 taskset - spawner
350 tcpsvd - daemon
351 tee - runner
352 telnet - interactive, longterm
353 telnetd - daemon
354 test - NOFORK
355 tftp - runner
356 tftpd - daemon
357 time - spawner, changes state (signals)
358 timeout - spawner, changes state (signals)
359 top - interactive, longterm
360 touch - NOFORK
361 tr - runner
362 traceroute - suid, runner
363 traceroute6 - suid, runner
364 true - NOFORK
365 truncate - NOFORK
366 tty - NOFORK
367 ttysize - NOFORK
368 tunctl
369 tune2fs - leaks: open+xfunc
370 ubiattach
371 ubidetach
372 ubimkvol
373 ubirename
374 ubirmvol
375 ubirsvol
376 ubiupdatevol
377 udhcpc - daemon
378 udhcpd - daemon
379 udpsvd - daemon
380 uevent - daemon
381 umount
382 uname - NOFORK
383 uncompress - runner
384 unexpand - runner
385 uniq - runner
386 unix2dos - noexec. runner
387 unlink - NOFORK
388 unlzma - runner
389 unlzop - runner
390 unxz - runner
391 unzip - runner
392 uptime - nofork candidate(is getutxent ok?)
393 users - nofork candidate(is getutxent ok?)
394 usleep - NOFORK
395 uudecode - runner
396 uuencode - runner
397 vconfig - leaks: xsocket+ioctl_or_perror_and_die
398 vi - interactive, longterm
399 vlock - suid
400 volname - runner
401 w
402 wall - suid
403 watch - longterm
404 watchdog - daemon
405 wc - runner
406 wget - longterm
407 which - NOFORK
408 who
409 whoami - NOFORK
410 whois
411 xargs - noexec. spawner
412 xxd - noexec. runner
413 xz - runner
414 xzcat - runner
415 yes - noexec. runner
416 zcat - runner
417 zcip - daemon