aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-08-04 19:16:01 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-08-04 19:16:01 +0200
commit6514785f95878911b3ec88e2367234df74c14cd4 (patch)
treed5212cbe1de8c0fe15cb42e0c83c00ea6d77403c
parent947b2391c07f8a11f7bd4658f77cd03172fc221a (diff)
downloadbusybox-w32-6514785f95878911b3ec88e2367234df74c14cd4.tar.gz
busybox-w32-6514785f95878911b3ec88e2367234df74c14cd4.tar.bz2
busybox-w32-6514785f95878911b3ec88e2367234df74c14cd4.zip
mesg: make in NOFORK
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--NOFORK_NOEXEC.lst48
-rw-r--r--util-linux/mesg.c9
2 files changed, 31 insertions, 26 deletions
diff --git a/NOFORK_NOEXEC.lst b/NOFORK_NOEXEC.lst
index 730f2cc3c..ccd8f0c96 100644
--- a/NOFORK_NOEXEC.lst
+++ b/NOFORK_NOEXEC.lst
@@ -51,7 +51,7 @@ basename - NOFORK
51beep 51beep
52blkdiscard 52blkdiscard
53blkid 53blkid
54blockdev 54blockdev - noexec candidate (rather simple), leaks fd
55bootchartd - daemon 55bootchartd - daemon
56brctl 56brctl
57bunzip2 - runner 57bunzip2 - runner
@@ -69,7 +69,7 @@ chpasswd - runner (list of "user:password"s from stdin)
69chpst - noexec candidate, spawner 69chpst - noexec candidate, spawner
70chroot - noexec candidate, spawner 70chroot - noexec candidate, spawner
71chrt - noexec candidate, spawner 71chrt - noexec candidate, spawner
72chvt - leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds. Also, "rare" category. Can be noexec. 72chvt - leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds. Also, "rare" category. noexec candidate.
73cksum - noexec. runner 73cksum - noexec. runner
74clear - NOFORK 74clear - NOFORK
75cmp - runner 75cmp - runner
@@ -78,14 +78,14 @@ conspy - interactive, longterm
78cp - noexec. runner 78cp - noexec. runner
79cpio - runner 79cpio - runner
80crond - daemon 80crond - daemon
81crontab 81crontab 0 leaks: open+xasprintf
82cryptpw - changes state: with --password-fd=N, moves N to stdin. Also, "rare" category. Can be noexec. 82cryptpw - changes state: with --password-fd=N, moves N to stdin. Also, "rare" category. noexec candidate.
83cttyhack - noexec candidate, spawner 83cttyhack - noexec candidate, spawner
84cut - noexec. runner 84cut - noexec. runner
85date - noexec. nofork candidate(needs to stop messing up env, free xasprintf result, not use xfuncs after xasprintf) 85date - noexec. nofork candidate(needs to stop messing up env, free xasprintf result, not use xfuncs after xasprintf)
86dc - runner (eats stdin if no params) 86dc - runner (eats stdin if no params)
87dd - noexec. runner 87dd - noexec. runner
88deallocvt - leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds. Also, "rare" category. Can be noexec. 88deallocvt - leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds. Also, "rare" category. noexec candidate.
89delgroup 89delgroup
90deluser 90deluser
91depmod - complex, rare 91depmod - complex, rare
@@ -100,8 +100,8 @@ dnsdomainname - needs ^C (may talk to DNS servers, which may be down)
100dos2unix - noexec. runner 100dos2unix - noexec. runner
101dpkg - runner 101dpkg - runner
102du - runner 102du - runner
103dumpkmap - leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds. Also, "rare" category. Can be noexec. 103dumpkmap - leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds. Also, "rare" category. noexec candidate.
104dumpleases 104dumpleases - leaks: open+xread
105echo - NOFORK 105echo - NOFORK
106ed - interactive, longterm 106ed - interactive, longterm
107egrep - longterm runner ("CMD | egrep ..." may run indefinitely, better to exec to conserve memory) 107egrep - longterm runner ("CMD | egrep ..." may run indefinitely, better to exec to conserve memory)
@@ -120,7 +120,7 @@ fbsplash - runner, longterm
120fdflush - leaks: open+ioctl_or_perror_and_die, needs ^C (floppy may be unresponsive), rare 120fdflush - leaks: open+ioctl_or_perror_and_die, needs ^C (floppy may be unresponsive), rare
121fdformat - needs ^C (floppy may be unresponsive), longterm, rare 121fdformat - needs ^C (floppy may be unresponsive), longterm, rare
122fdisk - interactive, longterm 122fdisk - interactive, longterm
123fgconsole - leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds. Also, "rare" category. Can be noexec. 123fgconsole - leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds. Also, "rare" category. noexec candidate.
124fgrep - longterm runner ("CMD | fgrep ..." may run indefinitely, better to exec to conserve memory) 124fgrep - longterm runner ("CMD | fgrep ..." may run indefinitely, better to exec to conserve memory)
125find - noexec. runner 125find - noexec. runner
126findfs - suid 126findfs - suid
@@ -133,7 +133,7 @@ fold - noexec. runner
133free - nofork candidate(struct globals, needs to close /proc/meminfo fd) 133free - nofork candidate(struct globals, needs to close /proc/meminfo fd)
134freeramdisk - leaks: open+ioctl_or_perror_and_die 134freeramdisk - leaks: open+ioctl_or_perror_and_die
135fsck - interactive, longterm 135fsck - interactive, longterm
136fsck.minix 136fsck.minix - needs ^C
137fsfreeze - noexec candidate (it's very simple), leaks: open+xioctl 137fsfreeze - noexec candidate (it's very simple), leaks: open+xioctl
138fstrim - noexec candidate (it's very simple), leaks: open+xioctl, find_block_device -> readdir+xstrdup 138fstrim - noexec candidate (it's very simple), leaks: open+xioctl, find_block_device -> readdir+xstrdup
139fsync - NOFORK 139fsync - NOFORK
@@ -162,8 +162,8 @@ i2cdump
162i2cget 162i2cget
163i2cset 163i2cset
164id - noexec 164id - noexec
165ifconfig 165ifconfig - leaks: xsocket+ioctl_or_perror_and_die
166ifenslave 166ifenslave - leaks: xsocket+bb_perror_msg_and_die
167ifplugd - daemon 167ifplugd - daemon
168inetd - daemon 168inetd - daemon
169init - daemon 169init - daemon
@@ -182,7 +182,7 @@ ipneigh - noexec candidate
182iproute - noexec candidate 182iproute - noexec candidate
183iprule - noexec candidate 183iprule - noexec candidate
184iptunnel - noexec candidate 184iptunnel - noexec candidate
185kbd_mode 185kbd_mode - leaks: xopen_nonblocking+xioctl
186kill - NOFORK 186kill - NOFORK
187killall - NOFORK 187killall - NOFORK
188killall5 - NOFORK 188killall5 - NOFORK
@@ -194,8 +194,8 @@ linux32 - spawner
194linux64 - spawner 194linux64 - spawner
195linuxrc - daemon 195linuxrc - daemon
196ln - noexec 196ln - noexec
197loadfont 197loadfont - leaks: config_open+bb_error_msg_and_die("map format")
198loadkmap - leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds. Also, "rare" category. Can be noexec. 198loadkmap - leaks: get_console_fd_or_die() may open a new fd, or return one of stdio fds. Also, "rare" category. noexec candidate.
199logger - runner 199logger - runner
200login - suid, interactive, longterm 200login - suid, interactive, longterm
201logname - NOFORK 201logname - NOFORK
@@ -219,7 +219,7 @@ makemime - runner
219man - spawner, interactive, longterm 219man - spawner, interactive, longterm
220md5sum - noexec. runner 220md5sum - noexec. runner
221mdev - daemon 221mdev - daemon
222mesg 222mesg - NOFORK
223microcom - interactive, longterm 223microcom - interactive, longterm
224mkdir - NOFORK 224mkdir - NOFORK
225mkdosfs - needs ^C 225mkdosfs - needs ^C
@@ -229,7 +229,7 @@ mkfs.ext2 - needs ^C
229mkfs.minix - needs ^C 229mkfs.minix - needs ^C
230mkfs.vfat - needs ^C 230mkfs.vfat - needs ^C
231mknod - noexec 231mknod - noexec
232mkpasswd - changes state: with --password-fd=N, moves N to stdin. Also, "rare" category. Can be noexec. 232mkpasswd - changes state: with --password-fd=N, moves N to stdin. Also, "rare" category. noexec candidate.
233mkswap - needs ^C 233mkswap - needs ^C
234mktemp - noexec. leaks: xstrdup+concat_path_file 234mktemp - noexec. leaks: xstrdup+concat_path_file
235modinfo - noexec 235modinfo - noexec
@@ -239,8 +239,8 @@ mount - suid
239mountpoint - noexec candidate, leaks: option -n "print dev name": find_block_device -> readdir+xstrdup 239mountpoint - noexec candidate, leaks: option -n "print dev name": find_block_device -> readdir+xstrdup
240mpstat - noexec candidate (it's a measuring tool, putting less load by itself is good), complex 240mpstat - noexec candidate (it's a measuring tool, putting less load by itself is good), complex
241mt - rare 241mt - rare
242mv - runner (can be noexec?) 242mv - noexec candidate, runner
243nameif 243nameif - leaks: config_open2+ioctl_or_perror_and_die
244nbd-client 244nbd-client
245nc - runner 245nc - runner
246netstat - runner with -c 246netstat - runner with -c
@@ -260,8 +260,8 @@ pgrep - nofork candidate(xregcomp, procps_scan - are they ok?)
260pidof - nofork candidate(uses find_pid_by_name, is that ok?) 260pidof - nofork candidate(uses find_pid_by_name, is that ok?)
261ping - suid, runner 261ping - suid, runner
262ping6 - suid, runner 262ping6 - suid, runner
263pipe_progress 263pipe_progress - longterm
264pivot_root 264pivot_root - nofork candidate? the code is trivial
265pkill - nofork candidate(xregcomp, procps_scan - are they ok?) 265pkill - nofork candidate(xregcomp, procps_scan - are they ok?)
266pmap - noexec candidate, leaks: open+xstrdup 266pmap - noexec candidate, leaks: open+xstrdup
267popmaildir - runner 267popmaildir - runner
@@ -378,7 +378,7 @@ udhcpc - daemon
378udhcpd - daemon 378udhcpd - daemon
379udpsvd - daemon 379udpsvd - daemon
380uevent - daemon 380uevent - daemon
381umount 381umount - noexec candidate, leaks: nested xmalloc
382uname - NOFORK 382uname - NOFORK
383uncompress - runner 383uncompress - runner
384unexpand - runner 384unexpand - runner
@@ -398,16 +398,16 @@ vconfig - leaks: xsocket+ioctl_or_perror_and_die
398vi - interactive, longterm 398vi - interactive, longterm
399vlock - suid 399vlock - suid
400volname - runner 400volname - runner
401w 401w - nofork candidate(is getutxent ok?)
402wall - suid 402wall - suid
403watch - longterm 403watch - longterm
404watchdog - daemon 404watchdog - daemon
405wc - runner 405wc - runner
406wget - longterm 406wget - longterm
407which - NOFORK 407which - NOFORK
408who 408who - nofork candidate(is getutxent ok?)
409whoami - NOFORK 409whoami - NOFORK
410whois 410whois - needs ^C
411xargs - noexec. spawner 411xargs - noexec. spawner
412xxd - noexec. runner 412xxd - noexec. runner
413xz - runner 413xz - runner
diff --git a/util-linux/mesg.c b/util-linux/mesg.c
index c4371eb24..91c05317e 100644
--- a/util-linux/mesg.c
+++ b/util-linux/mesg.c
@@ -26,7 +26,7 @@
26//config: If you set this option to N, "mesg y" will enable writing 26//config: If you set this option to N, "mesg y" will enable writing
27//config: by anybody at all. This is not recommended. 27//config: by anybody at all. This is not recommended.
28 28
29//applet:IF_MESG(APPLET(mesg, BB_DIR_USR_BIN, BB_SUID_DROP)) 29//applet:IF_MESG(APPLET_NOFORK(mesg, mesg, BB_DIR_USR_BIN, BB_SUID_DROP, mesg))
30 30
31//kbuild:lib-$(CONFIG_MESG) += mesg.o 31//kbuild:lib-$(CONFIG_MESG) += mesg.o
32 32
@@ -60,10 +60,15 @@ int mesg_main(int argc UNUSED_PARAM, char **argv)
60 bb_show_usage(); 60 bb_show_usage();
61 } 61 }
62 62
63 /* We are a NOFORK applet.
64 * (Not that it's very useful, but code is trivially NOFORK-safe).
65 * Play nice. Do not leak anything.
66 */
67
63 if (!isatty(STDIN_FILENO)) 68 if (!isatty(STDIN_FILENO))
64 bb_error_msg_and_die("not a tty"); 69 bb_error_msg_and_die("not a tty");
65 70
66 xfstat(STDIN_FILENO, &sb, "stderr"); 71 xfstat(STDIN_FILENO, &sb, "stdin");
67 if (c == 0) { 72 if (c == 0) {
68 puts((sb.st_mode & (S_IWGRP|S_IWOTH)) ? "is y" : "is n"); 73 puts((sb.st_mode & (S_IWGRP|S_IWOTH)) ? "is y" : "is n");
69 return EXIT_SUCCESS; 74 return EXIT_SUCCESS;