From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yx2-f42.google.com (mail-yx2-f42.google.com [74.125.224.170]) (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 AABDC522F13 for ; Fri, 18 Sep 2026 19:59:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789761591; cv=none; b=R+Axm08chPjN0Z8CnmJ1CF44Qi+qdbWwhGGpBrJOO8MHoOaep1aQLGO7tICXa88pAEgxV5A4VO9d7juBjcchfHJBrJD2TlIRXm8aMQ6xLRo65bu7PgprS4Slw3gUFyIlqKZrDB3EVLpTljs5FUBrbiZk7rPvwPTYPDR6wQh1U/g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789761591; c=relaxed/simple; bh=Jv9PmI2tuRQ6a0mGkf94vkgPMQlOdZGeXzjl16O8i00=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uLEfyGeFdnm7JySBzuTXvRE63tQV9hoKtkseaWzXJQfb6Mn4hDQAKZ56ad46qlfnV1caQ4LqLr4j4cPBsMFO1PYjntWJk/s6/rbeHsS8+N7fVXi27CDobaWxjByOP0JwCgrJ6ZA8cE7ipE+eHwrbGIwqyU9TZdzZT36jdUrSc/g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=amutable.com; spf=pass smtp.mailfrom=amutable.com; dkim=pass (2048-bit key) header.d=amutable-com.20251104.gappssmtp.com header.i=@amutable-com.20251104.gappssmtp.com header.b=ch2e604T; arc=none smtp.client-ip=74.125.224.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=amutable.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amutable.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amutable-com.20251104.gappssmtp.com header.i=@amutable-com.20251104.gappssmtp.com header.b="ch2e604T" Received: by mail-yx2-f42.google.com with SMTP id 956f58d0204a3-671825f6fccso1014244d50.2 for ; Fri, 18 Sep 2026 12:59:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amutable-com.20251104.gappssmtp.com; s=20251104; t=1789761587; x=1790366387; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=jFiXSu2V4pZ+QeomBn1c5HcWy5gtnzTo7Z55CduAixo=; b=ch2e604TIxvi8hLh6mLXV0Kd6bTBiZI6iola+whhEHBQ/gRtNMLO9+O8h75SUTlcSD ct4Fq4vTT/VWzsVFSc3o1K507n3fGuVDlzN1p1N7Lkdt1Oewd4iWhDCX9oexGV0yw1Uf x2xfQyWszMMyEtpwNcapqacbwvHOBZrrOHwghHYVKP+FpxGbDBAq6+cwPnqMOmdXT/Wp RmREmPUaX2sGnpVAZP5EJ1ONwPxNa2rNIQ/a9maVbyLwwsluXGxl9TM9z9D6C+ZEnGU5 8BEMTctHx5RvzLgo9Lu01MauixY+qjScYIhLTGc4EVl9uKr4tRuCeerFP6EutvGdfkxX Sdmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789761587; x=1790366387; h=in-reply-to:content-disposition:content-type: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 :content-type; bh=jFiXSu2V4pZ+QeomBn1c5HcWy5gtnzTo7Z55CduAixo=; b=TFVFZT5AXKkTwN8MfvN+9jXZcSQ2y90mj1skuSXyhZHd3eFMcGkqjcQgf7KQYZgugu Y4G+9nTZ4DrN5cGE/vniPeFkpaqZqQ/SIIzHAwtmre7t97TgsWPxLXlzYXe/w8wIKnMT TGffQ+7MSgZctWDYG2Ys/CpJQB8CoAKMKndcxgh6cuYdmgwTEnFeg/VaUCnjNI3wXOho bDTDclQnzHufoOKMdP6fNL42EaFvpEUkQxU6YKs6mKNJMwURa8eiIxd6axFIFEtsBroe DHbMwuVBpQkJX7meo8NJiw0zWeIh2WCM+btCSuJ5i0jWjn9ZnzubBjwnHorzbihTnfvd sqWg== X-Forwarded-Encrypted: i=1; AKwUvBy46gTv1rKZI5DgTejPg89Ir/XtcFlzqEsvYfdxg/iwi4a41aQDwRq0oEdKhhjdJNwas4+NmwYjWY4=@vger.kernel.org X-Gm-Message-State: AFuF++nLsv86FSbvG8XmeLiAF3cSPRXsd51wg4sFvaaJNJBBJQFq1iGL qC1gw9VoFyxRBygSNHB7r1zpPrXYkHHngvE57J+OEls+XoHphWRTmNF0N3FWtLqzmkh7 X-Gm-Gg: AYBFou1KwDirNmb0vCwjwgVhy2iSViVXUv3lGhDAU3kH+9QXt1DNwzdWvsRIjuJHXUi I6xdmLwpIeqKcEJ+T2FwnaXQzT0RZlFRO/509sP0/2GyWuXhgizrUAPIDPlKrMGR93M4EanC34a 8vlysA/e+UfqWVVV5ac9rRiKUlO/QBhc75uxq891kT5fHEFkxnVzt76xw6wvIRq8k055Y9mc5Gh 7ZuqNBrjn/GH/fGWOM67BknjTED/axUVTKS1blIySIJ1bUPZKMQTxIJBvEC61cqIMuMwfG78qbL CjIksQzHn5FGlgcQQbJLzShJ3iHgARsvkfge2BRHTo5SOgO1QXEglIJPIR2no1ByxBUoZ6X7qBW BTjZWaX3Iro/qCeCQUPjRh5sXTtRu0An9wlBwel5d5NQdQl0jbrN8IhWZy3ioFZxnUdS+bGrEFa KoiFbKpTe/gyDIAI2vleiMjMcI6H1J+7AenHMD12wvASdPYlYQpibWNU7WUsbjsA/a2cK5K8FeX sitqgF8sK8Mssyq77WBsnyUFaLTl0lrNzesQOqV+h4qIrPo3DCB0g== X-Received: by 2002:a05:690e:e89:b0:671:4d46:8d5a with SMTP id 956f58d0204a3-6717fcee54emr1347891d50.41.1789761587246; Fri, 18 Sep 2026 12:59:47 -0700 (PDT) Received: from toolbx (104-53-165-62.lightspeed.stlsmo.sbcglobal.net. [104.53.165.62]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-672990ab5desm406523d50.8.2026.09.18.12.59.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2026 12:59:46 -0700 (PDT) Date: Fri, 18 Sep 2026 14:59:49 -0500 From: Andrew Halaney To: David Howells Cc: Jarkko Sakkinen , Alasdair Kergon , Mike Snitzer , Mikulas Patocka , Benjamin Marzinski , Paul Moore , James Morris , "Serge E. Hallyn" , Eric Biggers , "Theodore Y. Ts'o" , Jonathan Corbet , Shuah Khan , Randy Dunlap , dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, bpf@vger.kernel.org, fsverity@lists.linux.dev, linux-doc@vger.kernel.org, "Christian Brauner (Amutable)" Subject: Re: [PATCH 1/3] keys: add KEY_SPEC_DM_VERITY_KEYRING Message-ID: References: <20260914-ajhalaney-dmverity-key-identifier-v1-0-01922dc1366a@amutable.com> <20260914-ajhalaney-dmverity-key-identifier-v1-1-01922dc1366a@amutable.com> <715249.1789718726@warthog.procyon.org.uk> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <715249.1789718726@warthog.procyon.org.uk> On Fri, Sep 18, 2026 at 09:05:26AM +0100, David Howells wrote: > Jarkko Sakkinen wrote: > > > This is great for discussion but what we want for the commit message > > is just motivation and resolution. > > Actually, I think it's useful that Andrew wrote up the issues in the commit > message - and I think it shows part of the motivation. The 'writing a fake > /proc/keys line in the description' is something I hadn't considered. I'll defer to what you all want in the message here, I found it valuable but I trend on the side of overly verbose admittedly! > > > I don't think we need all this just to say that /proc/keys in a racy > > query mechanism for production, which is an issue for dm-verity, given > > that nothing else is available. > > I think at some point, we will need a system call to search all for all > accessible keys matching certain criteria by actually walking the key > database. The problem there is that there may be multiple hits, so we may > need something like: > > int count = find_key(key_serial_t start_id, > const char *type, const char *desc_prefix, > key_serial_t *results, size_t results_size, > unsigned int flags); > > Allowing you to do: > > key_serial_t dm_key; > int n = find_key(0, "keyring", ".dm_verity", &dm_key, 1, > FIND_KEY_EXACT_DESC); > > This wouldn't be as fast as a direct lookup since it would have to walk the > key tree, doing name comparisons and perm checks on each key of the type. > > > And secondly special keys are meant for implicit keyrings so isn't > > that all there's to it? > > I have no particular objection to setting aside a block of negative key IDs > for special keyrings that need to be accessed a lot - though I would make > common reg/unreg functions that take the ID to be registered and, say, set the > block at -257..-512. Moving the BFP keyring to -257 and DM to -258. To be clear are you suggesting I do that for v2 here? Happy to make the change and add some reuse to the registration functions, etc. I'm guessing its fine to change the bpf id since its still only in -next? The only awkward bit with making that more generic is that dm-verity isn't __ro_after_init since its coming from a module possibly, and because of the module usage I also protected it with a spinlock in case someone's accessing it while you unload the module. Could just use one spinlock for the whole generic array, and drop the __ro_after_init I suppose. Let me know if I'm not following properly! Thanks, Andrew