Re: [PATCH 1/5] blktrace: add zoned block commands to blk_fill_rwbs

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

 



On 7/9/25 10:55 PM, Johannes Thumshirn wrote:
On 09.07.25 17:31, Bart Van Assche wrote:
Has it been considered to add a warning statement in blk_fill_rwbs()
that verifies that blk_fill_rwbs() does not write outside the bounds of
the rwbs array? See also the RWBS_LEN definition.

$ git grep -E "#define\sRWBS_LEN"
include/trace/events/block.h:#define RWBS_LEN   9

So even if we would have

opf = (REQ_PREFLUSH | REQ_OP_ZONE_APPEND | REQ_FUA | REQ_RAHEAD |
	 REQ_SYNC | REQ_META | REQ_ATOMIC);

it'll be 8 including the trailing \0 it'll be 9.

If you look closely, REQ_OP_SECURE_ERASE already is 'DE' so no changes.

It seems like my comment was not clear enough. I am aware that the
current code does not trigger a buffer overflow. Adding a length check
would help in my opinion because:
- It would catch potential future changes of blk_fill_rwbs() that
  introduce a buffer overflow.
- It would document the length of the rwbs output buffer. Today there
  are no references to RWBS_LEN in the blk_fill_rwbs() function -
  neither in the code nor in any comments.

Thanks,

Bart.




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux