2017-08-03 06:59:32 +05:30
|
|
|
Why an applet can't be NOFORK or NOEXEC?
|
|
|
|
|
|
|
|
Why can't be NOFORK:
|
|
|
|
interactive: may wait for user input, ^C has to work
|
|
|
|
spawner: "tool PROG ARGS" which changes program's environment - must fork
|
|
|
|
changes state: e.g. environment, signal handlers
|
2017-08-04 17:58:16 +05:30
|
|
|
alloc+xfunc: xmalloc, then xfunc - leaks memory if xfunc dies
|
|
|
|
open+xfunc: opens fd, then calls xfunc - fd is leaked if xfunc dies
|
2017-08-03 22:30:01 +05:30
|
|
|
runner: sometimes may run for long(ish) time, and/or works with network:
|
2017-08-03 06:59:32 +05:30
|
|
|
^C has to work (cat BIGFILE, chmod -R, ftpget, nc)
|
|
|
|
|
2017-08-04 17:58:16 +05:30
|
|
|
"runners" can become eligible after shell is taught ^C to interrupt NOFORKs!
|
2017-08-03 06:59:32 +05:30
|
|
|
|
|
|
|
Why can't be NOEXEC:
|
|
|
|
suid: runs under different uid - must fork+exec
|
|
|
|
|
|
|
|
Why shouldn't be NOFORK/NOEXEC:
|
|
|
|
complex: no immediately obvious reason why NOFORK wouldn't work,
|
2017-08-03 22:30:01 +05:30
|
|
|
but does some non-obvoius operations (example: fuser, lsof, losetup);
|
|
|
|
nested xmallocs (typical in complex code) is a problem for NOFORK
|
2017-08-03 06:59:32 +05:30
|
|
|
rare: not used often enough to bother optimizing (example: poweroff)
|
2017-08-03 22:30:01 +05:30
|
|
|
longterm: often runs for a long time (many seconds), execing would make
|
|
|
|
memory footprint smaller
|
|
|
|
daemon: runs indefinitely
|
2017-08-03 06:59:32 +05:30
|
|
|
|
|
|
|
[ - NOFORK
|
|
|
|
[[ - NOFORK
|
|
|
|
acpid - daemon
|
|
|
|
add-shell
|
|
|
|
addgroup
|
|
|
|
adduser
|
|
|
|
adjtimex
|
|
|
|
ar - runner
|
|
|
|
arch - NOFORK
|
|
|
|
arp
|
|
|
|
arping - runner
|
|
|
|
ash - interactive
|
2017-08-03 22:30:01 +05:30
|
|
|
awk - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
base64 - runner
|
|
|
|
basename - NOFORK
|
|
|
|
beep
|
|
|
|
blkdiscard
|
|
|
|
blkid
|
|
|
|
blockdev
|
|
|
|
bootchartd - daemon
|
|
|
|
brctl
|
|
|
|
bunzip2 - runner
|
|
|
|
busybox
|
|
|
|
bzcat - runner
|
|
|
|
bzip2 - runner
|
2017-08-03 22:30:01 +05:30
|
|
|
cal - runner: cal -n9999
|
2017-08-03 06:59:32 +05:30
|
|
|
cat - runner
|
|
|
|
chat
|
|
|
|
chattr - runner
|
2017-08-03 22:30:01 +05:30
|
|
|
chgrp - noexec. runner
|
|
|
|
chmod - noexec. runner
|
|
|
|
chown - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
chpasswd - runner (list of "user:password"s from stdin)
|
|
|
|
chpst - spawner
|
|
|
|
chroot - spawner
|
|
|
|
chrt - spawner
|
|
|
|
chvt
|
2017-08-03 22:30:01 +05:30
|
|
|
cksum - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
clear - NOFORK
|
|
|
|
cmp - runner
|
|
|
|
comm - runner
|
|
|
|
conspy - interactive
|
2017-08-03 22:30:01 +05:30
|
|
|
cp - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
cpio - runner
|
|
|
|
crond - daemon
|
|
|
|
crontab
|
|
|
|
cryptpw
|
|
|
|
cttyhack - spawner
|
2017-08-03 22:30:01 +05:30
|
|
|
cut - noexec. runner
|
|
|
|
date - noexec. nofork candidate(needs to stop messing up env, free xasprintf result, not use xfuncs after xasprintf)
|
2017-08-03 06:59:32 +05:30
|
|
|
dc - runner (eats stdin if no params)
|
2017-08-03 22:30:01 +05:30
|
|
|
dd - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
deallocvt
|
|
|
|
delgroup
|
|
|
|
deluser
|
|
|
|
depmod
|
2017-08-03 22:30:01 +05:30
|
|
|
devmem - runner, complex (access to device memory may hang)
|
|
|
|
df - complex (nested allocs)
|
2017-08-03 06:59:32 +05:30
|
|
|
dhcprelay - daemon
|
|
|
|
diff - runner
|
|
|
|
dirname - NOFORK
|
2017-08-03 22:30:01 +05:30
|
|
|
dmesg - runner
|
2017-08-03 06:59:32 +05:30
|
|
|
dnsd - daemon
|
2017-08-03 22:30:01 +05:30
|
|
|
dnsdomainname - DNS resolution may trigger, need ^C
|
|
|
|
dos2unix - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
dpkg - runner
|
2017-08-03 22:30:01 +05:30
|
|
|
du - runner
|
2017-08-03 06:59:32 +05:30
|
|
|
dumpkmap
|
|
|
|
dumpleases
|
|
|
|
echo - NOFORK
|
|
|
|
ed - interactive
|
|
|
|
egrep - runner
|
|
|
|
eject
|
2017-08-03 22:30:01 +05:30
|
|
|
env - noexec. changes state (env)
|
2017-08-03 06:59:32 +05:30
|
|
|
envdir - spawner
|
|
|
|
envuidgid - spawner
|
|
|
|
expand - runner
|
2017-08-03 22:30:01 +05:30
|
|
|
expr - complex (nested allocs)
|
2017-08-03 06:59:32 +05:30
|
|
|
factor - runner (eats stdin if no params)
|
|
|
|
fakeidentd - daemon
|
|
|
|
false - NOFORK
|
2017-08-03 22:30:01 +05:30
|
|
|
fatattr - complex (xopen+xioctl can leak fd)
|
2017-08-03 06:59:32 +05:30
|
|
|
fbset
|
|
|
|
fbsplash - runner, interactive
|
|
|
|
fdflush
|
|
|
|
fdformat - runner
|
|
|
|
fdisk - interactive
|
|
|
|
fgconsole
|
|
|
|
fgrep - runner
|
2017-08-03 22:30:01 +05:30
|
|
|
find - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
findfs - suid
|
|
|
|
flash_eraseall
|
|
|
|
flash_lock
|
|
|
|
flash_unlock
|
|
|
|
flashcp
|
|
|
|
flock
|
2017-08-03 22:30:01 +05:30
|
|
|
fold - noexec. runner
|
|
|
|
free - nofork candidate(struct globals, needs to close /proc/meminfo fd)
|
2017-08-03 06:59:32 +05:30
|
|
|
freeramdisk
|
|
|
|
fsck - interactive
|
|
|
|
fsck.minix
|
|
|
|
fsfreeze
|
|
|
|
fstrim
|
|
|
|
fsync - NOFORK
|
|
|
|
ftpd - daemon
|
|
|
|
ftpget - runner
|
|
|
|
ftpput - runner
|
|
|
|
fuser - complex
|
2017-08-03 23:00:21 +05:30
|
|
|
getopt - noexec. complex (many allocs)
|
2017-08-03 06:59:32 +05:30
|
|
|
getty - interactive
|
|
|
|
grep - runner
|
|
|
|
groups - noexec
|
|
|
|
gunzip - runner
|
|
|
|
gzip - runner
|
|
|
|
halt - rare
|
2017-08-03 22:30:01 +05:30
|
|
|
hd - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
hdparm - complex, rare
|
2017-08-03 22:30:01 +05:30
|
|
|
head - noexec. runner
|
|
|
|
hexdump - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
hostid - NOFORK
|
2017-08-03 22:30:01 +05:30
|
|
|
hostname - DNS resolution may trigger, need ^C
|
2017-08-03 06:59:32 +05:30
|
|
|
httpd - daemon
|
|
|
|
hush - interactive
|
|
|
|
hwclock
|
|
|
|
i2cdetect
|
|
|
|
i2cdump
|
|
|
|
i2cget
|
|
|
|
i2cset
|
|
|
|
id - noexec
|
|
|
|
ifconfig
|
|
|
|
ifenslave
|
|
|
|
ifplugd - daemon
|
|
|
|
inetd - daemon
|
|
|
|
init - daemon
|
|
|
|
inotifyd - daemon
|
2017-08-04 06:26:39 +05:30
|
|
|
insmod - noexec
|
2017-08-03 06:59:32 +05:30
|
|
|
install - runner
|
|
|
|
ionice - spawner
|
|
|
|
iostat - runner
|
2017-08-03 23:00:21 +05:30
|
|
|
ip - noexec candidate
|
|
|
|
ipaddr - noexec candidate
|
|
|
|
ipcalc - noexec candidate
|
|
|
|
ipcrm - noexec candidate
|
|
|
|
ipcs - noexec candidate
|
|
|
|
iplink - noexec candidate
|
|
|
|
ipneigh - noexec candidate
|
|
|
|
iproute - noexec candidate
|
|
|
|
iprule - noexec candidate
|
|
|
|
iptunnel - noexec candidate
|
2017-08-03 06:59:32 +05:30
|
|
|
kbd_mode
|
2017-08-03 22:30:01 +05:30
|
|
|
kill - NOFORK
|
|
|
|
killall - NOFORK
|
|
|
|
killall5 - NOFORK
|
2017-08-03 06:59:32 +05:30
|
|
|
klogd - daemon
|
2017-08-03 22:30:01 +05:30
|
|
|
last - runner (I've got 1300 lines of output when tried it)
|
2017-08-03 06:59:32 +05:30
|
|
|
less - interactive
|
|
|
|
link - NOFORK
|
|
|
|
linux32 - spawner
|
|
|
|
linux64 - spawner
|
|
|
|
linuxrc - daemon
|
|
|
|
ln - noexec
|
|
|
|
loadfont
|
|
|
|
loadkmap
|
|
|
|
logger - runner
|
|
|
|
login - suid, interactive
|
|
|
|
logname - NOFORK
|
|
|
|
losetup - complex
|
|
|
|
lpd - daemon
|
|
|
|
lpq - runner
|
|
|
|
lpr - runner
|
2017-08-03 22:30:01 +05:30
|
|
|
ls - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
lsattr
|
2017-08-04 06:26:39 +05:30
|
|
|
lsmod - noexec
|
2017-08-03 06:59:32 +05:30
|
|
|
lsof - complex
|
|
|
|
lspci
|
|
|
|
lsscsi
|
|
|
|
lsusb
|
|
|
|
lzcat - runner
|
|
|
|
lzma - runner
|
|
|
|
lzop - runner
|
|
|
|
lzopcat - runner
|
|
|
|
makedevs
|
|
|
|
makemime - runner
|
|
|
|
man - spawner, interactive
|
2017-08-03 22:30:01 +05:30
|
|
|
md5sum - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
mdev - daemon
|
|
|
|
mesg
|
|
|
|
microcom - interactive, complex
|
|
|
|
mkdir - NOFORK
|
|
|
|
mkdosfs
|
|
|
|
mke2fs
|
|
|
|
mkfifo - noexec
|
|
|
|
mkfs.ext2
|
|
|
|
mkfs.minix
|
|
|
|
mkfs.vfat
|
|
|
|
mknod - noexec
|
|
|
|
mkpasswd
|
|
|
|
mkswap
|
|
|
|
mktemp
|
2017-08-04 06:26:39 +05:30
|
|
|
modinfo - noexec
|
|
|
|
modprobe - noexec
|
2017-08-03 06:59:32 +05:30
|
|
|
more - interactive
|
|
|
|
mount - suid
|
|
|
|
mountpoint
|
|
|
|
mpstat
|
|
|
|
mt
|
2017-08-03 22:30:01 +05:30
|
|
|
mv - runner (can be noexec?)
|
2017-08-03 06:59:32 +05:30
|
|
|
nameif
|
|
|
|
nbd-client
|
|
|
|
nc - runner
|
2017-08-03 22:30:01 +05:30
|
|
|
netstat - runner with -c
|
2017-08-03 06:59:32 +05:30
|
|
|
nice - spawner
|
|
|
|
nl - runner
|
|
|
|
nmeter - runner
|
|
|
|
nohup - spawner
|
|
|
|
nproc - NOFORK
|
|
|
|
ntpd - daemon
|
|
|
|
od - runner
|
|
|
|
openvt - spawner
|
|
|
|
partprobe
|
|
|
|
passwd - suid
|
2017-08-03 22:30:01 +05:30
|
|
|
paste - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
patch
|
2017-08-03 22:30:01 +05:30
|
|
|
pgrep - nofork candidate(xregcomp, procps_scan - are they ok?)
|
|
|
|
pidof - nofork candidate(uses find_pid_by_name, is that ok?)
|
2017-08-03 06:59:32 +05:30
|
|
|
ping - suid, runner
|
|
|
|
ping6 - suid, runner
|
|
|
|
pipe_progress
|
|
|
|
pivot_root
|
2017-08-03 22:30:01 +05:30
|
|
|
pkill - nofork candidate(xregcomp, procps_scan - are they ok?)
|
2017-08-03 06:59:32 +05:30
|
|
|
pmap
|
|
|
|
popmaildir - runner
|
|
|
|
poweroff - rare
|
2017-08-03 22:30:01 +05:30
|
|
|
powertop - interactive, longterm
|
2017-08-03 06:59:32 +05:30
|
|
|
printenv - NOFORK
|
|
|
|
printf - NOFORK
|
2017-08-03 23:00:21 +05:30
|
|
|
ps - noexec candidate
|
|
|
|
pscan - longterm
|
2017-08-03 06:59:32 +05:30
|
|
|
pstree
|
|
|
|
pwd - NOFORK
|
2017-08-03 22:30:01 +05:30
|
|
|
pwdx - NOFORK
|
2017-08-03 06:59:32 +05:30
|
|
|
raidautorun
|
|
|
|
rdate
|
|
|
|
rdev
|
2017-08-03 22:30:01 +05:30
|
|
|
readlink - NOFORK
|
2017-08-03 06:59:32 +05:30
|
|
|
readprofile
|
2017-08-03 22:30:01 +05:30
|
|
|
realpath - NOFORK
|
2017-08-03 06:59:32 +05:30
|
|
|
reboot - rare
|
|
|
|
reformime - runner
|
|
|
|
remove-shell
|
2017-08-03 22:30:01 +05:30
|
|
|
renice - nofork candidate(uses getpwnam, is that ok?)
|
2017-08-03 06:59:32 +05:30
|
|
|
reset - spawner (execs "stty")
|
2017-08-03 22:30:01 +05:30
|
|
|
resize - noexec. changes state (signal handlers)
|
2017-08-03 06:59:32 +05:30
|
|
|
rev - runner
|
2017-08-03 22:30:01 +05:30
|
|
|
rm - noexec. rm -i interactive
|
2017-08-03 06:59:32 +05:30
|
|
|
rmdir - NOFORK
|
2017-08-04 06:26:39 +05:30
|
|
|
rmmod - noexec
|
2017-08-03 06:59:32 +05:30
|
|
|
route
|
|
|
|
rpm - runner
|
|
|
|
rpm2cpio - runner
|
|
|
|
rtcwake - complex, rare
|
|
|
|
run-parts
|
|
|
|
runlevel
|
|
|
|
runsv - daemon
|
|
|
|
runsvdir - daemon
|
|
|
|
rx - runner
|
|
|
|
script
|
|
|
|
scriptreplay
|
|
|
|
sed - runner
|
|
|
|
sendmail - runner
|
2017-08-03 22:30:01 +05:30
|
|
|
seq - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
setarch - spawner
|
|
|
|
setconsole
|
|
|
|
setfont
|
|
|
|
setkeycodes
|
|
|
|
setlogcons
|
|
|
|
setpriv - spawner
|
|
|
|
setserial
|
|
|
|
setsid - spawner
|
|
|
|
setuidgid
|
|
|
|
sh - interactive
|
2017-08-03 22:30:01 +05:30
|
|
|
sha1sum - noexec. runner
|
|
|
|
sha256sum - noexec. runner
|
|
|
|
sha3sum - noexec. runner
|
|
|
|
sha512sum - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
showkey - interactive
|
|
|
|
shred - runner
|
2017-08-03 22:30:01 +05:30
|
|
|
shuf - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
slattach
|
|
|
|
sleep - runner
|
|
|
|
smemcap - runner
|
|
|
|
softlimit - spawner
|
2017-08-03 22:30:01 +05:30
|
|
|
sort - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
split - runner
|
|
|
|
ssl_client - network
|
|
|
|
start-stop-daemon
|
2017-08-03 22:30:01 +05:30
|
|
|
stat - nofork candidate(needs fewer allocs)
|
2017-08-03 06:59:32 +05:30
|
|
|
strings - runner
|
|
|
|
stty
|
|
|
|
su - suid, spawner
|
|
|
|
sulogin - spawner
|
|
|
|
sum - runner
|
|
|
|
sv
|
|
|
|
svc
|
|
|
|
svlogd - daemon
|
|
|
|
swapoff - rare
|
|
|
|
swapon - rare
|
2017-08-03 22:30:01 +05:30
|
|
|
switch_root - spawner, rare, changes state
|
2017-08-03 06:59:32 +05:30
|
|
|
sync - NOFORK
|
|
|
|
sysctl
|
|
|
|
syslogd - daemon
|
2017-08-03 22:30:01 +05:30
|
|
|
tac - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
tail - runner
|
|
|
|
tar - runner
|
|
|
|
taskset - spawner
|
|
|
|
tcpsvd - daemon
|
|
|
|
tee - runner
|
|
|
|
telnet - interactive
|
|
|
|
telnetd - daemon
|
|
|
|
test - NOFORK
|
|
|
|
tftp - runner
|
|
|
|
tftpd - daemon
|
2017-08-03 22:30:01 +05:30
|
|
|
time - spawner, changes state (signals)
|
|
|
|
timeout - spawner, changes state (signals)
|
|
|
|
top - interactive, longterm
|
2017-08-03 06:59:32 +05:30
|
|
|
touch - NOFORK
|
|
|
|
tr - runner
|
|
|
|
traceroute - suid, runner
|
|
|
|
traceroute6 - suid, runner
|
|
|
|
true - NOFORK
|
|
|
|
truncate - NOFORK
|
|
|
|
tty - NOFORK
|
2017-08-03 22:30:01 +05:30
|
|
|
ttysize - NOFORK
|
2017-08-03 06:59:32 +05:30
|
|
|
tunctl
|
|
|
|
tune2fs
|
|
|
|
ubiattach
|
|
|
|
ubidetach
|
|
|
|
ubimkvol
|
|
|
|
ubirename
|
|
|
|
ubirmvol
|
|
|
|
ubirsvol
|
|
|
|
ubiupdatevol
|
|
|
|
udhcpc - daemon
|
|
|
|
udhcpd - daemon
|
|
|
|
udpsvd - daemon
|
|
|
|
uevent - daemon
|
|
|
|
umount
|
|
|
|
uname - NOFORK
|
|
|
|
uncompress - runner
|
|
|
|
unexpand - runner
|
|
|
|
uniq - runner
|
2017-08-03 22:30:01 +05:30
|
|
|
unix2dos - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
unlink - NOFORK
|
|
|
|
unlzma - runner
|
|
|
|
unlzop - runner
|
|
|
|
unxz - runner
|
|
|
|
unzip - runner
|
2017-08-03 22:30:01 +05:30
|
|
|
uptime - nofork candidate(is getutxent ok?)
|
|
|
|
users - nofork candidate(is getutxent ok?)
|
2017-08-03 06:59:32 +05:30
|
|
|
usleep - NOFORK
|
|
|
|
uudecode - runner
|
|
|
|
uuencode - runner
|
|
|
|
vconfig
|
|
|
|
vi - interactive
|
|
|
|
vlock - suid
|
|
|
|
volname - runner
|
|
|
|
w
|
|
|
|
wall - suid
|
|
|
|
watch - runner
|
|
|
|
watchdog - daemon
|
|
|
|
wc - runner
|
|
|
|
wget - runner
|
|
|
|
which - NOFORK
|
|
|
|
who
|
|
|
|
whoami - NOFORK
|
|
|
|
whois
|
2017-08-03 22:30:01 +05:30
|
|
|
xargs - noexec. spawner
|
|
|
|
xxd - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
xz - runner
|
|
|
|
xzcat - runner
|
2017-08-03 22:30:01 +05:30
|
|
|
yes - noexec. runner
|
2017-08-03 06:59:32 +05:30
|
|
|
zcat - runner
|
|
|
|
zcip - daemon
|