Suggestion for the capability check in aac_send_raw_srb()

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

 



Hi!

We noticed a potential refinement in the aac_send_raw_srb() function, the CAP_SYS_ADMIN is checked at the beginning of the function and we believe it is better to use CAP_SYS_RAWIO instead. Here are the reasons for this recommendation:

(1) Purpose of Capability Check: The error message when CAP_SYS_ADMIN check fails indicates that the capability check is intended to protect the subsequent send operations, including acc_hba_send() and acc_fib_send(). Given that these functions are used for sending SCSI commands, the more appropriate capability, as per the capability manual page[1], is CAP_SYS_RAWIO ("perform various SCSI device commands").

(2) Consistency with Address Mapping: The function aac_send_raw_srb() also calls dma_map_single() for address mapping. In a similar context in drivers/scsi/hpsa.c, the mapping function is protected by CAP_SYS_RAWIO. Consistency in the use of capabilities enhances code clarity and maintains a standardized approach.

(3) Maintaining Least Privilege: CAP_SYS_ASMIN is already overloaded and known as the new "root"[2], and according to the manual page[1] “don't choose CAP_SYS_ADMIN if you can possibly avoid it”,  we believe that utilizing the more specific CAP_SYS_RAWIO is in line with the principle of least privilege and contributes to a more secure codebase.

This issue exists in several kernel versions and we have checked it on the latest stable release(Linux 6.6.9)

We would appreciate your insights and feedback on this proposal. Thank you for your time and consideration.

Best regards,
Jingzi

reference:
[1] https://www.man7.org/linux/man-pages/man7/capabilities.7.html
[2] https://lwn.net/Articles/486306/




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux