linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Suggestion for the capability check in aac_send_raw_srb()
@ 2024-01-03  1:48 孟敬姿
  0 siblings, 0 replies; only message in thread
From: 孟敬姿 @ 2024-01-03  1:48 UTC (permalink / raw)
  To: aacraid, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel

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/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-03  1:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-03  1:48 Suggestion for the capability check in aac_send_raw_srb() 孟敬姿

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).