All of lore.kernel.org
 help / color / mirror / Atom feed
From: Filippo Bonazzi <fbonazzi@suse.de>
To: selinux@vger.kernel.org
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>,
	plautrba@redhat.com,  omosnacek@gmail.com, jason@perfinion.com,
	jwcart2@gmail.com, tweek@google.com,  selinux@suse.de
Subject: Re: [PATCH] libselinux: apply requested level to failsafe contexts
Date: Mon, 9 Nov 2026 17:29:57 +0100	[thread overview]
Message-ID: <avH0IcYBB4c5TWuy@suse.com> (raw)
In-Reply-To: <20261106181033.252493-1-stephen.smalley.work@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1958 bytes --]

On 2026-11-06 13:10 (UTC -0500), Stephen Smalley wrote:
>The level-aware context lookup APIs replace the range in the starting
>context, which get_context_user() then copies into matching
>candidates. When no candidate survives, get_failsafe_context() instead
>returns the configured failsafe range unchanged. A NULL starting
>context also hits this path when the current role and type have no
>matching entry.
>
>Carry the explicitly requested level through an internal list lookup
>and apply it to the failsafe context before
>security_check_context(). Keep the configured range for ordinary
>lookups and preserve the existing ENOENT validation exception. Route
>role-and-level lookup through the same level-aware list implementation
>so it receives the fix too.
>
>Add 309 regression cases covering all three APIs, explicit and current
>starting contexts, per-user/global/missing configuration, rejected
>candidates, validation of the final range, and failure/retry at the
>new allocation steps. The test uses private configuration files and
>wraps getcon and kernel validation; no host policy is changed.
>
>Reported-by: Filippo Bonazzi <fbonazzi@suse.de>
>Fixes: https://github.com/SELinuxProject/selinux/issues/508
>Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
>---
> libselinux/src/get_context_list.c     |  84 +++++-----
> libselinux/tests/.gitignore           |   1 +
> libselinux/tests/Makefile             |   7 +
> libselinux/tests/test_context_level.c | 221 ++++++++++++++++++++++++++
> 4 files changed, 273 insertions(+), 40 deletions(-)

Hi, I can confirm that this fixes the issue we originally reported on openSUSE
Tumbleweed. Thank you very much for the fix, and please keep me in the loop when
this will be published in a proper release.

Thanks,

Filippo

-- 
Filippo Bonazzi
Security Engineer                        suse.com
8257 4398 947A 2DBE F21D 76E6 937A 63F0 5B36 46D9

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 525 bytes --]

      parent reply	other threads:[~2026-11-09 16:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 18:10 [PATCH] libselinux: apply requested level to failsafe contexts Stephen Smalley
2026-11-09 16:26 ` Stephen Smalley
2026-11-09 16:29 ` Filippo Bonazzi [this message]

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=avH0IcYBB4c5TWuy@suse.com \
    --to=fbonazzi@suse.de \
    --cc=jason@perfinion.com \
    --cc=jwcart2@gmail.com \
    --cc=omosnacek@gmail.com \
    --cc=plautrba@redhat.com \
    --cc=selinux@suse.de \
    --cc=selinux@vger.kernel.org \
    --cc=stephen.smalley.work@gmail.com \
    --cc=tweek@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.