blob: 3070a321b86e7eafdec1c806b035f45b223b9813 [file] [log] [blame]
Denys Vlasenko819b47a2017-08-03 03:29:32 +02001Why an applet can't be NOFORK or NOEXEC?
2
3Why can't be NOFORK:
Denys Vlasenko819b47a2017-08-03 03:29:32 +02004interactive: may wait for user input, ^C has to work
Denys Vlasenko7f9d62d2017-08-04 16:01:39 +02005spawner: "tool PROG ARGS" which changes program state and execs - must fork
Denys Vlasenko819b47a2017-08-03 03:29:32 +02006changes state: e.g. environment, signal handlers
Denys Vlasenko7f9d62d2017-08-04 16:01:39 +02007leaks: does not free allocated memory or opened fds
Denys Vlasenko1a1203f2017-08-07 16:47:34 +02008 alloc+xfunc: xmalloc, then xfunc - leaks memory if xfunc dies
9 open+xfunc: opens fd, then calls xfunc - fd is leaked if xfunc dies
Denys Vlasenko90ad4ba2017-08-08 00:42:15 +020010talks to network/serial/etc: it's not known how long the delay can be,
11 it's reasonable to expect it might be many seconds
12 (even if usually it is not), so ^C has to work
Denys Vlasenko39194f02017-08-03 19:00:01 +020013runner: sometimes may run for long(ish) time, and/or works with network:
Denys Vlasenko819b47a2017-08-03 03:29:32 +020014 ^C has to work (cat BIGFILE, chmod -R, ftpget, nc)
15
Denys Vlasenko7f9d62d2017-08-04 16:01:39 +020016"runners" can become eligible after shell is taught ^C to interrupt NOFORKs,
Denys Vlasenko74c05f52017-08-04 17:36:16 +020017need to be inspected that they do not fall into alloc+xfunc, open+xfunc,
18leak categories.
Denys Vlasenko819b47a2017-08-03 03:29:32 +020019
20Why can't be NOEXEC:
21suid: runs under different uid - must fork+exec
Denys Vlasenko248a67f2017-08-07 18:18:09 +020022if it's important that /proc/PID/cmdline and comm are correct.
23 ("pkill sh" killing itself before it kills real "sh" is no fun)
Denys Vlasenko819b47a2017-08-03 03:29:32 +020024
25Why shouldn't be NOFORK/NOEXEC:
Denys Vlasenko7f9d62d2017-08-04 16:01:39 +020026rare: not started often enough to bother optimizing (example: poweroff)
27daemon: runs indefinitely; these are also always fit "rare" category
Denys Vlasenko5c527dc2017-08-04 19:55:01 +020028longterm: often runs for a long time (many seconds), execing makes
Denys Vlasenko39194f02017-08-03 19:00:01 +020029 memory footprint smaller
Denys Vlasenko7f9d62d2017-08-04 16:01:39 +020030complex: no immediately obvious reason why NOFORK wouldn't work,
Denys Vlasenko74c05f52017-08-04 17:36:16 +020031 but does some non-obvoius operations (example: fuser, lsof, losetup);
32 detailed audit often turns out that it's a leaker
Denys Vlasenko1a1203f2017-08-07 16:47:34 +020033hardware: performs unusual hardware ops which may take long,
34 or even hang due to hardware or firmware bugs
Denys Vlasenko74c05f52017-08-04 17:36:16 +020035
36Interesting example of "interactive" applet which is nevertheless can be
37(and is) NOEXEC is "rm". Yes, "rm -i" is interactive - but it's not that typical
38for users to keep it waiting for many minutes, whereas running "rm" in shell
39is very typical, and speeding up this common use via NOEXEC is useful.
40IOW: rm is "interactive", but not "longterm".
41
Denys Vlasenko3bc23172017-08-09 19:51:17 +020042Interesting example of an applet which can be NOFORK but if not,
43then should not be NOEXEC, is "usleep". As NOFORK, it amount to simply
44nanosleep()ing in the calling program (usually shell). No memory wasted.
45But if ran as NOEXEC, it would create a potentially long-term process,
46which would be taking more memory because it did not exec
47and did not free much of the copied memory of the parent
48(COW helps with this only as long as parent doesn't modify its memory).
49
Denys Vlasenko819b47a2017-08-03 03:29:32 +020050
51[ - NOFORK
52[[ - NOFORK
53acpid - daemon
Denys Vlasenko7b8372b2017-08-07 00:28:15 +020054add-shell - noexec. leaks: open+xfunc
55addgroup - noexec. leaks
56adduser - noexec. leaks
Denys Vlasenkoed7d1182017-08-06 20:00:21 +020057adjtimex - NOFORK
Denys Vlasenko819b47a2017-08-03 03:29:32 +020058ar - runner
59arch - NOFORK
Denys Vlasenko90ad4ba2017-08-08 00:42:15 +020060arp - talks to network: arp -n queries DNS
Denys Vlasenko1a1203f2017-08-07 16:47:34 +020061arping - longterm
Denys Vlasenko74c05f52017-08-04 17:36:16 +020062ash - interactive, longterm
Denys Vlasenko39194f02017-08-03 19:00:01 +020063awk - noexec. runner
Denys Vlasenko819b47a2017-08-03 03:29:32 +020064base64 - runner
65basename - NOFORK
Denys Vlasenko035e7152017-08-06 20:39:27 +020066beep - longterm: beep -r 999999999
Denys Vlasenko277081e2017-08-06 20:20:47 +020067blkdiscard - noexec. leaks: open+xioctl
Denys Vlasenkobf182392017-08-06 20:16:28 +020068blkid - noexec
Denys Vlasenko9f598492017-08-05 01:29:12 +020069blockdev - noexec. leaks fd
Denys Vlasenko819b47a2017-08-03 03:29:32 +020070bootchartd - daemon
Denys Vlasenko86e07f62017-08-06 20:14:02 +020071brctl - noexec
Denys Vlasenko819b47a2017-08-03 03:29:32 +020072bunzip2 - runner
Denys Vlasenko819b47a2017-08-03 03:29:32 +020073bzcat - runner
74bzip2 - runner
Denys Vlasenko39194f02017-08-03 19:00:01 +020075cal - runner: cal -n9999
Denys Vlasenko90ad4ba2017-08-08 00:42:15 +020076cat - runner: cat HUGEFILE
77chat - longterm (when used as intended - talking to modem over stdin/out)
Denys Vlasenko99125c02017-08-05 20:38:04 +020078chattr - noexec. runner
Denys Vlasenko39194f02017-08-03 19:00:01 +020079chgrp - noexec. runner
80chmod - noexec. runner
81chown - noexec. runner
Denys Vlasenko90ad4ba2017-08-08 00:42:15 +020082chpasswd - longterm? (list of "user:password"s from stdin)
Denys Vlasenko5c527dc2017-08-04 19:55:01 +020083chpst - noexec. spawner
84chroot - noexec. spawner
85chrt - noexec. spawner
Denys Vlasenkoff53bee2017-08-05 02:02:31 +020086chvt - noexec. leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds
Denys Vlasenko39194f02017-08-03 19:00:01 +020087cksum - noexec. runner
Denys Vlasenko819b47a2017-08-03 03:29:32 +020088clear - NOFORK
89cmp - runner
90comm - runner
Denys Vlasenko83d77852017-08-04 17:59:46 +020091conspy - interactive, longterm
Denys Vlasenko39194f02017-08-03 19:00:01 +020092cp - noexec. runner
Denys Vlasenko819b47a2017-08-03 03:29:32 +020093cpio - runner
94crond - daemon
Denys Vlasenko22627462017-08-06 17:14:09 +020095crontab - longterm (runs $EDITOR), leaks: open+xasprintf
Denys Vlasenkofeb79e82017-08-05 02:08:23 +020096cryptpw - noexec. changes state: with --password-fd=N, moves N to stdin
Denys Vlasenko5c527dc2017-08-04 19:55:01 +020097cttyhack - noexec. spawner
Denys Vlasenko39194f02017-08-03 19:00:01 +020098cut - noexec. runner
99date - noexec. nofork candidate(needs to stop messing up env, free xasprintf result, not use xfuncs after xasprintf)
Denys Vlasenkodbbc3f22017-08-07 23:30:22 +0200100dc - longterm (eats stdin if no params)
Denys Vlasenko39194f02017-08-03 19:00:01 +0200101dd - noexec. runner
Denys Vlasenkoff53bee2017-08-05 02:02:31 +0200102deallocvt - noexec. leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds
Denys Vlasenko7b8372b2017-08-07 00:28:15 +0200103delgroup - noexec. leaks
104deluser - noexec. leaks
Denys Vlasenko1a1203f2017-08-07 16:47:34 +0200105depmod - longterm(ish)
Denys Vlasenkofc9efcb2017-08-07 22:19:17 +0200106devmem - hardware (access to device memory may hang)
107df - noexec. leaks: nested allocs
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200108dhcprelay - daemon
109diff - runner
110dirname - NOFORK
Denys Vlasenko39194f02017-08-03 19:00:01 +0200111dmesg - runner
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200112dnsd - daemon
Denys Vlasenko90ad4ba2017-08-08 00:42:15 +0200113dnsdomainname - noexec. talks to network (may query DNS)
Denys Vlasenko39194f02017-08-03 19:00:01 +0200114dos2unix - noexec. runner
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200115dpkg - runner
Denys Vlasenko39194f02017-08-03 19:00:01 +0200116du - runner
Denys Vlasenkoff53bee2017-08-05 02:02:31 +0200117dumpkmap - noexec. leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds
Denys Vlasenkodbbc3f22017-08-07 23:30:22 +0200118dumpleases - noexec. leaks: open+xread
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200119echo - NOFORK
Denys Vlasenko74c05f52017-08-04 17:36:16 +0200120ed - interactive, longterm
121egrep - longterm runner ("CMD | egrep ..." may run indefinitely, better to exec to conserve memory)
Denys Vlasenkoaf5d0082017-08-07 23:23:18 +0200122eject - hardware, leaks: open+ioctl_or_perror_and_die, changes state (moves fds)
Denys Vlasenko83d77852017-08-04 17:59:46 +0200123env - noexec. spawner, changes state (env)
Denys Vlasenko5c527dc2017-08-04 19:55:01 +0200124envdir - noexec. spawner
125envuidgid - noexec. spawner
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200126expand - runner
Denys Vlasenkoaf5d0082017-08-07 23:23:18 +0200127expr - noexec. leaks: nested allocs
Denys Vlasenkodbbc3f22017-08-07 23:30:22 +0200128factor - longterm (eats stdin if no params)
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200129fakeidentd - daemon
130false - NOFORK
Denys Vlasenko354b1042017-08-07 22:21:54 +0200131fatattr - noexec. leaks: open+xioctl, complex
Denys Vlasenko1a1203f2017-08-07 16:47:34 +0200132fbset - hardware, leaks: open+xfunc
Denys Vlasenko74c05f52017-08-04 17:36:16 +0200133fbsplash - runner, longterm
Denys Vlasenko1a1203f2017-08-07 16:47:34 +0200134fdflush - hardware, leaks: open+ioctl_or_perror_and_die
Denys Vlasenko8858a982017-08-08 01:21:49 +0200135fdformat - hardware, longterm
Denys Vlasenko74c05f52017-08-04 17:36:16 +0200136fdisk - interactive, longterm
Denys Vlasenkoff53bee2017-08-05 02:02:31 +0200137fgconsole - noexec. leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds
Denys Vlasenko74c05f52017-08-04 17:36:16 +0200138fgrep - longterm runner ("CMD | fgrep ..." may run indefinitely, better to exec to conserve memory)
Denys Vlasenko39194f02017-08-03 19:00:01 +0200139find - noexec. runner
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200140findfs - suid
Denys Vlasenko1a1203f2017-08-07 16:47:34 +0200141flash_eraseall - hardware
142flash_lock - hardware
143flash_unlock - hardware
144flashcp - hardware
Denys Vlasenko5c527dc2017-08-04 19:55:01 +0200145flock - spawner, changes state (file locks), let's play safe and not be noexec
Denys Vlasenko39194f02017-08-03 19:00:01 +0200146fold - noexec. runner
Denys Vlasenko248a67f2017-08-07 18:18:09 +0200147free - noexec. nofork candidate(struct globals, needs to close /proc/meminfo fd)
Denys Vlasenkoec98e3a2017-08-07 23:17:14 +0200148freeramdisk - noexec. leaks: open+ioctl_or_perror_and_die
Denys Vlasenko74c05f52017-08-04 17:36:16 +0200149fsck - interactive, longterm
Denys Vlasenko65147852017-08-04 19:16:01 +0200150fsck.minix - needs ^C
Denys Vlasenko9f598492017-08-05 01:29:12 +0200151fsfreeze - noexec. leaks: open+xioctl
152fstrim - noexec. leaks: open+xioctl, find_block_device -> readdir+xstrdup
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200153fsync - NOFORK
154ftpd - daemon
155ftpget - runner
156ftpput - runner
157fuser - complex
Denys Vlasenko83d77852017-08-04 17:59:46 +0200158getopt - noexec. leaks: many allocs
Denys Vlasenko74c05f52017-08-04 17:36:16 +0200159getty - interactive, longterm
160grep - longterm runner ("CMD | grep ..." may run indefinitely, better to exec to conserve memory)
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200161groups - noexec
162gunzip - runner
163gzip - runner
164halt - rare
Denys Vlasenko39194f02017-08-03 19:00:01 +0200165hd - noexec. runner
Denys Vlasenko1a1203f2017-08-07 16:47:34 +0200166hdparm - hardware
Denys Vlasenko39194f02017-08-03 19:00:01 +0200167head - noexec. runner
168hexdump - noexec. runner
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200169hostid - NOFORK
Denys Vlasenko90ad4ba2017-08-08 00:42:15 +0200170hostname - noexec. talks to network (hostname -d may query DNS)
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200171httpd - daemon
Denys Vlasenko74c05f52017-08-04 17:36:16 +0200172hush - interactive, longterm
Denys Vlasenko1a1203f2017-08-07 16:47:34 +0200173hwclock - hardware (xioctl(RTC_RD_TIME))
174i2cdetect - hardware
175i2cdump - hardware
176i2cget - hardware
177i2cset - hardware
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200178id - noexec
Denys Vlasenkoae844182017-08-07 23:14:49 +0200179ifconfig - hardware? (mem_start NN io_addr NN irq NN), leaks: xsocket+ioctl_or_perror_and_die
180ifenslave - noexec. leaks: xsocket+bb_perror_msg_and_die
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200181ifplugd - daemon
182inetd - daemon
183init - daemon
184inotifyd - daemon
Denys Vlasenko3346b4a2017-08-04 02:56:39 +0200185insmod - noexec
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200186install - runner
Denys Vlasenko5c527dc2017-08-04 19:55:01 +0200187ionice - noexec. spawner
Denys Vlasenko248a67f2017-08-07 18:18:09 +0200188iostat - longterm: "iostat 1" runs indefinitely
Denys Vlasenko72d725d2017-08-03 19:30:21 +0200189ip - noexec candidate
190ipaddr - noexec candidate
Denys Vlasenko90ad4ba2017-08-08 00:42:15 +0200191ipcalc - noexec. ipcalc -h talks to network
Denys Vlasenko3bc23172017-08-09 19:51:17 +0200192ipcrm - noexec
193ipcs - noexec
Denys Vlasenko72d725d2017-08-03 19:30:21 +0200194iplink - noexec candidate
195ipneigh - noexec candidate
196iproute - noexec candidate
197iprule - noexec candidate
198iptunnel - noexec candidate
Denys Vlasenko9a58cc02017-08-06 12:28:00 +0200199kbd_mode - noexec. leaks: xopen_nonblocking+xioctl
Denys Vlasenko39194f02017-08-03 19:00:01 +0200200kill - NOFORK
201killall - NOFORK
202killall5 - NOFORK
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200203klogd - daemon
Denys Vlasenko39194f02017-08-03 19:00:01 +0200204last - runner (I've got 1300 lines of output when tried it)
Denys Vlasenko74c05f52017-08-04 17:36:16 +0200205less - interactive, longterm
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200206link - NOFORK
Denys Vlasenko5c527dc2017-08-04 19:55:01 +0200207linux32 - noexec. spawner
208linux64 - noexec. spawner
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200209linuxrc - daemon
210ln - noexec
Denys Vlasenko1b280e42017-08-06 19:05:45 +0200211loadfont - noexec. leaks: config_open+bb_error_msg_and_die("map format")
Denys Vlasenkoff53bee2017-08-05 02:02:31 +0200212loadkmap - noexec. leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200213logger - runner
Denys Vlasenko74c05f52017-08-04 17:36:16 +0200214login - suid, interactive, longterm
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200215logname - NOFORK
Denys Vlasenkoae844182017-08-07 23:14:49 +0200216losetup - noexec. complex
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200217lpd - daemon
218lpq - runner
219lpr - runner
Denys Vlasenko39194f02017-08-03 19:00:01 +0200220ls - noexec. runner
Denys Vlasenko99125c02017-08-05 20:38:04 +0200221lsattr - noexec. runner
Denys Vlasenko3346b4a2017-08-04 02:56:39 +0200222lsmod - noexec
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200223lsof - complex
Denys Vlasenko3239ab82017-08-05 23:28:19 +0200224lspci - noexec. too rare to bother for nofork
225lsscsi - noexec. too rare to bother for nofork
226lsusb - noexec. too rare to bother for nofork
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200227lzcat - runner
228lzma - runner
229lzop - runner
230lzopcat - runner
Denys Vlasenko9536ef72017-08-06 21:47:07 +0200231makedevs - noexec
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200232makemime - runner
Denys Vlasenko74c05f52017-08-04 17:36:16 +0200233man - spawner, interactive, longterm
Denys Vlasenko39194f02017-08-03 19:00:01 +0200234md5sum - noexec. runner
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200235mdev - daemon
Denys Vlasenko65147852017-08-04 19:16:01 +0200236mesg - NOFORK
Denys Vlasenko74c05f52017-08-04 17:36:16 +0200237microcom - interactive, longterm
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200238mkdir - NOFORK
Denys Vlasenko947b2392017-08-04 18:36:55 +0200239mkdosfs - needs ^C
240mke2fs - needs ^C
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200241mkfifo - noexec
Denys Vlasenko947b2392017-08-04 18:36:55 +0200242mkfs.ext2 - needs ^C
243mkfs.minix - needs ^C
244mkfs.vfat - needs ^C
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200245mknod - noexec
Denys Vlasenkofeb79e82017-08-05 02:08:23 +0200246mkpasswd - noexec. changes state: with --password-fd=N, moves N to stdin
Denys Vlasenko947b2392017-08-04 18:36:55 +0200247mkswap - needs ^C
Denys Vlasenko6bec24c2017-08-04 17:39:05 +0200248mktemp - noexec. leaks: xstrdup+concat_path_file
Denys Vlasenko3346b4a2017-08-04 02:56:39 +0200249modinfo - noexec
250modprobe - noexec
Denys Vlasenko74c05f52017-08-04 17:36:16 +0200251more - interactive, longterm
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200252mount - suid
Denys Vlasenko9f598492017-08-05 01:29:12 +0200253mountpoint - noexec. leaks: option -n "print dev name": find_block_device -> readdir+xstrdup
Denys Vlasenkoa759b222017-08-06 14:15:24 +0200254mpstat - longterm: "mpstat 1" runs indefinitely
Denys Vlasenko1a1203f2017-08-07 16:47:34 +0200255mt - hardware
Denys Vlasenko65147852017-08-04 19:16:01 +0200256mv - noexec candidate, runner
Denys Vlasenkoa759b222017-08-06 14:15:24 +0200257nameif - noexec. openlog(), leaks: config_open2+ioctl_or_perror_and_die
Denys Vlasenkobfc66d42017-08-06 21:53:39 +0200258nbd-client - noexec
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200259nc - runner
Denys Vlasenko248a67f2017-08-07 18:18:09 +0200260netstat - longterm with -c (continuous listing)
Denys Vlasenko692eeb82017-08-04 20:07:19 +0200261nice - noexec. spawner
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200262nl - runner
Denys Vlasenko947b2392017-08-04 18:36:55 +0200263nmeter - longterm
Denys Vlasenko5c527dc2017-08-04 19:55:01 +0200264nohup - noexec. spawner
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200265nproc - NOFORK
266ntpd - daemon
267od - runner
Denys Vlasenko5c527dc2017-08-04 19:55:01 +0200268openvt - longterm: spawns a child and waits for it
Denys Vlasenko9c49d6e2017-08-05 01:46:39 +0200269partprobe - noexec. leaks: open+ioctl_or_perror_and_die(BLKRRPART)
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200270passwd - suid
Denys Vlasenko39194f02017-08-03 19:00:01 +0200271paste - noexec. runner
Denys Vlasenko947b2392017-08-04 18:36:55 +0200272patch - needs ^C
Denys Vlasenko248a67f2017-08-07 18:18:09 +0200273pgrep - must fork+exec to get correct /proc/PID/cmdline and comm field
274pidof - must fork+exec to get correct /proc/PID/cmdline and comm field
Denys Vlasenko1a1203f2017-08-07 16:47:34 +0200275ping - suid, longterm
276ping6 - suid, longterm
Denys Vlasenko65147852017-08-04 19:16:01 +0200277pipe_progress - longterm
Denys Vlasenkofdb92352017-08-05 01:51:12 +0200278pivot_root - NOFORK
Denys Vlasenko248a67f2017-08-07 18:18:09 +0200279pkill - must fork+exec to get correct /proc/PID/cmdline and comm field
Denys Vlasenko947b2392017-08-04 18:36:55 +0200280pmap - noexec candidate, leaks: open+xstrdup
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200281popmaildir - runner
282poweroff - rare
Denys Vlasenko39194f02017-08-03 19:00:01 +0200283powertop - interactive, longterm
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200284printenv - NOFORK
285printf - NOFORK
Denys Vlasenko9a6f62f2017-08-10 14:15:52 +0200286ps - noexec
287pscan - talks to network
Denys Vlasenko00c18112017-08-05 22:25:00 +0200288pstree - noexec
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200289pwd - NOFORK
Denys Vlasenko39194f02017-08-03 19:00:01 +0200290pwdx - NOFORK
Denys Vlasenkoa894a4b2017-08-06 19:08:46 +0200291raidautorun - noexec. very simple. leaks: open+xioctl
Denys Vlasenko90ad4ba2017-08-08 00:42:15 +0200292rdate - talks to network
293rdev - noexec. leaks: find_block_device -> readdir+xstrdup
Denys Vlasenko39194f02017-08-03 19:00:01 +0200294readlink - NOFORK
Denys Vlasenko9536ef72017-08-06 21:47:07 +0200295readprofile - reads /boot/System.map and /proc/profile, better to free more memory by execing?
Denys Vlasenko39194f02017-08-03 19:00:01 +0200296realpath - NOFORK
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200297reboot - rare
298reformime - runner
Denys Vlasenko7b8372b2017-08-07 00:28:15 +0200299remove-shell - noexec. leaks: open+xfunc
Denys Vlasenko1a1203f2017-08-07 16:47:34 +0200300renice - noexec. nofork candidate(uses getpwnam, is that ok?)
Denys Vlasenko692eeb82017-08-04 20:07:19 +0200301reset - noexec. spawner (execs "stty")
Denys Vlasenko39194f02017-08-03 19:00:01 +0200302resize - noexec. changes state (signal handlers)
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200303rev - runner
Denys Vlasenko39194f02017-08-03 19:00:01 +0200304rm - noexec. rm -i interactive
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200305rmdir - NOFORK
Denys Vlasenko3346b4a2017-08-04 02:56:39 +0200306rmmod - noexec
Denys Vlasenko90ad4ba2017-08-08 00:42:15 +0200307route - talks to network (may query DNS to convert IPs to names)
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200308rpm - runner
309rpm2cpio - runner
Denys Vlasenko947b2392017-08-04 18:36:55 +0200310rtcwake - longterm: puts system to sleep, optimizing this for speed is pointless
Denys Vlasenkoa894a4b2017-08-06 19:08:46 +0200311run-parts - longterm
Denys Vlasenko83d77852017-08-04 17:59:46 +0200312runlevel - noexec. can be nofork if "endutxent()" is called unconditionally, but too rare to bother?
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200313runsv - daemon
314runsvdir - daemon
315rx - runner
Denys Vlasenkodd55d5d2017-08-07 01:53:17 +0200316script - longterm: pumps script output from slave pty
317scriptreplay - longterm: plays back "script" saved output, sleeping as necessary.
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200318sed - runner
319sendmail - runner
Denys Vlasenko39194f02017-08-03 19:00:01 +0200320seq - noexec. runner
Denys Vlasenko5c527dc2017-08-04 19:55:01 +0200321setarch - noexec. spawner
Denys Vlasenko5cb907f2017-08-06 18:56:25 +0200322setconsole - noexec
Denys Vlasenko1b280e42017-08-06 19:05:45 +0200323setfont - noexec. leaks a lot of stuff
Denys Vlasenkob83db4d2017-08-06 18:29:25 +0200324setkeycodes - noexec
Denys Vlasenko341ce0a2017-08-06 18:17:58 +0200325setlogcons - noexec
Denys Vlasenko5c527dc2017-08-04 19:55:01 +0200326setpriv - spawner, changes state, let's play safe and not be noexec
Denys Vlasenko97b738d2017-08-06 18:06:46 +0200327setserial - noexec
Denys Vlasenko22627462017-08-06 17:14:09 +0200328setsid - spawner, uses fork_or_rexec() [not audited to work in noexec], let's play safe and not be noexec
Denys Vlasenko5c527dc2017-08-04 19:55:01 +0200329setuidgid - noexec. spawner
Denys Vlasenko39194f02017-08-03 19:00:01 +0200330sha1sum - noexec. runner
331sha256sum - noexec. runner
332sha3sum - noexec. runner
333sha512sum - noexec. runner
Denys Vlasenko74c05f52017-08-04 17:36:16 +0200334showkey - interactive, longterm
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200335shred - runner
Denys Vlasenko39194f02017-08-03 19:00:01 +0200336shuf - noexec. runner
Denys Vlasenko22627462017-08-06 17:14:09 +0200337slattach - longterm (may sleep forever), uses bb_common_bufsiz1
Denys Vlasenko3bc23172017-08-09 19:51:17 +0200338sleep - longterm. Could be nofork, if not the problem of "killall sleep" not killing it.
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200339smemcap - runner
Denys Vlasenko5c527dc2017-08-04 19:55:01 +0200340softlimit - noexec. spawner
Denys Vlasenko39194f02017-08-03 19:00:01 +0200341sort - noexec. runner
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200342split - runner
Denys Vlasenko947b2392017-08-04 18:36:55 +0200343ssl_client - longterm
Denys Vlasenko184c7382017-08-06 20:55:56 +0200344start-stop-daemon - not noexec: uses bb_common_bufsiz1
Denys Vlasenko248a67f2017-08-07 18:18:09 +0200345stat - noexec. nofork candidate(needs fewer allocs)
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200346strings - runner
Denys Vlasenko692eeb82017-08-04 20:07:19 +0200347stty - 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
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200348su - suid, spawner
Denys Vlasenko5c527dc2017-08-04 19:55:01 +0200349sulogin - noexec. spawner
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200350sum - runner
Denys Vlasenkoa453ca52017-08-05 01:42:08 +0200351sv - noexec. needs ^C (uses usleep(420000))
352svc - noexec. needs ^C (uses usleep(420000))
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200353svlogd - daemon
Denys Vlasenko248a67f2017-08-07 18:18:09 +0200354swapoff - longterm: may cause memory pressure, execing is beneficial
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200355swapon - rare
Denys Vlasenko5c527dc2017-08-04 19:55:01 +0200356switch_root - spawner, rare, changes state (oh yes), execing may be important to free binary's inode
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200357sync - NOFORK
Denys Vlasenkocaf26b32017-08-05 18:23:10 +0200358sysctl - noexec. leaks: xstrdup+xmalloc_read
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200359syslogd - daemon
Denys Vlasenko39194f02017-08-03 19:00:01 +0200360tac - noexec. runner
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200361tail - runner
362tar - runner
Denys Vlasenko5c527dc2017-08-04 19:55:01 +0200363taskset - noexec. spawner
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200364tcpsvd - daemon
365tee - runner
Denys Vlasenko74c05f52017-08-04 17:36:16 +0200366telnet - interactive, longterm
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200367telnetd - daemon
368test - NOFORK
369tftp - runner
370tftpd - daemon
Denys Vlasenko5c527dc2017-08-04 19:55:01 +0200371time - spawner, longterm, changes state (signals)
372timeout - spawner, longterm, changes state (signals)
Denys Vlasenko39194f02017-08-03 19:00:01 +0200373top - interactive, longterm
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200374touch - NOFORK
375tr - runner
Denys Vlasenko1a1203f2017-08-07 16:47:34 +0200376traceroute - suid, longterm
377traceroute6 - suid, longterm
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200378true - NOFORK
379truncate - NOFORK
380tty - NOFORK
Denys Vlasenko39194f02017-08-03 19:00:01 +0200381ttysize - NOFORK
Denys Vlasenko9a58cc02017-08-06 12:28:00 +0200382tunctl - noexec
Denys Vlasenko99125c02017-08-05 20:38:04 +0200383tune2fs - noexec. leaks: open+xfunc
Denys Vlasenko1a1203f2017-08-07 16:47:34 +0200384ubiattach - hardware
385ubidetach - hardware
386ubimkvol - hardware
387ubirename - hardware
388ubirmvol - hardware
389ubirsvol - hardware
390ubiupdatevol - hardware
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200391udhcpc - daemon
392udhcpd - daemon
393udpsvd - daemon
394uevent - daemon
Denys Vlasenko83a6c8d2017-08-05 23:21:02 +0200395umount - noexec. leaks: nested xmalloc
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200396uname - NOFORK
397uncompress - runner
398unexpand - runner
399uniq - runner
Denys Vlasenko39194f02017-08-03 19:00:01 +0200400unix2dos - noexec. runner
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200401unlink - NOFORK
402unlzma - runner
403unlzop - runner
404unxz - runner
405unzip - runner
Denys Vlasenko1a1203f2017-08-07 16:47:34 +0200406uptime - noexec. nofork candidate(is getutxent ok?)
407users - noexec. nofork candidate(is getutxent ok?)
Denys Vlasenko3bc23172017-08-09 19:51:17 +0200408usleep - NOFORK. But what about "killall usleep"?
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200409uudecode - runner
410uuencode - runner
Denys Vlasenkoa4d4ab02017-08-09 18:52:19 +0200411vconfig - noexec. leaks: xsocket+ioctl_or_perror_and_die
Denys Vlasenko74c05f52017-08-04 17:36:16 +0200412vi - interactive, longterm
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200413vlock - suid
Denys Vlasenkoae844182017-08-07 23:14:49 +0200414volname - hardware (reads CDROM, this can take long-ish if need to spin up)
Denys Vlasenko1a1203f2017-08-07 16:47:34 +0200415w - noexec. nofork candidate(is getutxent ok?)
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200416wall - suid
Denys Vlasenko83d77852017-08-04 17:59:46 +0200417watch - longterm
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200418watchdog - daemon
419wc - runner
Denys Vlasenko83d77852017-08-04 17:59:46 +0200420wget - longterm
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200421which - NOFORK
Denys Vlasenko1a1203f2017-08-07 16:47:34 +0200422who - noexec. nofork candidate(is getutxent ok?)
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200423whoami - NOFORK
Denys Vlasenko8858a982017-08-08 01:21:49 +0200424whois - talks to network
Denys Vlasenko39194f02017-08-03 19:00:01 +0200425xargs - noexec. spawner
426xxd - noexec. runner
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200427xz - runner
428xzcat - runner
Denys Vlasenko39194f02017-08-03 19:00:01 +0200429yes - noexec. runner
Denys Vlasenko819b47a2017-08-03 03:29:32 +0200430zcat - runner
431zcip - daemon