public inbox for landlock@lists.linux.dev
 help / color / mirror / Atom feed
From: "Mickaël Salaün" <mic@digikod.net>
To: Yves Rutschle <landlock@rutschle.net>
Cc: landlock@lists.linux.dev
Subject: Re: Closing after landlock_add_rule?
Date: Sun, 8 Sep 2024 19:57:35 +0200	[thread overview]
Message-ID: <20240908.Thu1cekagh2o@digikod.net> (raw)
In-Reply-To: <Zt29FXgAR3e5Uzb-@rutschle.net>

Hi Yves,

As for any other kind of file descriptor, a Landlock ruleset should be
closed when it is not used.  However, such a file descriptor cannot
change currently enforced rulesets, so it would not be a security issue
to "leak" it.

File descriptors used to define a Landlock rules (e.g. file opened for a
path_beneath rule) should be closed once the rule is added to the
Landlock ruleset, and leaking such file descriptor could let a sandboxed
process to still read/write such *opened* file.  To avoid such risk, it
is advised to open such files with O_PATH.

Regards,
 Mickaël

On Sun, Sep 08, 2024 at 03:04:53PM +0000, Yves Rutschle wrote:
> Hello all,
> 
> So far my code did not close the filehandles it uses to
> create the fuleset using landlock_add_rule(). I recently
> received a commit to close the file descriptors.
> 
> Does landlock use the file handles after the ruleset is
> created, or is it ok to close them after? The man page does
> not discuss this.
> 
> Cheers,
> Y.
> 
> 
> 

      reply	other threads:[~2024-09-08 18:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-08 15:04 Closing after landlock_add_rule? Yves Rutschle
2024-09-08 17:57 ` Mickaël Salaün [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=20240908.Thu1cekagh2o@digikod.net \
    --to=mic@digikod.net \
    --cc=landlock@lists.linux.dev \
    --cc=landlock@rutschle.net \
    /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