Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: overflow in libsa dosfs, feature for efiboot (patches provided)



On Tue, Jan 21, 2020 at 01:12:58PM -0800, Rob Newberry wrote:
> And the code in efi_block_probe will only identify partitions if:
> 
> 	- it's GPT (mine isn't)
> 
> 	- it's MBR (mine is) and it's a NETBSD partition type (mine isn't)

OK, have to admit the code confuses me. I'm not opposing your patch but
thought there might be a simpler way already.

> With your change AND the following change to blkbyt, I was able to get thing to work with this disk:
> 
> 	-#define blkbyt(fs, b)  ((b) << (fs)->bshift)
> 	+#define blkbyt(fs, b)  ((uint64_t)(b) << (fs)->bshift)
> 
> Does that make sense?  It's certainly a simpler set of patches to dosfs.c (though I have to swallow my angst over all the casting :-).

Yes - every time we shift a value left and calculate a byte offset, we need
to make sure the calculation is done using 64 bit values. For sector offsets
we do not do that.

Unfortunately the 64 bit arithmetic makes this code create larger binaries
and some boot blocks using this overflow (example I ran into:
sys/arch/i386/stand/bootxx/bootxx_msdos).

So it needs to be conditionalized - very ugly. I have commited that part,
let's see what other build fallout it causes, then get back to the efiboot
change.

Martin


Home | Main Index | Thread Index | Old Index