4 ms·
Debugging an Ioctl Problem on OpenBSD
- adamrt 5y agoJcs is always doing something cool. Thanks for the write up!
- CyberRabbi 5y agoIndeed. As a programmer desperate for technical edutainment to consume after work, he’s a gem.
- anthk 5y agoAs an OpenBSD and retro protocol user (gopher, irc, MUDs, and so on) JCS is amazing.
- kevin_b_er 5y agoI'm annoyed ktrace wasn't revisited. If the integer was getting truncated, why did ktrace print that the request was still VIDIOC_S_FMT? Shouldn't it have printed some goofy number that didn't match?
- tedunangst 5y agoThat is weird. I don't see an easy explanation. kdump uses unsigned long.
- deleted 5y ago[deleted]
- loeg 5y agoKdump truncates to a 32-bit value: https://github.com/openbsd/src/blob/master/usr.bin/kdump/kdump.c#L1464 https://github.com/openbsd/src/blob/master/usr.bin/kdump/kdu...
- tedunangst 5y agoOh! That's dumb. The printer correctly uses unsigned long. https://github.com/openbsd/src/blob/master/usr.bin/kdump/mkioctls#L96 https://github.com/openbsd/src/blob/master/usr.bin/kdump/mki...
- elvis70 5y agoMore people should pay attention to this OS. The source code is so clean and simple compared to Linux.
- loeg 5y agoI believe FreeBSD intentionally truncates provided ioctls to the low 32-bit space because of exactly this kind of bogus assumption in userspace: https://github.com/freebsd/freebsd-src/blob/main/sys/kern/sys_generic.c#L662-L668 https://github.com/freebsd/freebsd-src/blob/main/sys/kern/sy... It's a relatively recent change (2020). Here's the corresponding place OpenBSD doesn't do that: https://github.com/openbsd/src/blob/master/sys/kern/sys_generic.c#L424 https://github.com/openbsd/src/blob/master/sys/kern/sys_gene...