Linux Security Modules development
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: Paul Moore <paul@paul-moore.com>
Cc: "Tetsuo Handa" <penguin-kernel@i-love.sakura.ne.jp>,
	"Fan Wu" <wufan@linux.microsoft.com>,
	"Mickaël Salaün" <mic@digikod.net>,
	"Mimi Zohar" <zohar@linux.ibm.com>,
	"Micah Morton" <mortonm@chromium.org>,
	"Casey Schaufler" <casey@schaufler-ca.com>,
	"John Johansen" <john.johansen@canonical.com>,
	"Roberto Sassu" <roberto.sassu@huawei.com>,
	"KP Singh" <kpsingh@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	linux-security-module@vger.kernel.org
Subject: Re: TOMOYO's pull request for v6.12
Date: Fri, 4 Oct 2024 13:54:24 -0700	[thread overview]
Message-ID: <202410041305.544EA7E4E@keescook> (raw)
In-Reply-To: <CAHC9VhR=QjdoHG3wJgHFJkKYBg7vkQH2MpffgVzQ0tAByo_wRg@mail.gmail.com>

On Wed, Oct 02, 2024 at 04:12:50PM -0400, Paul Moore wrote:
> As I wrote in my original response to this pull request, this is not
> something I would accept in a new LSM submission and thus I feel
> compelled to speak out against this change and submit a revert to
> Linus.

The patch should be reverted regardless of the LSM specifics:

- The patch is (extremely) non-trivial and:

  - was never posted to any mailing list, which means there was no
    opportunity for discussion

  - did not appear in linux-next, which means there was no opportunity
    for any integration or similar testing

- The patch provides new symbol exports without any discussion nor buy-in
  from the symbol owners. (I do appreciate that it was written to be
  extremely narrowly scoped, but it doesn't matter: it's new exports.)

Given the social history of the code in question, I think the patch
should be reverted due to its _intent_. The above items do not look like
accidents nor oversights, but rather an explicit attempt to bypass the
normal consensus-based development practices of Linux itself.

It's also a red flag that the code was written 6 days before the merge
window -- even if there HAD been discussion, that is an extremely narrow
time frame to propose it for a pull request.

Speaking to the implementation, it's a clever use of static calls, but:

- it internalizes features that were designed to be commonly implemented
  and NOT used internally by an LSM.

- tomoyo_register_hooks() becomes an exploitation gadget that could be
  used to bypass the LSM as a whole.

The first issue is more of a code pattern and best practices issue. The
latter is the core problem I personally have with the implementation:
LSMs are one of the first targets during memory corruption attacks,
so we've tried to reduce their attack surface very aggressively. That
generally translates into making any function pointers (or associated
tables, manipulation routines, etc) read-only.

That this patch would result in TOMOYO getting enabled on RedHat seems
extraordinarily unlikely as RH went out of its way to remove from upstream
the very last part of SELinux that might provide this kind of read-only
bypass: CONFIG_SECURITY_WRITABLE_HOOKS. See f22f9aaf6c3d ("selinux:
remove the runtime disable functionality").

So, no, I think this endangers the other LSMs, has not been discussed
with any other parties, and has likely no path forward in RedHat.

It may be possible to change RH's mind about enabling TOMOYO, though, as
it was denied[1] almost 13 years ago and MUCH has changed since then. A
good place to start would be a new bug report, which has happened[2],
but has yet to be triaged and was only opened 2 months ago. I would
recommend reaching out to the RH kernel team directly...

-Kees

[1] https://bugzilla.redhat.com/show_bug.cgi?id=542986#c8
[2] https://bugzilla.redhat.com/show_bug.cgi?id=2303689

-- 
Kees Cook

  parent reply	other threads:[~2024-10-04 20:54 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02 20:12 TOMOYO's pull request for v6.12 Paul Moore
2024-10-03  2:43 ` Serge E. Hallyn
2024-10-03  2:51   ` Serge E. Hallyn
2024-10-03  3:05   ` John Johansen
2024-10-03 15:32   ` Paul Moore
2024-10-03 16:29     ` Serge E. Hallyn
2024-10-04 10:50       ` Tetsuo Handa
2024-10-04 13:11         ` Mickaël Salaün
2024-10-04 14:34           ` Tetsuo Handa
2024-10-05  4:39       ` John Johansen
2024-10-03 16:36 ` Casey Schaufler
2024-10-03 16:42   ` Serge E. Hallyn
2024-10-03 16:49     ` Paul Moore
2024-10-03 16:58     ` Casey Schaufler
2024-10-04 20:54 ` Kees Cook [this message]
2024-10-04 21:03   ` Paul Moore
2024-10-04 23:41   ` Tetsuo Handa
2024-10-05  0:17     ` Kees Cook
2024-10-05  3:38       ` John Johansen
2024-10-23 10:52         ` Tetsuo Handa
2024-10-05  7:10       ` Tetsuo Handa
2024-10-05 16:10         ` Casey Schaufler
2024-10-05 17:02           ` Dr. Greg
2024-10-05 18:58             ` Casey Schaufler
2024-10-05 23:47               ` Paul Moore
2024-10-06 16:18               ` Dr. Greg
2024-10-06 16:47                 ` Casey Schaufler
2024-10-06 20:20                 ` Paul Moore
2024-10-06 21:50                   ` John Johansen
2024-10-05 16:30         ` Paul Moore
2024-10-05 17:28           ` Simon Thoby
2024-10-06  0:02             ` Serge E. Hallyn
2024-10-06 10:02               ` Tetsuo Handa
2024-10-06 11:14                 ` Simon Thoby
2024-10-07 11:00                   ` Tetsuo Handa

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=202410041305.544EA7E4E@keescook \
    --to=kees@kernel.org \
    --cc=casey@schaufler-ca.com \
    --cc=corbet@lwn.net \
    --cc=john.johansen@canonical.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mic@digikod.net \
    --cc=mortonm@chromium.org \
    --cc=paul@paul-moore.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=roberto.sassu@huawei.com \
    --cc=wufan@linux.microsoft.com \
    --cc=zohar@linux.ibm.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