[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202402191304.ED03339B@keescook>
Date: Mon, 19 Feb 2024 13:07:48 -0800
From: Kees Cook <keescook@...omium.org>
To: Mickaël Salaün <mic@...ikod.net>
Cc: Günther Noack <gnoack@...gle.com>,
Paul Moore <paul@...l-moore.com>,
"Serge E . Hallyn" <serge@...lyn.com>,
Konstantin Meskhidze <konstantin.meskhidze@...wei.com>,
Shervin Oloumi <enlightened@...omium.org>,
linux-hardening@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] landlock: Warn once if a Landlock action is requested
while disabled
On Mon, Feb 19, 2024 at 08:18:04PM +0100, Mickaël Salaün wrote:
> Because sandboxing can be used as an opportunistic security measure,
> user space may not log unsupported features. Let the system
> administrator know if an application tries to use Landlock but failed
> because it isn't enabled at boot time. This may be caused by bootloader
> configurations with outdated "lsm" kernel's command-line parameter.
>
> Cc: Günther Noack <gnoack@...gle.com>
> Cc: stable@...r.kernel.org
> Fixes: 265885daf3e5 ("landlock: Add syscall implementations")
> Signed-off-by: Mickaël Salaün <mic@...ikod.net>
> ---
> security/landlock/syscalls.c | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/security/landlock/syscalls.c b/security/landlock/syscalls.c
> index f0bc50003b46..b5b424819dee 100644
> --- a/security/landlock/syscalls.c
> +++ b/security/landlock/syscalls.c
> @@ -33,6 +33,18 @@
> #include "ruleset.h"
> #include "setup.h"
>
> +static bool is_not_initialized(void)
> +{
> + if (likely(landlock_initialized))
> + return false;
> +
> + pr_warn_once(
> + "Disabled but requested by user space. "
> + "You should enable Landlock at boot time: "
> + "https://docs.kernel.org/userspace-api/landlock.html#kernel-support\n");
Perhaps update this docs to be really explicit with a example, maybe...
If `landlock` is not present in `CONFIG_LSM`, you can add it. For
example, if this was the current config::
$ zgrep -h ^CONFIG_LSM= /boot/config-$(uname -r) /proc/config.gz 2>/dev/null
CONFIG_LSM="lockdown,yama,integrity,apparmor"
You can boot with::
lsm=landlock,lockdown,yama,integrity,apparmor
I *still* wish we had the "+" operator for lsm=. It would be SO much
easier to say "boot with lsm=+landlock". *shrug*
Reviewed-by: Kees Cook <keescook@...omium.org>
--
Kees Cook
Powered by blists - more mailing lists