Hi,
stty(1) can trigger a pledge violation.
$ stty -a clocal
speed 38400 baud; 24 rows; 80 columns;
lflags: icanon isig iexten echo echoe echok echoke -echonl echoctl
-echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
-extproc -xcase
iflags: -istrip icrnl -inlcr -igncr -iuclc ixon -ixoff -ixany -imaxbel
-ignbrk -brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl -onocr -onlret -olcuc -oxtabs -onoeot
cflags: cread cs8 parenb -parodd hupcl -clocal -cstopb -crtscts -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>; eol2 = ^@;
erase = ^?; intr = ^C; kill = ^U; lnext = ^V; min = 1; quit = ^\;
reprint = ^R; start = ^Q; status = ^T; stop = ^S; susp = ^Z;
time = 0; werase = ^W;
Abort trap (core dumped)
stty(26659): syscall 54 "ioctl"
Before values are displayed, stty activates pledge(2). Then the
values cannot be modified anymore. I typed that command line by
accident, so a possible fix could be to prevent this combination.
ok?
bluhm
Index: bin/stty/stty.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/bin/stty/stty.c,v
retrieving revision 1.19
diff -u -p -r1.19 stty.c
--- bin/stty/stty.c 23 Mar 2016 14:52:42 -0000 1.19
+++ bin/stty/stty.c 22 Jul 2016 18:38:36 -0000
@@ -97,11 +97,15 @@ args: argc -= optind;
/* FALLTHROUGH */
case BSD:
case POSIX:
+ if (*argv)
+ errx(1, "either display or modify");
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
print(&i.t, &i.win, i.ldisc, fmt);
break;
case GFLAG:
+ if (*argv)
+ errx(1, "either display or modify");
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
gprint(&i.t, &i.win, i.ldisc);