Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <acda4be1-4076-a31d-fcfd-27764dd598c8@digikod.net>
Date: Fri, 19 Mar 2021 20:03:22 +0100
From: Mickaël Salaün <mic@...ikod.net>
To: Kees Cook <keescook@...omium.org>
Cc: James Morris <jmorris@...ei.org>, Jann Horn <jannh@...gle.com>,
 "Serge E . Hallyn" <serge@...lyn.com>, Al Viro <viro@...iv.linux.org.uk>,
 Andrew Morton <akpm@...ux-foundation.org>,
 Andy Lutomirski <luto@...capital.net>,
 Anton Ivanov <anton.ivanov@...bridgegreys.com>, Arnd Bergmann
 <arnd@...db.de>, Casey Schaufler <casey@...aufler-ca.com>,
 David Howells <dhowells@...hat.com>, Jeff Dike <jdike@...toit.com>,
 Jonathan Corbet <corbet@....net>, Michael Kerrisk <mtk.manpages@...il.com>,
 Richard Weinberger <richard@....at>, Shuah Khan <shuah@...nel.org>,
 Vincent Dagonneau <vincent.dagonneau@....gouv.fr>,
 kernel-hardening@...ts.openwall.com, linux-api@...r.kernel.org,
 linux-arch@...r.kernel.org, linux-doc@...r.kernel.org,
 linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
 linux-kselftest@...r.kernel.org, linux-security-module@...r.kernel.org,
 x86@...nel.org, Mickaël Salaün
 <mic@...ux.microsoft.com>
Subject: Re: [PATCH v30 02/12] landlock: Add ruleset and domain management


On 19/03/2021 19:40, Kees Cook wrote:
> On Tue, Mar 16, 2021 at 09:42:42PM +0100, Mickaël Salaün wrote:
>> From: Mickaël Salaün <mic@...ux.microsoft.com>
>>
>> A Landlock ruleset is mainly a red-black tree with Landlock rules as
>> nodes.  This enables quick update and lookup to match a requested
>> access, e.g. to a file.  A ruleset is usable through a dedicated file
>> descriptor (cf. following commit implementing syscalls) which enables a
>> process to create and populate a ruleset with new rules.
>>
>> A domain is a ruleset tied to a set of processes.  This group of rules
>> defines the security policy enforced on these processes and their future
>> children.  A domain can transition to a new domain which is the
>> intersection of all its constraints and those of a ruleset provided by
>> the current process.  This modification only impact the current process.
>> This means that a process can only gain more constraints (i.e. lose
>> accesses) over time.
>>
>> Cc: James Morris <jmorris@...ei.org>
>> Cc: Jann Horn <jannh@...gle.com>
>> Cc: Kees Cook <keescook@...omium.org>
>> Signed-off-by: Mickaël Salaün <mic@...ux.microsoft.com>
>> Acked-by: Serge Hallyn <serge@...lyn.com>
>> Link: https://lore.kernel.org/r/20210316204252.427806-3-mic@digikod.net
> 
> (Aside: you appear to be self-adding your Link: tags -- AIUI, this is
> normally done by whoever pulls your series. I've only seen Link: tags
> added when needing to refer to something else not included in the
> series.)

It is an insurance to not lose history. :)

> 
>> [...]
>> +static void put_rule(struct landlock_rule *const rule)
>> +{
>> +	might_sleep();
>> +	if (!rule)
>> +		return;
>> +	landlock_put_object(rule->object);
>> +	kfree(rule);
>> +}
> 
> I'd expect this to be named "release" rather than "put" since it doesn't
> do any lifetime reference counting.

It does decrement rule->object->usage .

> 
>> +static void build_check_ruleset(void)
>> +{
>> +	const struct landlock_ruleset ruleset = {
>> +		.num_rules = ~0,
>> +		.num_layers = ~0,
>> +	};
>> +
>> +	BUILD_BUG_ON(ruleset.num_rules < LANDLOCK_MAX_NUM_RULES);
>> +	BUILD_BUG_ON(ruleset.num_layers < LANDLOCK_MAX_NUM_LAYERS);
>> +}
> 
> This is checking that the largest possible stored value is correctly
> within the LANDLOCK_MAX_* macro value?

Yes, there is builtin checks for all Landlock limits.

> 
>> [...]
> 
> The locking all looks right, and given your test coverage and syzkaller
> work, it's hard for me to think of ways to prove it out any better. :)

Thanks!

> 
> Reviewed-by: Kees Cook <keescook@...omium.org>
> 
> 

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.