All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Lautrbach <plautrba@redhat.com>
To: SELinux List <selinux@vger.kernel.org>, Laszlo Ersek <lersek@redhat.com>
Cc: "Richard W.M. Jones" <rjones@redhat.com>
Subject: Re: [PATCH for-3.5 4/5] selinux_restorecon: introduce SELINUX_RESTORECON_COUNT_ERRORS
Date: Fri, 29 Apr 2022 10:13:00 +0200	[thread overview]
Message-ID: <87r15gs3xv.fsf@redhat.com> (raw)
In-Reply-To: <20220428065354.27605-5-lersek@redhat.com>

Laszlo Ersek <lersek@redhat.com> writes:

> Currently, if the SELINUX_RESTORECON_ABORT_ON_ERROR flag is clear, then
> selinux_restorecon[_parallel]() does not abort the file tree walk upon an
> error, but the function itself fails the same, with the same (-1) return
> value. This in turn is reported by the setfiles(8) utility to its parent
> process with the same exit code (255).
>
> In libguestfs we want to proceed after setfiles(8) fails *at most* with
> such errors that occur during the file tree walk. We need setfiles(8) to
> exit with a distinct exit status in that situation.
>
> For this, introduce the SELINUX_RESTORECON_COUNT_ERRORS flag, and the
> corresponding selinux_restorecon_get_skipped_errors() function, for
> selinux_restorecon[_parallel]() to count, but otherwise ignore, errors
> during the file tree walk. When no other kind of error occurs, the
> relabeling functions will return zero, and the caller can fetch the number
> of errors ignored during the file tree walk with
> selinux_restorecon_get_skipped_errors().
>
> Importantly, when at least one such error is skipped, we don't write
> partial match digests for subdirectories, as any masked error means that
> any subdirectory may not have been completely relabeled.
>
> Cc: "Richard W.M. Jones" <rjones@redhat.com>
> Cc: Petr Lautrbach <plautrba@redhat.com>
> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1794518
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
[...]
> --- a/libselinux/src/libselinux.map
> +++ b/libselinux/src/libselinux.map
> @@ -245,3 +245,8 @@ LIBSELINUX_3.4 {
>    global:
>      selinux_restorecon_parallel;
>  } LIBSELINUX_1.0;
> +
> +LIBSELINUX_3.5 {

It's still possible to put this into LIBSELINUX_3.4. Next week we will
release 3.4-rc3 and GA of 3.4 is planned two weeks later.


> +  global:
> +    selinux_restorecon_get_skipped_errors;
> +} LIBSELINUX_3.4;
> -- 
> 2.19.1.3.g30247aa5d201


  reply	other threads:[~2022-04-29  8:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28  6:53 [PATCH for-3.5 0/5] selinux_restorecon(3), setfiles(8): skip relabeling errors Laszlo Ersek
2022-04-28  6:53 ` [PATCH for-3.5 1/5] setfiles: fix up inconsistent indentation Laszlo Ersek
2022-04-28  6:53 ` [PATCH for-3.5 2/5] setfiles: remove useless assignment and comment (after RHBZ#1926386) Laszlo Ersek
2022-04-28  6:53 ` [PATCH for-3.5 3/5] setfiles: remove useless "iamrestorecon" checks in option parsing Laszlo Ersek
2022-04-28 16:07   ` Daniel Burgener
2022-04-28  6:53 ` [PATCH for-3.5 4/5] selinux_restorecon: introduce SELINUX_RESTORECON_COUNT_ERRORS Laszlo Ersek
2022-04-29  8:13   ` Petr Lautrbach [this message]
2022-04-29 10:20     ` Laszlo Ersek
2022-04-28  6:53 ` [PATCH for-3.5 5/5] setfiles: introduce the -C option for distinguishing file tree walk errors Laszlo Ersek
2022-04-28  9:22 ` [PATCH for-3.5 0/5] selinux_restorecon(3), setfiles(8): skip relabeling errors Richard W.M. Jones
2022-04-28  9:40   ` Laszlo Ersek

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=87r15gs3xv.fsf@redhat.com \
    --to=plautrba@redhat.com \
    --cc=lersek@redhat.com \
    --cc=rjones@redhat.com \
    --cc=selinux@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 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.