From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65FAA326952 for ; Tue, 3 Mar 2026 09:08:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772528897; cv=none; b=f4PEM08PE86pOfyx2ldRLa8iF4ASULAW5zd2vdw2Bm6eKVb00aMd6M9QPusgHEFYlQpGPeUxSCyZhuJu5BuJYmyEv5v4rCUhM8Ze87FKlSaSLEJ1KNvp+whAbyIGVRmrseYaMv21/yxhfYAH74KrYPHFViGi51A/rGBOiRsM8U4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772528897; c=relaxed/simple; bh=jH3a5WvSl4hsNVqvGQHSPUcAxKpQELeoMlBc1iNZgoE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QYbdNUF5lO3qhP2J9yRsFzV0LqcWqV20ilIPSY2+fDie3B53J+6E8kdaOy2BDie4qJSL3JHhE+qPnhU/rFpzkoFZM3KXvfPj/tgUYsGt/PgrnqKqZ6fTxZrZoMOKaG7VeddxF/TwNaWllOGJYYal79N29VFmBzW11O3dKf5/rS4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IWo9rSby; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IWo9rSby" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4837f27cf2dso48014495e9.2 for ; Tue, 03 Mar 2026 01:08:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772528895; x=1773133695; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=phEiBdG5ZIERY6yJr+I2LBbcsXFa1y6p3ngiHNYKF5Q=; b=IWo9rSbykMmGKJ5+zb+hpN+8JAYMBfFE3YDDSmCUlirTW7hr2dSl7Pk9LlOxwUEhxC yBsGw0/9SAALxn5GDF82m3jEYThxPfRVoiNNeizRg489gWad8iJNwRAA7Vv0gFLQxcR1 ZsgQJj84VoDvSc9+BZwK7bCLC20xm7jzRGcrhu2UQho0VWEuEO5cjxNjIfAq/5m/BQDs eW9m5ArivDapLdiLPPlHNSYkvjszlUv+IlfJMgJMKjFj09t6wgG5WhUHYQTqcSYnhqzl Qk4Osx5+pDE/GZTadtQK6cJC6C3UiXnRlq1xijezURTZsuJlfijwp23biaNulCnyYOMx DPJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772528895; x=1773133695; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=phEiBdG5ZIERY6yJr+I2LBbcsXFa1y6p3ngiHNYKF5Q=; b=GsIyjNCb2HHP6KOL3xKXvwJDP7gmZTRSDUm0cfBKilZ0G2Vp3F8yb+fS7jRrYNbgEl uWarAq6SKNGBeTnELsdln26vETkZaRe7/1NCkrHLYx7IUeOX+uwDADQaFn6cUAwoJGHJ VwAakiyIdzs+ykN8GPbtesMEyat/fqDjV4VJ5igjv+btVsm1rwqx93BdB+yGJGgzrR81 ndbj3fWCzPaJfIJs8kVkpO5lkaCZwp0Gl0sLLMIOzXJ+GzaDtmnyImqC1HHr695gQPWj TvVajrOy54qdcahz48yODxW04kWsWInFIzcz6TQTRt8Xdp7ZPpLB4U5eTT16Zjy0z+c5 Wm4w== X-Forwarded-Encrypted: i=1; AJvYcCXVjlKC+Q78IPRFVYPwJxhJpgJjsJRGd2ibeyeWeNtA4npz6q1KCDrzvrJCnKSxqxGJeSlZYJqPyZw1bBM=@vger.kernel.org X-Gm-Message-State: AOJu0Yz5M1cppZOMJdaM2H05vWhTNtMzHVx+okZRBEtNviznw9Mfj4au JP0mpTGIy2RETbMou51pQ/LiLk4XOppjV93O9piwYVyvqrwaQR2npaOI X-Gm-Gg: ATEYQzw90AzZTfCb/Ra3Fomr8WBb8qOJaqCtvmGj/uyVE2TbxKwtUxEMEsq73tLwNAe 3zE43AWGbu32tfyDsLYvpsknVn4GridlJejsb0AAYYaV6N/WNxhaaci8SQ8Mh96txXFccF+QlgS SkP0pv/xzWldYEM+7m+W4JC7/PPYSlAjuVjSHuz4MSF/0Z4mH+ZmnwCscW7K+kKz+ETL8Vm2/7K TLzqL+DJtWES/UZd5or7pdkATW4Q+kfykV9vOfekE73HCkuXIK2K02I5Sa20981inG0MFk/5iY1 Dznu4z8Ugan08X+MVGJSCNBQeM+3NZrmH/oF8Cg/jR0eIuBnDix70Z8WaiVfdf338p8knGLpggW Io4WNNTjUjsECRmDYkxOWurommZzpCeq63u5Esdw9vGlkL+WUW1yIhUDg/w9puG7Fli8cY41rSc ou/veVwT8gXEH32xmscfefo7Ru8fxsg6x2oweOQY5/mwm89Epa X-Received: by 2002:a05:600d:13:b0:485:110f:5b7f with SMTP id 5b1f17b1804b1-485110f5be6mr54843725e9.19.1772528894586; Tue, 03 Mar 2026 01:08:14 -0800 (PST) Received: from localhost (ip87-106-108-193.pbiaas.com. [87.106.108.193]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-483c3b841absm376589785e9.13.2026.03.03.01.08.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Mar 2026 01:08:14 -0800 (PST) Date: Tue, 3 Mar 2026 10:08:07 +0100 From: =?iso-8859-1?Q?G=FCnther?= Noack To: "Panagiotis \"Ivory\" Vasilopoulos" Cc: =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= , =?iso-8859-1?Q?G=FCnther?= Noack , Jonathan Corbet , Shuah Khan , linux-security-module@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Dan Cojocaru Subject: Re: [PATCH v3] landlock: Expand restrict flags example for ABI version 8 Message-ID: <20260303.13455f40d0c5@gnoack.org> References: <20260228-landlock-docs-add-tsync-example-v3-1-140ab50f0524@n0toose.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: <20260228-landlock-docs-add-tsync-example-v3-1-140ab50f0524@n0toose.net> On Sat, Feb 28, 2026 at 10:36:59PM +0100, Panagiotis "Ivory" Vasilopoulos wrote: > diff --git a/Documentation/userspace-api/landlock.rst b/Documentation/userspace-api/landlock.rst > index 13134bccdd39d78ddce3daf454f32dda162ce91b..b71ac7aa308260b8141e5d35248fb68cec6dcba9 100644 > --- a/Documentation/userspace-api/landlock.rst > +++ b/Documentation/userspace-api/landlock.rst > @@ -196,13 +196,33 @@ similar backwards compatibility check is needed for the restrict flags > (see sys_landlock_restrict_self() documentation for available flags): > > .. code-block:: c > - > - __u32 restrict_flags = LANDLOCK_RESTRICT_SELF_LOG_NEW_EXEC_ON; > - if (abi < 7) { > - /* Clear logging flags unsupported before ABI 7. */ > + __u32 restrict_flags = > + LANDLOCK_RESTRICT_SELF_LOG_NEW_EXEC_ON | > + LANDLOCK_RESTRICT_SELF_TSYNC; > + switch (abi) { > + case 1 ... 6: > + /* Clear logging flags unsupported for ABI < 7 */ > restrict_flags &= ~(LANDLOCK_RESTRICT_SELF_LOG_SAME_EXEC_OFF | > LANDLOCK_RESTRICT_SELF_LOG_NEW_EXEC_ON | > LANDLOCK_RESTRICT_SELF_LOG_SUBDOMAINS_OFF); > + __attribute__((fallthrough)); > + case 7: > + /* Removes multithreaded enforcement flag unsupported for ABI < 8 */ > + /* > + * WARNING! > + * Don't copy-paste this just yet! This example impacts enforcement > + * and can potentially decrease protection if misused. > + * > + * Below ABI v8, a Landlock policy can only be enforced for the calling > + * thread and its children. This behavior remains a default for ABI v8, > + * but the flag ``LANDLOCK_RESTRICT_SELF_TSYNC`` can now be used to > + * enforce policies across all threads of the calling process. If an > + * application's Landlock integration was designed under the assumption > + * that the flag is used (such as when children threads are responsible > + * for enforcing and/or overriding policies of parents and siblings), > + * removing said flag can decrease protection for older Linux versions. > + */ > + restrict_flags &= ~LANDLOCK_RESTRICT_SELF_TSYNC; > } Hello! Sorry for nit-picking even further here; * You have two immediately adjacent comments here which should be merged into one. * It is enough to use a more terse warning here; would suggest something like: /* * Removes multithreaded enforcement flag unsupported for ABI < 8. * * WARNING: Calling landlock_restrict_self(2) without this flag * is only equivalent if the calling process is single-threaded. */ Thanks, –Günther