From: 孟敬姿 <mengjingzi@iie.ac.cn>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Suggestion for Capability Check Refinement in too_many_unix_fds()
Date: Wed, 3 Jan 2024 11:24:19 +0800 (GMT+08:00) [thread overview]
Message-ID: <490cec47.ca8f.18ccd59bda2.Coremail.mengjingzi@iie.ac.cn> (raw)
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/
reply other threads:[~2024-01-03 3:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=490cec47.ca8f.18ccd59bda2.Coremail.mengjingzi@iie.ac.cn \
--to=mengjingzi@iie.ac.cn \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®