From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-190e.mail.infomaniak.ch (smtp-190e.mail.infomaniak.ch [185.125.25.14]) (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 61E511632F0 for ; Wed, 13 Nov 2024 15:18:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.25.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731511124; cv=none; b=kEli4Q9EqMacMXtH/mdxZcY016EBjJSFnhACoJ2xgW+Q0mUYc3liZ9yPfTyudFUJAc5HOHp9V0CFJNC4eCyKId6WBB8XsmdEd2seQC8tpcsEH43qwmVfH8AZgbkx67nYBws7V41+u//64Micc2mx6JP5f7jBk2WTi5bOgI8kVa4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731511124; c=relaxed/simple; bh=mYlUJN1gBFD5HKODNMC7Blm9B6/ZeU8V3DHCo45FeaA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ANaA5OhMGFZ3UjY9Y5GmFR7pOZdgzOnOKbsscbMek1jog1nSl95Ezo9bjHWLT3VJJNFocJBVegCOFr3pJZp36TYgCMYzoK7a+QVBGweG2hpVrbnN3VUctbUui/loOAQx1ci5Eut8ld35wLHzzB3ghRTlbW1GBULaGQwwvn1ze/U= 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=H7pSYD1f; arc=none smtp.client-ip=185.125.25.14 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="H7pSYD1f" Received: from smtp-3-0000.mail.infomaniak.ch (smtp-3-0000.mail.infomaniak.ch [10.4.36.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4XpRkd6L5Pzwxp; Wed, 13 Nov 2024 16:18:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digikod.net; s=20191114; t=1731511113; bh=MLSSXV5vV/3ILf2Fs3lIEhU7AyFQKoGO0eFMitslUCo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H7pSYD1fX2Z++3ImtIykQcrNY9c3kG7QvodKsh6W2qISLIxE5GiUo1CcNI9oldnxq 6zHiELOQAA1bhKhd+Cl5VSeE7btdtPdlZ+cTJx3hwz0BwIP7b9q0HLtvFRx7FNusyI kWmzptE8/QZkKvvyjXWv/28U4S45DVjJU4pA9Dmw= Received: from unknown by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4XpRkb6yJPzgd3; Wed, 13 Nov 2024 16:18:31 +0100 (CET) Date: Wed, 13 Nov 2024 16:18:31 +0100 From: =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= To: Francis Laniel Cc: Eric Paris , Paul Moore , =?utf-8?Q?G=C3=BCnther?= Noack , "Serge E . Hallyn" , Ben Scarlato , Casey Schaufler , Charles Zaffery , James Morris , Jann Horn , Jeff Xu , Jorge Lucangeli Obes , Kees Cook , Konstantin Meskhidze , Matt Bobrowski , Mikhail Ivanov , Praveen K Paladugu , Robert Salvet , Shervin Oloumi , Song Liu , Tahera Fahimi , audit@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org Subject: Re: [RFC PATCH v2 04/14] landlock: Add unique ID generator Message-ID: <20241113.oQue0Ohj3aef@digikod.net> References: <20241022161009.982584-1-mic@digikod.net> <20241022161009.982584-5-mic@digikod.net> <1962333.tdWV9SEqCh@pwmachine> Precedence: bulk X-Mailing-List: audit@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: <1962333.tdWV9SEqCh@pwmachine> X-Infomaniak-Routing: alpha On Fri, Oct 25, 2024 at 05:18:06PM +0200, Francis Laniel wrote: > Hi! > > Le mardi 22 octobre 2024, 18:09:59 CEST Mickaël Salaün a écrit : > > Landlock IDs can be generated to uniquely identify Landlock objects. > > For now, only Landlock domains get an ID at creation time. > > > > These IDs have important properties: > > * They are unique during the lifetime of the running system thanks to > > the 64-bit values: at worse, 2^60 - 2*2^32 useful IDs. > > * They are always greater than 2^32 and must then be stored in 64-bit > > integer types. > > * The initial ID (at boot time) is randomly picked between 2^32 and > > 2^33, which limits collisions in logs between different boots. > > * IDs are sequential, which enables users to order them. > > * IDs may not be consecutive but increase with a random 2^4 step, which > > limits side channels. > > > > Such IDs can be exposed to unprivileged processes, even if it is not the > > case with this audit patch series. The domain IDs will be useful for > > user space to identify sandboxes and get their properties. > > > > Cc: Günther Noack > > Cc: Paul Moore > > Signed-off-by: Mickaël Salaün > > Link: https://lore.kernel.org/r/20241022161009.982584-5-mic@digikod.net > > --- > > diff --git a/security/landlock/id.h b/security/landlock/id.h > > new file mode 100644 > > index 000000000000..689ba7607472 > > --- /dev/null > > +++ b/security/landlock/id.h > > @@ -0,0 +1,25 @@ > > +/* SPDX-License-Identifier: GPL-2.0-only */ > > +/* > > + * Landlock LSM - Unique identification number generator > > + * > > + * Copyright © 2024 Microsoft Corporation > > + */ > > + > > +#ifndef _SECURITY_LANDLOCK_ID_H > > +#define _SECURITY_LANDLOCK_ID_H > > + > > +#ifdef CONFIG_AUDIT > > + > > +void __init landlock_init_id(void); > > + > > +u64 landlock_get_id(size_t number_of_ids); > > + > > +#else /* CONFIG_AUDIT */ > > + > > +static inline void __init landlock_init_id(void) > > +{ > > +} > > Should the function have the same signature than when CONFIG_AUDIT is set? The API is the same, only the static inline changes, which is what we need to do in a header file.