These offer at least rudimentary coverage of TIOCSTI, ensuring that it
basically works and does what it's described to do and throws errors for
unprivileged use that is supposed to be blocked.
Details
- Reviewers
emaste kib markj - Commits
- rGd094dd9071ce: tests: kern: add some tests for TIOCSTI
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
tests/sys/kern/tty/test_sti.c | ||
---|---|---|
38 | ||
167 | ||
179 | why not memcmp? | |
197 | ||
219 | again memcmp? | |
338 | Did you considered having a shared mapping from where the parent would pass the data to child? You would still need a sync to reliably get the data consistent, but at least setup would not require the testing element to participate as the data channel. I do not insist on the design change. It only looks un-natural to me. |
tests/sys/kern/tty/test_sti.c | ||
---|---|---|
338 | I hadn't thoroughly considered alternatives here, no- I can rewrite it to use a shared mapping. What I would've really liked was a way to just reopen the underlying file for STDIN_FILENO with different access rights, but I didn't want to introduce a dependency on fdescfs (and looking at that path, it doesn't look like you could reopen it with different rights anyways). |
tests/sys/kern/tty/test_sti.c | ||
---|---|---|
338 | Hm, are you suggesting that adding O_PATH support to dup3(2) is useful? |
tests/sys/kern/tty/test_sti.c | ||
---|---|---|
338 | Not quite, I don't think, because I still need ioctl(2) support and there's no way to get from an O_PATH fd back to a tty that's been downgraded to read or write only. What would have been nice is if openat(2) could take a non-dirfd as long as the path is "." to open a new file for the underlying vnode, but I don't think I could get agreement on that kind of thing. |
tests/sys/kern/tty/test_sti.c | ||
---|---|---|
96 |
tests/sys/kern/tty/test_sti.c | ||
---|---|---|
297 | In fact, I wonder, could you please try pfd = openat(STDIN_FILENO, "", O_EMPTY_PATH | O_PATH); instead of F_DUP_OPATH. I do not see why wouldn't it work, and then F_DUP_OPATH is simply not needed. |
tests/sys/kern/tty/test_sti.c | ||
---|---|---|
297 | That works, but also it seemingly works to just open wotty/rotty directly from STDIN_FILENO with O_EMPTY_PATH. |