mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: 孟敬姿 <mengjingzi@iie.ac.cn>
To: brauner@kernel.org
Cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org
Subject: proposal to refine capability checks when _rlimit_overlimit() is true
Date: Wed, 3 Jan 2024 11:12:28 +0800 (GMT+08:00)	[thread overview]
Message-ID: <1a8ed7bd.c96e.18ccd4ee4d1.Coremail.mengjingzi@iie.ac.cn> (raw)

Hi!

We observed a potential refinement in the kernel/fork.c line 2368. Currently, both CAP_SYS_ADMIN and CAP_SYS_RESOURCE are checked when the limit is over system limit. We suggest considering an adjustment to utilize CAP_SYS_RESOURCE exclusively. Here's our rationale for this suggestion:

(1) Defined Capability for Resource Access: According to the capability manual page[1], the capability explicitly defined for bypassing resource limits is CAP_SYS_RESOURCE. This capability is designed to provide the necessary privileges for accessing system resources without over-privileging with the broader CAP_SYS_ADMIN.

(2) Maintaining Least Privilege: CAP_SYS_ASMIN is already overloaded and known as the new "root"[2]. The use of CAP_SYS_ADMIN in this context might inadvertently over-privilege the system by providing more capabilities than necessary. And according to capability 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 insights and feedback on this proposed modification would be highly 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:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-03  3:12 孟敬姿 [this message]
2024-01-03  6:11 ` Greg KH
2024-01-03 17:30   ` Theodore Ts'o
2024-01-09 11:45     ` 孟敬姿

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=1a8ed7bd.c96e.18ccd4ee4d1.Coremail.mengjingzi@iie.ac.cn \
    --to=mengjingzi@iie.ac.cn \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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®