mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Suggestion for Capability Check Refinement in too_many_unix_fds()
@ 2024-01-03  3:24 孟敬姿
  0 siblings, 0 replies; only message in thread
From: 孟敬姿 @ 2024-01-03  3:24 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni; +Cc: netdev, linux-kernel

Hi!

We identified a potential refinement in the too_many_unix_fds() function. Currently CAP_SYS_ADMIN and CAP_SYS_RESOURCE are checked when the number of open files in a socket exceeds the upper limit, having either one could pass the check. We recommend revisiting the capability checks and considering to utilize CAP_SYS_RESOURCE exclusively. Here's our rationale for this suggestion:

(1) Defined Capability for Resource Limits: According to the capability manual page[1], the capability explicitly designed for bypassing system resource limits is CAP_SYS_RESOURCE(CAP_SYS_RESOURCE: allow the RLIMIT_NOFILE resource limit on the number of "in-flight" file descriptors to be bypassed).

(2) Preserving Least Privilege Principle: CAP_SYS_ADMIN check in this context may lead to over-privileging. It is already overloaded and known as the new "root"[2]. According to the manual page[1] “Don't choose CAP_SYS_ADMIN if you can possibly avoid it!”, it's beneficial to use the most specific capability required for a given task.

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

Your feedback and insights on this proposed modification would be greatly appreciated. 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  3:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-03  3:24 Suggestion for Capability Check Refinement in too_many_unix_fds() 孟敬姿

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®