obliteration icon indicating copy to clipboard operation
obliteration copied to clipboard

Figure out what to do about negative offsets when reading/writing

Open SuchAFuriousDeath opened this issue 1 year ago • 7 comments

I remember from somewhere that FreeBSD allows negative offsets for devices, but our offset field is currently an u64.

SuchAFuriousDeath avatar Apr 16 '24 09:04 SuchAFuriousDeath

Strange. I though FreeBSD is going to ignore the offset instead of using its negative value.

ultimaweapon avatar Apr 16 '24 09:04 ultimaweapon

Ignore it where?

SuchAFuriousDeath avatar Apr 16 '24 09:04 SuchAFuriousDeath

I don't know. It just my guess because a read/write to a device should not requires an offset.

ultimaweapon avatar Apr 16 '24 10:04 ultimaweapon

I'm not saying it requires an offset. But the uio struct contains an offset field and in pwritev FreeBSD allows negative offsets (and we do too) image

SuchAFuriousDeath avatar Apr 16 '24 10:04 SuchAFuriousDeath

I'm not saying it requires an offset. But the uio struct contains an offset field and in pwritev FreeBSD allows negative offsets (and we do too) image

The real purpose of this code should be not allowed a negative offset for non-device. What I suspect it FreeBSD will ignore the offset when reading or writing a device.

ultimaweapon avatar Apr 16 '24 10:04 ultimaweapon

Sure, but how does that relate to this issue? :D You left a todo!() in the code and we have to deal with it somehow.

SuchAFuriousDeath avatar Apr 16 '24 10:04 SuchAFuriousDeath

What we need to do is find a device that use this offset when reading or writing. If none of the devices used it we can remove it from the parameters.

ultimaweapon avatar Apr 16 '24 10:04 ultimaweapon