HomeFreeBSD

loader: F_READ/F_WRITE should be checked against masked flag
AuditedrS317097

Description

loader: F_READ/F_WRITE should be checked against masked flag

The work to make it possible to avoid bcache via using F_NORA modifier did
miss the fact that not all loader platforms are using the bcache, and so
it is possible the modifier is not cleared, as bcache strategy function is
not used.

For fix, we make sure the checks are dont with masked flag.

This patch does fix boot for platforms which do not use bcache.

Reported by: emaste
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D10422

Event Timeline

allanjude added a subscriber: allanjude.
allanjude added inline comments.
/head/sys/boot/efi/libefi/efipart.c
910

Is this assumption that 'blk' (the LBA) will be in 512 byte blocks always correct? even for 4Kn devices?

Should it be blkio->Media->BlockSize rather than 512?

This commit now has outstanding concerns.Jul 1 2017, 4:05 PM
tsoome added inline comments.
/head/sys/boot/efi/libefi/efipart.c
910

The "device" IO is always 512B blocks due to btodb() used in libstand/read.c - which is why we are getting back to bytes and then using media block size.

All concerns with this commit have now been addressed.Jul 1 2017, 8:04 PM