Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp460293lqi; Thu, 7 Mar 2024 02:23:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW05zYX/Z45J5BYOPefN0v+CRA4SP+4WTHKLqC0KDPmmFZ0Q7eR8B+Ct9vLb4EA/amXgPJxlirysCVb+rTc4sMpB04wepJDafMRv6FWzg== X-Google-Smtp-Source: AGHT+IECwZpQbY0AKOnO0GT+kH8zfh2Z6TN6kdDy1bQxMbSPozySnSQs4L3VcV5nUp0V1Owy4UUs X-Received: by 2002:a05:6a20:9f88:b0:1a1:67be:f4a2 with SMTP id mm8-20020a056a209f8800b001a167bef4a2mr4537136pzb.59.1709806996463; Thu, 07 Mar 2024 02:23:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709806996; cv=pass; d=google.com; s=arc-20160816; b=HD72zVcEZNBROnKjf+t1aNXrrIx1WaD4cRJ+488rJlojLF4T06kIIdzIV2VD/+croq bPb+W60CNE5L9aPsTa7IcionJ4k/hDcw+W96Ocqjp/nB1S/rkgfD4eXS3ea6gsee/pOj Z1EeERYXJSucRBFDujPwMI7vHDkrE8AukKX9jJssPoQfVUv1Mk+/288RvnU2crtI1wx2 z4gWhM1AHhgPbQOzVyyuUJGZP5NV8Siwf7zbBs+zIgIzrKqcPCRfeA3NezSpj0jDR757 +Fs/wSnz/ARUo1EmATtK0oYB0zfV6VVluSszHDhYw4HQjy02VHy/v1p6Rc7FbCQ7X7sk V1oA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mFs4x6XVZ3Jgshfeiwv/Hl2qm4jt+9Ia9oWJv6HLESE=; fh=4mYl0I27GpThBbbVQpWxhNYC2ysvarIP/v0Xto7uopY=; b=XLCYeHBJYA6F1eXEN7zSGz0/FEG71ByNRtU2g06p6e5Ub99RzZ7HISMpVBpXNOF36s ywfgWDUdbOES9Si2t0sBlPAkZURj9Mu0eNNNyA8FdbpJZ7xDJDlF5Bj790ixDq6i27+B Cc1BtQWp3MQTFCbWv52yr1dHZLPREGzuKue1Jmdinw+kYkpWF79X3V8k3emM7N/n7gUY XWv8Ul6bOC/BRjuuYQBK+0yImxz2s1WwmGSX1rUuS2SGOV/RfXULDG3HZrT2b9VuSIoq 5j0Z/D+VIIPw8bJHtfyRsTzrxg8tc+Jlu5wtp9HEO+b/I2OucmT6qgz1+9X7pf4CWenO JjCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=YzJRhUBi; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-95327-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95327-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o1-20020a17090ab88100b0029a74d50d83si1221247pjr.190.2024.03.07.02.23.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 02:23:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-95327-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=YzJRhUBi; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-95327-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95327-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 68C1B28338C for ; Thu, 7 Mar 2024 10:22:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D3E1F8527A; Thu, 7 Mar 2024 10:22:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="YzJRhUBi" Received: from smtp-bc08.mail.infomaniak.ch (smtp-bc08.mail.infomaniak.ch [45.157.188.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 F297D8289C for ; Thu, 7 Mar 2024 10:22:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.157.188.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709806940; cv=none; b=VyDH3Q/Yi08GI1Se0hS62nuv+pucRRUHxBcXJT17U2C0ZnqBWgC94Z3E4ZHd4vo4DnOeGeZaxEkIx5v5ugwjD7NXXJg2m5edFCwxV2ATN012qgG1tKxS4IRs16jL7m/POltZHiiln8TecfXBdk7la49XvQRaAUZkh6sY8s2nRsA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709806940; c=relaxed/simple; bh=3wfPwwhLAgLaMHVJF2tSLdLHhhmhu0GsZ2XZGA/5oOI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jX9GZIJLBDOLQ7NoUvdruSxuwd+h4eaPBdHtjaGEq1tN6cthRgtLucIIsiM/xnCTRLDuYrnmFP0P2u/duBbDF33X9t2XNKph0M0qkrWs/v2oNy3ZoSVI8Vpy4MJ82KFb7sEmVyW0I/q7RhYgtCCDrn1VUtyelLR8GQUDeW8FtPI= 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=YzJRhUBi; arc=none smtp.client-ip=45.157.188.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 4Tr52S3kpTzMqbGB; Thu, 7 Mar 2024 11:22:08 +0100 (CET) Received: from unknown by smtp-4-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4Tr52R5XlPzQVF; Thu, 7 Mar 2024 11:22:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1709806928; bh=3wfPwwhLAgLaMHVJF2tSLdLHhhmhu0GsZ2XZGA/5oOI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YzJRhUBimplUlxe27u0ZbbJbY4lpfXMY1nQe/nGbp3tgjFOR5655B0YKGa7vOT0Wc gyA5oSBrGE6GXO3unN2umndpix5LMhBR6qM9azMdzivkq3+JRDPBCXZ/WjYEOxbosR 2r3kTFP7LpReBITwCp5p+x6KAnaEEnSB/b5Jmums= Date: Thu, 7 Mar 2024 11:21:57 +0100 From: =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= To: =?utf-8?Q?G=C3=BCnther?= Noack , Alejandro Colomar Cc: Paul Moore , "Serge E . Hallyn" , Konstantin Meskhidze , Shervin Oloumi , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Kees Cook Subject: Re: [PATCH v2 1/2] landlock: Extend documentation for kernel support Message-ID: <20240307.oxQuab5tho0u@digikod.net> References: <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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Infomaniak-Routing: alpha CCing Alejandro On Tue, Feb 27, 2024 at 05:32:20PM +0100, Günther Noack wrote: > On Tue, Feb 27, 2024 at 12:05:49PM +0100, Mickaël Salaün wrote: > > 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 > > +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. > > I would suggest: s/thanks to/in/ OK > > > +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/.*\(\ > + lsm=lockdown,yama,integrity,apparmor > > + > > +...we should configure the bootloader to set a cmdline extending the ``lsm`` > > +list with the ``landlock,`` prefix:: > > Nit: Is the double colon at the end of this line accidental? > (It does not appear before the previous code block.) The "::" creates an implicit text block with the following text. For the other block I used an explicit code-block, which then doesn't require this "::". > > > + > > + lsm=landlock,lockdown,yama,integrity,apparmor > > + > > +After a reboot, we can check that Landlock is up and running by looking at > > +kernel logs: > > + > > +.. code-block:: console > > + > > + # dmesg | grep landlock || journalctl -kb -g landlock > > + [ 0.000000] Command line: [...] lsm=landlock,lockdown,yama,integrity,apparmor > > + [ 0.000000] Kernel command line: [...] lsm=landlock,lockdown,yama,integrity,apparmor > > + [ 0.000000] LSM: initializing lsm=lockdown,capability,landlock,yama,integrity,apparmor > > + [ 0.000000] landlock: Up and running. > > + > > +Note that according to the built time kernel configuration, > > s/built time/build time/ > ^ OK > > It feels like the phrase "according to" could be slightly more specific here. > > To paraphrase Alejandro Colomar, "Note that" is usually redundant. > https://lore.kernel.org/all/0aafcdd6-4ac7-8501-c607-9a24a98597d7@gmail.com/ > > I'd suggest: > > The kernel may be configured at build time to always load the ``lockdown`` and > ``capability`` LSMs. In that case, these LSMs will appear at the beginning of > the ``LSM: initializing`` log line as well, even if they are not configured in > the boot loader. OK, I integrated your suggestion. I guess `capability` is not really considered an LSM but it would be too confusing and out of scope for an user documentation to explain that. > > > +``lockdown,capability,`` may always stay at the beginning of the ``LSM: > > +initializing lsm=`` list even if they are not configured with the bootloader, > > Nit: The man pages spell this in two words as "boot loader". OK, I'll use "boot loader" too. > > > > +which is OK. > > + > > +Network support > > +--------------- > > + > > To be able to explicitly allow TCP operations (e.g., adding a network rule with > > ``LANDLOCK_ACCESS_NET_BIND_TCP``), the kernel must support TCP > > (``CONFIG_INET=y``). Otherwise, sys_landlock_add_rule() returns an > > > > base-commit: b4007fd27206c478a4b76e299bddf4a71787f520 > > -- > > 2.44.0 > > > > Reviewed-by: Günther Noack Thanks!