Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1848667rbb; Tue, 27 Feb 2024 03:16:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWlEPjTTERU3v/maoqRLRzPH0uqbXncWgGK7zTBnTbma0mMdBNtvpvlSR0rMFB73GsklgYb8YO8fKwNaancWER2/LjxNOXOaHWK3WYNZA== X-Google-Smtp-Source: AGHT+IEmO6hqTOk2fTq7SOT+jdmUDOmva6hLd7coPltAoctqiUUnSQ6VczDidmKepoPX5+3GSHiy X-Received: by 2002:ac8:730b:0:b0:42e:7304:efd1 with SMTP id x11-20020ac8730b000000b0042e7304efd1mr8710310qto.17.1709032562174; Tue, 27 Feb 2024 03:16:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709032562; cv=pass; d=google.com; s=arc-20160816; b=fHVDuKUKj6XQP4K3vgasP52V0K1QntJaAcrMNTUTv/tU5Glmg1RmGAt6+SsRz0jrF4 7wSBxGDGzyk31ZugMq9nvErMsnWn0LoaZEfnSR3x80MFYj0f/4qKj3+iplqGfE9P97K2 JLbwissLNuqOOeLVdm+TszWjkPAwzQBV1nlPoXqLi4HxWbVl7ymXNRAwA4MzPDwfdrOR GG3GjbruRszFu0mHb+VqdOTqz4d9D5DVoXmySYedCSvVAKCz1UGKY8pKu5wp7DYYmz6B knJCI1Cjxd64y/9cuwV16vIijCNCs7zSqrWcJsAETHhjDHfPduTfyq3nQITSO9w+axkT 9ILQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=SgSqnRpYbVgYt0S/19hmW1v6WHLtJDNmfTSbDD0L5c4=; fh=ud1dX/SGrHvo1WXcqwOp38DoQRnN7o51jyVIPqKONGQ=; b=n/wBP9qVABFp/n4ZQMiTCC/o+MWA7B7KUCZv3w1ISU5LM9wp7LRFaUzQzOAt3ruA7r iFIjDOoTeBNVINJMP+LxawBas0A04UhRDK2dEF35yyP42+jhRqgFb664+PsXtTYAXxUz kjPe8Oug8PYiqa0AAlJXcDKi0EdTrevv6uihbL4yvTLPm+phvyd4sZDvBAUhN7gkx0B0 kJMKgRmLDkMQsxuXmYwKTSvgDl6QRYJKOCJdHj4G9cGVWt65gi3BWdl7E/fSe7StrtJj wlZPc6ZybUG0+bbSySGZWViQpCdCzNp3HMnpkXAyRSQyKq5bbSrIL4OcaT1ktQq20C5M +GgQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=aJAgMZqv; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-83111-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83111-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id l8-20020a05622a050800b0042e7b05f998si6513274qtx.58.2024.02.27.03.16.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 03:16:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83111-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=aJAgMZqv; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-83111-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83111-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0EC731C23226 for ; Tue, 27 Feb 2024 11:15:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E4000139584; Tue, 27 Feb 2024 11:15:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="aJAgMZqv" Received: from smtp-1908.mail.infomaniak.ch (smtp-1908.mail.infomaniak.ch [185.125.25.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A7BE2E3EB for ; Tue, 27 Feb 2024 11:15:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.25.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709032514; cv=none; b=jnm3rNTzKphm0f3frEhiLZAgAFJt4q8QQn2TnEUiOF/PCxjVVFA3xWmtPtJrH7TyLw09SmP/Co5/CI1Lk/vaB8OI6cRxa5ZqYCZpUc2qDGeQU61y64K1W3bkAtOrpdmw3AFsaYPzA68ZbJIZ7E1KNA1fPrjQrrSKmq8TyR2a5OU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709032514; c=relaxed/simple; bh=fo0e4FRJyzZJ6d6n/7sR3VvkreP3rfZ9EhEu8wKED6Q=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Zq7JcYG406UgrQtP0KWX4f9J2GA9HxK8A/kNcfxphE7sq5RFFbH6mNXK0q6wk53u2JEitjCLlKm/RIez4o1AanuznDEhqVXrhYQpDSF63bDl1QEJ/xNdmKXyo8ygl4lQ5NIccRQ7Pb/66bqnIEo8l0sg81uId+39/28LljoUQFE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net; spf=pass smtp.mailfrom=digikod.net; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b=aJAgMZqv; arc=none smtp.client-ip=185.125.25.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=digikod.net Received: from smtp-4-0001.mail.infomaniak.ch (unknown [10.7.10.108]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4TkZRK3mSFzMq5jp; Tue, 27 Feb 2024 12:06:05 +0100 (CET) Received: from unknown by smtp-4-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4TkZRJ1SGDzDLf; Tue, 27 Feb 2024 12:06:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1709031965; bh=fo0e4FRJyzZJ6d6n/7sR3VvkreP3rfZ9EhEu8wKED6Q=; h=From:To:Cc:Subject:Date:From; b=aJAgMZqvXCuTbBi3QrqQEix+We3BKKkgtSzWSI/iyXVsm+O11Q4WECvzP7XS5p7AK SysOh8oMYi25zAJ5MEnSVlYHTBLoZKpMm1EgyycJhArAgZ+5oaXh/Ej5Es4I7TuWwX 6Vizit1a6SoZwfE3jEmCv42kq4iV/5BZJ2nNfIPM= From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= To: =?UTF-8?q?G=C3=BCnther=20Noack?= , Paul Moore , "Serge E . Hallyn" Cc: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Konstantin Meskhidze , Shervin Oloumi , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Kees Cook Subject: [PATCH v2 1/2] landlock: Extend documentation for kernel support Date: Tue, 27 Feb 2024 12:05:49 +0100 Message-ID: <20240227110550.3702236-1-mic@digikod.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Infomaniak-Routing: alpha Extend the kernel support section with one subsection for build time configuration and another for boot time configuration. Extend the boot time subsection with a concrete example. Update the journalctl command to include the boot option. Cc: Günther Noack Cc: Kees Cook Signed-off-by: Mickaël Salaün --- Changes since v1: * New patch, suggested by Kees Cook. --- Documentation/userspace-api/landlock.rst | 57 +++++++++++++++++++++--- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/Documentation/userspace-api/landlock.rst b/Documentation/userspace-api/landlock.rst index 2e3822677061..838cc27db232 100644 --- a/Documentation/userspace-api/landlock.rst +++ b/Documentation/userspace-api/landlock.rst @@ -19,11 +19,12 @@ unexpected/malicious behaviors in user space applications. Landlock empowers any process, including unprivileged ones, to securely restrict themselves. We can quickly make sure that Landlock is enabled in the running system by -looking for "landlock: Up and running" in kernel logs (as root): ``dmesg | grep -landlock || journalctl -kg landlock`` . Developers can also easily check for -Landlock support with a :ref:`related system call `. If -Landlock is not currently supported, we need to :ref:`configure the kernel -appropriately `. +looking for "landlock: Up and running" in kernel logs (as root): +``dmesg | grep landlock || journalctl -kb -g landlock`` . +Developers can also easily check for Landlock support with a +:ref:`related system call `. +If Landlock is not currently supported, we need to +:ref:`configure the kernel appropriately `. Landlock rules ============== @@ -499,6 +500,9 @@ access rights. Kernel support ============== +Build time configuration +------------------------ + Landlock was first introduced in Linux 5.13 but it must be configured at build time with ``CONFIG_SECURITY_LANDLOCK=y``. Landlock must also be enabled at boot time as the other security modules. The list of security modules enabled by @@ -507,11 +511,52 @@ contains ``CONFIG_LSM=landlock,[...]`` with ``[...]`` as the list of other potentially useful security modules for the running system (see the ``CONFIG_LSM`` help). +Boot time configuration +----------------------- + If the running kernel does not have ``landlock`` in ``CONFIG_LSM``, then we can -still enable it by adding ``lsm=landlock,[...]`` to +enable Landlock by adding ``lsm=landlock,[...]`` to Documentation/admin-guide/kernel-parameters.rst thanks to the bootloader configuration. +For example, if the current built-in configuration is: + +.. code-block:: console + + $ zgrep -h "^CONFIG_LSM=" "/boot/config-$(uname -r)" /proc/config.gz 2>/dev/null + CONFIG_LSM="lockdown,yama,integrity,apparmor" + +...and if the cmdline doesn't contain ``landlock`` either: + +.. code-block:: console + + $ sed -n 's/.*\(\