google / capsicum-test

Test suite for Capsicum
BSD 2-Clause "Simplified" License
46 stars 30 forks source link

Ensure that mknod(2) is called with S_IFIFO in `mode` #29

Closed ngie-eign closed 5 years ago

ngie-eign commented 5 years ago

This prevents the test from failing with a false positive, i.e., -1/EINVAL, as the file type was not specified prior to this commit. Other alternatives (use S_IFBLK, S_IFCHR) is not possible, unless executing as root, so use fifos instead (which can be done by all users.

This unbreaks the test on FreeBSD 13.0-CURRENT and fixes #15.

Signed-off-by: Enji Cooper yaneurabeya@gmail.com

ngie-eign commented 5 years ago

CC: @emaste.

emaste commented 5 years ago

Also CC @markjdb

emaste commented 5 years ago

With this change we're really testing the kern_mkfifoat special case in mknodat, but I think that's probably fine.

ngie-eign commented 5 years ago

With this change we're really testing the kern_mkfifoat special case in mknodat, but I think that's probably fine.

Testing block or character devices will require having root access, which will reduce coverage. Testing whiteout files is only really doable with unionfs, which has been unreliable for me in the past on FreeBSD and is not portable to Linux.

I think testing out fifos is a reasonable tradeoff to make to maximize coverage and is an approach that's portable to Linux as well.