Re: [PATCH v3 0/4] Introducing Hornet LSM

2025-05-05 Thread Paul Moore
On Mon, May 5, 2025 at 4:41 PM KP Singh wrote: > On Mon, May 5, 2025 at 7:30 PM Blaise Boscaccy > wrote: > > > > KP Singh writes: > > > > [...] > > > > > Now if you really care about the use-case and want to work with the > > > maintainers > > > and implement signing for the community, here's h

Re: [PATCH v3 0/4] Introducing Hornet LSM

2025-05-05 Thread KP Singh
On Mon, May 5, 2025 at 7:30 PM Blaise Boscaccy wrote: > > KP Singh writes: > > [...] > > > Now if you really care about the use-case and want to work with the > > maintainers > > and implement signing for the community, here's how we think it should be > > done: > > > > * The core signing logic

Re: [PATCH v3 0/4] Introducing Hornet LSM

2025-05-05 Thread Blaise Boscaccy
KP Singh writes: [...] > Now if you really care about the use-case and want to work with the > maintainers > and implement signing for the community, here's how we think it should be > done: > > * The core signing logic and the tooling stays in BPF, something that the > users > are already

Re: [PATCH v3 0/4] Introducing Hornet LSM

2025-05-05 Thread Paul Moore
On Sun, May 4, 2025 at 7:25 PM KP Singh wrote: > On Sun, May 4, 2025 at 7:36 PM Paul Moore wrote: > > On Fri, May 2, 2025 at 5:00 PM KP Singh wrote: ... > > > ... here's how we think it should be done: > > > > > > * The core signing logic and the tooling stays in BPF, something that the > > >

Re: [PATCH 0/2] crypto: hisilicon/qm - memory allocation cleanups

2025-05-05 Thread Herbert Xu
On Sat, May 03, 2025 at 04:21:26PM -0400, Ethan Carter Edwards wrote: > This series contains two small cleanups to improve code quality and > readability. One removes a sizeof(char) piece of code (because it > evaluates to 1 anyways) and one switches to the helper function > devm_kcalloc. > > Sign

Re: [PATCH v3 0/4] Introducing Hornet LSM

2025-05-05 Thread Daniel Borkmann
On 5/4/25 7:36 PM, Paul Moore wrote: On Fri, May 2, 2025 at 5:00 PM KP Singh wrote: [...] From what I've seen in Blaise's efforts to implement BPF signature validation in the upstream kernel he has been working in good faith and has been trying to work with the greater BPF community at each s

Re: [PATCH v3 0/4] Introducing Hornet LSM

2025-05-04 Thread KP Singh
On Sun, May 4, 2025 at 7:36 PM Paul Moore wrote: > > On Fri, May 2, 2025 at 5:00 PM KP Singh wrote: > > > > > This patch series introduces the Hornet LSM. The goal of Hornet is to > > > provide > > > a signature verification mechanism for eBPF programs. > > > > > > > [...] > > > > > > > > Refere

Re: [PATCH v3 0/4] Introducing Hornet LSM

2025-05-04 Thread Paul Moore
On Fri, May 2, 2025 at 5:00 PM KP Singh wrote: > > > This patch series introduces the Hornet LSM. The goal of Hornet is to > > provide > > a signature verification mechanism for eBPF programs. > > > > [...] > > > > > References: [1] > > https://lore.kernel.org/bpf/20220209054315.73833-1-alexei.st

Re: [PATCH] KEYS: Reduce smp_mb() calls in key_put()

2025-05-04 Thread Jarkko Sakkinen
On Sat, May 03, 2025 at 11:02:57PM +0800, Herbert Xu wrote: > On Sat, May 03, 2025 at 05:39:16PM +0300, Jarkko Sakkinen wrote: > > On Wed, Apr 30, 2025 at 06:25:53PM +0300, Jarkko Sakkinen wrote: > > > Rely only on the memory ordering of spin_unlock() when setting > > > KEY_FLAG_FINAL_PUT under key

Re: [PATCH] KEYS: Reduce smp_mb() calls in key_put()

2025-05-04 Thread Jarkko Sakkinen
On Sat, May 03, 2025 at 11:19:21PM +0100, David Howells wrote: > Jarkko Sakkinen wrote: > > > Oops, my bad (order swap), sorry. Should have been: > > > > spin_unlock_irqrestore(&key->user->lock, flags); > > } else { > >

Re: [PATCH v3 1/4] security: Hornet LSM

2025-05-04 Thread Paul Moore
On Fri, May 2, 2025 at 2:44 PM Blaise Boscaccy wrote: > > This adds the Hornet Linux Security Module which provides signature > verification of eBPF programs. This allows users to continue to > maintain an invariant that all code running inside of the kernel has > been signed. > > The primary targ

Re: [PATCH] KEYS: Invert FINAL_PUT bit

2025-05-04 Thread David Howells
Herbert Xu wrote: > + key->flags |= KEY_FLAG_DONT_GC_YET; You need __set_bit() or 1<

Re: [PATCH] KEYS: Reduce smp_mb() calls in key_put()

2025-05-03 Thread Herbert Xu
On Sat, May 03, 2025 at 11:19:21PM +0100, David Howells wrote: > > Possibly we only need smp_mb() in the IN_QUOTA branch in key_put(). Just change the smp_mb to smp_mb__before_atomic, at least on x86 it just disappears because set_bit is already a serialising operation. Or even better, reverse th

Re: [PATCH] KEYS: Reduce smp_mb() calls in key_put()

2025-05-03 Thread David Howells
Jarkko Sakkinen wrote: > Oops, my bad (order swap), sorry. Should have been: > > spin_unlock_irqrestore(&key->user->lock, flags); > } else { > smp_mb(); /* key->user before FINAL_PUT set. */ >

Re: [PATCH] KEYS: Reduce smp_mb() calls in key_put()

2025-05-03 Thread Herbert Xu
On Sat, May 03, 2025 at 05:39:16PM +0300, Jarkko Sakkinen wrote: > On Wed, Apr 30, 2025 at 06:25:53PM +0300, Jarkko Sakkinen wrote: > > Rely only on the memory ordering of spin_unlock() when setting > > KEY_FLAG_FINAL_PUT under key->user->lock in key_put(). > > > > Signed-off-by: Jarkko Sakkinen

Re: [PATCH] KEYS: Reduce smp_mb() calls in key_put()

2025-05-03 Thread Jarkko Sakkinen
On Wed, Apr 30, 2025 at 06:25:53PM +0300, Jarkko Sakkinen wrote: > Rely only on the memory ordering of spin_unlock() when setting > KEY_FLAG_FINAL_PUT under key->user->lock in key_put(). > > Signed-off-by: Jarkko Sakkinen > --- > security/keys/key.c | 6 -- > 1 file changed, 4 insertions(+),

Re: [PATCH v3 0/4] Introducing Hornet LSM

2025-05-02 Thread KP Singh
> This patch series introduces the Hornet LSM. The goal of Hornet is to provide > a signature verification mechanism for eBPF programs. > [...] > > References: [1] > https://lore.kernel.org/bpf/20220209054315.73833-1-alexei.starovoi...@gmail.com/ > [2] > https://lore.kernel.org/bpf/CAADnVQ+wPK1KK

Re: [PATCH] x86/sgx: Use SHA-256 library API instead of crypto_shash API

2025-04-30 Thread Jarkko Sakkinen
On Mon, Apr 28, 2025 at 12:19:50PM -0700, Dave Hansen wrote: > On 4/28/25 11:38, Eric Biggers wrote: > > -static int sgx_get_key_hash(const void *modulus, void *hash) > > -{ > > - struct crypto_shash *tfm; > > - int ret; > > - > > - tfm = crypto_alloc_shash("sha256", 0, CRYPTO_ALG_ASYNC); > >

Re: [PATCH v8 0/5] Add Loongson Security Engine chip driver

2025-04-30 Thread Qunqin Zhao
在 2025/4/30 下午4:58, Lee Jones 写道: On Wed, 30 Apr 2025, Huacai Chen wrote: On Wed, Apr 30, 2025 at 4:47 PM Qunqin Zhao wrote: 在 2025/4/30 下午4:18, Herbert Xu 写道: On Wed, Apr 30, 2025 at 04:14:40PM +0800, Qunqin Zhao wrote: Sorry to bother you, may i ask is it fine to move the Security Eng

Re: [PATCH v8 0/5] Add Loongson Security Engine chip driver

2025-04-30 Thread Lee Jones
On Wed, 30 Apr 2025, Huacai Chen wrote: > On Wed, Apr 30, 2025 at 4:47 PM Qunqin Zhao wrote: > > > > > > 在 2025/4/30 下午4:18, Herbert Xu 写道: > > > On Wed, Apr 30, 2025 at 04:14:40PM +0800, Qunqin Zhao wrote: > > >> Sorry to bother you, may i ask is it fine to move the Security Engine > > >> base

Re: [PATCH v8 0/5] Add Loongson Security Engine chip driver

2025-04-30 Thread Huacai Chen
On Wed, Apr 30, 2025 at 4:47 PM Qunqin Zhao wrote: > > > 在 2025/4/30 下午4:18, Herbert Xu 写道: > > On Wed, Apr 30, 2025 at 04:14:40PM +0800, Qunqin Zhao wrote: > >> Sorry to bother you, may i ask is it fine to move the Security Engine base > >> driver[Patch v8 1/5] to drivers/crypto ? > >> > >> The

Re: [PATCH v8 0/5] Add Loongson Security Engine chip driver

2025-04-30 Thread Qunqin Zhao
在 2025/4/30 下午4:18, Herbert Xu 写道: On Wed, Apr 30, 2025 at 04:14:40PM +0800, Qunqin Zhao wrote: Sorry to bother you, may i ask is it fine to move  the Security Engine base driver[Patch v8 1/5] to drivers/crypto ? The base driver uses MFD  interface  to register child device(tpm, rng) , as don

Re: [PATCH v8 0/5] Add Loongson Security Engine chip driver

2025-04-30 Thread Herbert Xu
On Wed, Apr 30, 2025 at 04:14:40PM +0800, Qunqin Zhao wrote: > > Sorry to bother you, may i ask is it fine to move  the Security Engine base > driver[Patch v8 1/5] to drivers/crypto ? > > The base driver uses MFD  interface  to register child device(tpm, rng) , as > done in > > "drivers/iio/commo

Re: [PATCH v8 0/5] Add Loongson Security Engine chip driver

2025-04-30 Thread Qunqin Zhao
在 2025/4/20 下午3:17, Huacai Chen 写道: Hi, Qunqin, On Fri, Apr 18, 2025 at 5:33 PM Qunqin Zhao wrote: The Loongson Security Engine chip supports RNG, SM2, SM3 and SM4 accelerator engines. Each engine have its own DMA buffer provided by the controller. The kernel cannot directly send commands to

Re: [PATCH v8 4/5] tpm: Add a driver for Loongson TPM device

2025-04-30 Thread Qunqin Zhao
在 2025/4/22 上午2:58, Jarkko Sakkinen 写道: On Fri, Apr 18, 2025 at 05:34:06PM +0800, Qunqin Zhao wrote: Loongson Security Engine supports random number generation, hash, symmetric encryption and asymmetric encryption. Based on these encryption functions, TPM2 have been implemented in the Loongson

Re: [PATCH] x86/sgx: Use SHA-256 library API instead of crypto_shash API

2025-04-28 Thread Eric Biggers
On Mon, Apr 28, 2025 at 12:19:50PM -0700, Dave Hansen wrote: > On 4/28/25 11:38, Eric Biggers wrote: > > -static int sgx_get_key_hash(const void *modulus, void *hash) > > -{ > > - struct crypto_shash *tfm; > > - int ret; > > - > > - tfm = crypto_alloc_shash("sha256", 0, CRYPTO_ALG_ASYNC); > >

Re: [PATCH] x86/sgx: Use SHA-256 library API instead of crypto_shash API

2025-04-28 Thread Dave Hansen
On 4/28/25 11:38, Eric Biggers wrote: > -static int sgx_get_key_hash(const void *modulus, void *hash) > -{ > - struct crypto_shash *tfm; > - int ret; > - > - tfm = crypto_alloc_shash("sha256", 0, CRYPTO_ALG_ASYNC); > - if (IS_ERR(tfm)) > - return PTR_ERR(tfm); > - > -

Re: [PATCH] crypto: iaa: Adjust workqueue allocation type

2025-04-28 Thread Herbert Xu
On Fri, Apr 25, 2025 at 11:11:31PM -0700, Kees Cook wrote: > In preparation for making the kmalloc family of allocators type aware, > we need to make sure that the returned type from the allocation matches > the type of the variable being assigned. (Before, the allocator would > always return "void

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-25 Thread Blaise Boscaccy
James Bottomley writes: > On Thu, 2025-04-24 at 16:41 -0700, Alexei Starovoitov wrote: >> On Wed, Apr 23, 2025 at 7:12 AM James Bottomley >> wrote: >> > On Mon, 2025-04-21 at 13:12 -0700, Alexei Starovoitov wrote: >> > [...] >> > > Calling bpf_map_get() and >> > > map->ops->map_lookup_elem() fro

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-25 Thread James Bottomley
On Thu, 2025-04-24 at 16:41 -0700, Alexei Starovoitov wrote: > On Wed, Apr 23, 2025 at 7:12 AM James Bottomley > wrote: > > On Mon, 2025-04-21 at 13:12 -0700, Alexei Starovoitov wrote: > > [...] > > > Calling bpf_map_get() and > > > map->ops->map_lookup_elem() from a module is not ok either. > >

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-24 Thread Alexei Starovoitov
On Wed, Apr 23, 2025 at 7:12 AM James Bottomley wrote: > > On Mon, 2025-04-21 at 13:12 -0700, Alexei Starovoitov wrote: > [...] > > Calling bpf_map_get() and > > map->ops->map_lookup_elem() from a module is not ok either. > > I don't understand this objection. Consider an LSM that hooks into secu

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-23 Thread Paul Moore
On Wed, Apr 23, 2025 at 10:12 AM James Bottomley wrote: > On Mon, 2025-04-21 at 13:12 -0700, Alexei Starovoitov wrote: > [...] > > Calling bpf_map_get() and > > map->ops->map_lookup_elem() from a module is not ok either. > > I don't understand this objection. The program just got passed in to > b

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-23 Thread James Bottomley
On Mon, 2025-04-21 at 13:12 -0700, Alexei Starovoitov wrote: [...] > Calling bpf_map_get() and > map->ops->map_lookup_elem() from a module is not ok either. I don't understand this objection. The program just got passed in to bpf_prog_load() as a set of attributes which, for a light skeleton, dir

Re: [PATCH] crypto: using size_add() for kmalloc()

2025-04-22 Thread Herbert Xu
On Tue, Apr 22, 2025 at 01:24:22PM +0300, Dan Carpenter wrote: > > This is exactly what Kees did with the mass conversion to > struct_size(). I occasionally run across places where Kees's mass > conversion patches did fix real integer overflow bugs. The point is that the reqsize shouldn't even ex

Re: [PATCH] crypto: using size_add() for kmalloc()

2025-04-22 Thread Dan Carpenter
On Mon, Apr 21, 2025 at 08:05:43PM +0800, Herbert Xu wrote: > On Mon, Apr 21, 2025 at 01:51:06PM +0800, Su Hui wrote: > > > > @@ -433,7 +434,7 @@ static inline struct aead_request > > *aead_request_alloc(struct crypto_aead *tfm, > > { > > struct aead_request *req; > > > > - req = kmalloc(

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-21 Thread Paul Moore
On Mon, Apr 21, 2025 at 7:48 PM Alexei Starovoitov wrote: > On Mon, Apr 21, 2025 at 3:04 PM Paul Moore wrote: > > On Mon, Apr 21, 2025 at 4:13 PM Alexei Starovoitov > > wrote: > > > On Wed, Apr 16, 2025 at 10:31 AM Blaise Boscaccy > > > wrote: > > > > > > > > > Hacking into bpf internal objects

Re: [PATCH] crypto: using size_add() for kmalloc()

2025-04-21 Thread Su Hui
On 2025/4/21 20:05, Herbert Xu wrote: On Mon, Apr 21, 2025 at 01:51:06PM +0800, Su Hui wrote: @@ -433,7 +434,7 @@ static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm, { struct aead_request *req; - req = kmalloc(sizeof(*req) + crypto_aead_reqsize(tfm), gfp)

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-21 Thread Alexei Starovoitov
On Mon, Apr 21, 2025 at 3:04 PM Paul Moore wrote: > > On Mon, Apr 21, 2025 at 4:13 PM Alexei Starovoitov > wrote: > > On Wed, Apr 16, 2025 at 10:31 AM Blaise Boscaccy > > wrote: > > > > > > > Hacking into bpf internal objects like maps is not acceptable. > > > > > > We've heard your concerns abo

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-21 Thread Paul Moore
On Mon, Apr 21, 2025 at 4:13 PM Alexei Starovoitov wrote: > On Wed, Apr 16, 2025 at 10:31 AM Blaise Boscaccy > wrote: > > > > > Hacking into bpf internal objects like maps is not acceptable. > > > > We've heard your concerns about kern_sys_bpf and we agree that the LSM > > should not be calling i

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-21 Thread Alexei Starovoitov
On Wed, Apr 16, 2025 at 10:31 AM Blaise Boscaccy wrote: > > > Hacking into bpf internal objects like maps is not acceptable. > > We've heard your concerns about kern_sys_bpf and we agree that the LSM > should not be calling it. The proposal in this email should meet both of > our needs > https://l

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-21 Thread James Bottomley
On Mon, 2025-04-21 at 14:52 -0400, Paul Moore wrote: > On Sat, Apr 19, 2025 at 2:43 PM James Bottomley > wrote: > > On Fri, 2025-04-04 at 14:54 -0700, Blaise Boscaccy wrote: > > [...] > > > diff --git a/include/linux/kernel_read_file.h > > > b/include/linux/kernel_read_file.h > > > index 90451e2e1

Re: [PATCH v8 4/5] tpm: Add a driver for Loongson TPM device

2025-04-21 Thread Jarkko Sakkinen
On Fri, Apr 18, 2025 at 05:34:06PM +0800, Qunqin Zhao wrote: > Loongson Security Engine supports random number generation, hash, > symmetric encryption and asymmetric encryption. Based on these > encryption functions, TPM2 have been implemented in the Loongson > Security Engine firmware. This drive

Re: [PATCH v8 5/5] MAINTAINERS: Add tpm_loongson.c to LOONGSON CRYPTO DRIVER entry

2025-04-21 Thread Jarkko Sakkinen
On Fri, Apr 18, 2025 at 05:36:00PM +0800, Qunqin Zhao wrote: > Changes to Loongson TPM driver would be best reviewed by the Loongson > crypto driver maintainers. > > Signed-off-by: Qunqin Zhao > Reviewed-by: Jarkko Sakkinen > Reviewed-by: Huacai Chen > --- > v8: None > v7: Added tag from Jarkko

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-21 Thread Paul Moore
On Sat, Apr 19, 2025 at 2:43 PM James Bottomley wrote: > On Fri, 2025-04-04 at 14:54 -0700, Blaise Boscaccy wrote: > [...] > > diff --git a/include/linux/kernel_read_file.h > > b/include/linux/kernel_read_file.h > > index 90451e2e12bd..7ed9337be542 100644 > > --- a/include/linux/kernel_read_file.h

Re: [PATCH] crypto: using size_add() for kmalloc()

2025-04-21 Thread Herbert Xu
On Mon, Apr 21, 2025 at 01:51:06PM +0800, Su Hui wrote: > > @@ -433,7 +434,7 @@ static inline struct aead_request > *aead_request_alloc(struct crypto_aead *tfm, > { > struct aead_request *req; > > - req = kmalloc(sizeof(*req) + crypto_aead_reqsize(tfm), gfp); > + req = kmalloc(siz

Re: [PATCH] crypto: using size_add() for kmalloc()

2025-04-21 Thread Su Hui
On 2025/4/21 16:46, Su Hui wrote: On 2025/4/21 16:32, Christophe JAILLET wrote: Le 21/04/2025 à 09:43, Su Hui a écrit : On 2025/4/21 15:10, Christophe JAILLET wrote: Le 21/04/2025 à 07:51, Su Hui a écrit : It's safer to use size_add() to replace open-coded aithmetic in allocator arguments, b

Re: [PATCH] crypto: using size_add() for kmalloc()

2025-04-21 Thread Su Hui
On 2025/4/21 16:32, Christophe JAILLET wrote: Le 21/04/2025 à 09:43, Su Hui a écrit : On 2025/4/21 15:10, Christophe JAILLET wrote: Le 21/04/2025 à 07:51, Su Hui a écrit : It's safer to use size_add() to replace open-coded aithmetic in allocator arguments, because size_add() can prevent possi

Re: [PATCH] crypto: using size_add() for kmalloc()

2025-04-21 Thread Christophe JAILLET
Le 21/04/2025 à 09:43, Su Hui a écrit : On 2025/4/21 15:10, Christophe JAILLET wrote: Le 21/04/2025 à 07:51, Su Hui a écrit : It's safer to use size_add() to replace open-coded aithmetic in allocator arguments, because size_add() can prevent possible overflow problem. Signed-off-by: Su Hui -

Re: [PATCH] crypto: using size_add() for kmalloc()

2025-04-21 Thread Su Hui
On 2025/4/21 15:10, Christophe JAILLET wrote: Le 21/04/2025 à 07:51, Su Hui a écrit : It's safer to use size_add() to replace open-coded aithmetic in allocator arguments, because size_add() can prevent possible overflow problem. Signed-off-by: Su Hui ---   include/crypto/aead.h | 3 ++-  

Re: [PATCH] crypto: using size_add() for kmalloc()

2025-04-21 Thread Christophe JAILLET
Le 21/04/2025 à 07:51, Su Hui a écrit : It's safer to use size_add() to replace open-coded aithmetic in allocator arguments, because size_add() can prevent possible overflow problem. Signed-off-by: Su Hui --- include/crypto/aead.h | 3 ++- include/crypto/akcipher.h | 4 +++- include/cry

Re: [PATCH] crypto: using size_add() for kmalloc()

2025-04-20 Thread Su Hui
On 2025/4/21 13:51, Su Hui wrote: It's safer to use size_add() to replace open-coded aithmetic in allocator arguments, because size_add() can prevent possible overflow problem. Signed-off-by: Su Hui --- include/crypto/aead.h | 3 ++- include/crypto/akcipher.h | 4 +++- include/crypto/kp

Re: [PATCH v8 0/5] Add Loongson Security Engine chip driver

2025-04-20 Thread Huacai Chen
Hi, Qunqin, On Fri, Apr 18, 2025 at 5:33 PM Qunqin Zhao wrote: > > The Loongson Security Engine chip supports RNG, SM2, SM3 and SM4 > accelerator engines. Each engine have its own DMA buffer provided > by the controller. The kernel cannot directly send commands to the > engine and must first send

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-19 Thread James Bottomley
On Fri, 2025-04-04 at 14:54 -0700, Blaise Boscaccy wrote: [...] > diff --git a/include/linux/kernel_read_file.h > b/include/linux/kernel_read_file.h > index 90451e2e12bd..7ed9337be542 100644 > --- a/include/linux/kernel_read_file.h > +++ b/include/linux/kernel_read_file.h > @@ -14,6 +14,7 @@ >  

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-19 Thread Paul Moore
On Tue, Apr 15, 2025 at 3:08 PM Blaise Boscaccy wrote: > ... would you be ammenable to a simple patch in > skel_internal.h that freezes maps? e.g I have limited network access at the moment, so it is possible I've missed it, but I think it would be helpful to get a verdict on the RFC-esque patch

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-16 Thread Blaise Boscaccy
Alexei Starovoitov writes: > History repeats itself. > 1. the problem is hard. > 2. you're only interested in addressing your own use case. > There is no end-to-end design here and no attempt to > think it through how it will work for others. > Well, I suppose anything worth doing is going to be

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-15 Thread Alexei Starovoitov
to proceed with Hornet. If or when you actually figure out how to > sign an lskel and upstream updated LSM hooks, I can always rework Hornet > to use that instead. You can do whatever you want out-of-tree including re-exporting kern_sys_bpf. > code signing last week. All we are trying to do is ma

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-15 Thread Blaise Boscaccy
Blaise Boscaccy writes: > Alexei Starovoitov writes: > >> On Mon, Apr 14, 2025 at 5:32 PM Blaise Boscaccy >> wrote: >>> >>> Alexei Starovoitov writes: >>> >>> > On Sat, Apr 12, 2025 at 6:58 AM Blaise Boscaccy >>> > wrote: >>> >> >>> >> TAlexei Starovoitov writes: >>> >> >>> >> > On Fri, Apr

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-15 Thread Blaise Boscaccy
Alexei Starovoitov writes: > On Mon, Apr 14, 2025 at 5:32 PM Blaise Boscaccy > wrote: >> >> Alexei Starovoitov writes: >> >> > On Sat, Apr 12, 2025 at 6:58 AM Blaise Boscaccy >> > wrote: >> >> >> >> TAlexei Starovoitov writes: >> >> >> >> > On Fri, Apr 4, 2025 at 2:56 PM Blaise Boscaccy >> >>

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-14 Thread Alexei Starovoitov
On Mon, Apr 14, 2025 at 5:32 PM Blaise Boscaccy wrote: > > Alexei Starovoitov writes: > > > On Sat, Apr 12, 2025 at 6:58 AM Blaise Boscaccy > > wrote: > >> > >> TAlexei Starovoitov writes: > >> > >> > On Fri, Apr 4, 2025 at 2:56 PM Blaise Boscaccy > >> > wrote: > >> >> + > >> >> +static int ho

Re: [PATCH v2 1/4] security: Hornet LSM

2025-04-14 Thread Paul Moore
On Mon, Apr 14, 2025 at 4:46 PM Blaise Boscaccy wrote: > Paul Moore writes: > > On Apr 4, 2025 Blaise Boscaccy wrote: ... > >> +static int hornet_check_binary(struct bpf_prog *prog, union bpf_attr > >> *attr, > >> + struct hornet_maps *maps) > >> +{ > >> +struct

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-14 Thread Blaise Boscaccy
Alexei Starovoitov writes: > On Sat, Apr 12, 2025 at 6:58 AM Blaise Boscaccy > wrote: >> >> TAlexei Starovoitov writes: >> >> > On Fri, Apr 4, 2025 at 2:56 PM Blaise Boscaccy >> > wrote: >> >> + >> >> +static int hornet_find_maps(struct bpf_prog *prog, struct hornet_maps >> >> *maps) >> >> +{

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-14 Thread Alexei Starovoitov
On Sat, Apr 12, 2025 at 6:58 AM Blaise Boscaccy wrote: > > TAlexei Starovoitov writes: > > > On Fri, Apr 4, 2025 at 2:56 PM Blaise Boscaccy > > wrote: > >> + > >> +static int hornet_find_maps(struct bpf_prog *prog, struct hornet_maps > >> *maps) > >> +{ > >> + struct bpf_insn *insn = prog

Re: [PATCH v2 1/4] security: Hornet LSM

2025-04-14 Thread Blaise Boscaccy
Paul Moore writes: > On Apr 4, 2025 Blaise Boscaccy wrote: >> >> This adds the Hornet Linux Security Module which provides signature >> verification of eBPF programs. This allows users to continue to >> maintain an invariant that all code running inside of the kernel has >> been signed. >> >>

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-14 Thread Blaise Boscaccy
Tyler Hicks writes: > On 2025-04-04 14:54:50, Blaise Boscaccy wrote: >> +static int hornet_verify_lskel(struct bpf_prog *prog, struct hornet_maps >> *maps, >> + void *sig, size_t sig_len) >> +{ >> +int fd; >> +u32 i; >> +void *buf; >> +void *new; >> +

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-14 Thread Paul Moore
On Sat, Apr 12, 2025 at 9:58 AM Blaise Boscaccy wrote: > Alexei Starovoitov writes: > > On Fri, Apr 4, 2025 at 2:56 PM Blaise Boscaccy > > wrote: ... > > Above are serious layering violations. > > LSMs should not be looking that deep into bpf instructions. > > These aren't BPF internals; this

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-12 Thread Blaise Boscaccy
Alexei Starovoitov writes: > On Fri, Apr 11, 2025 at 5:30 PM Matteo Croce wrote: >> >> Il giorno sab 12 apr 2025 alle ore 02:19 Alexei Starovoitov >> ha scritto: >> >> Similar to what I proposed here? >> >> https://lore.kernel.org/bpf/20211203191844.69709-2-mcr...@linux.microsoft.com/ > ... >>

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-12 Thread Blaise Boscaccy
TAlexei Starovoitov writes: > On Fri, Apr 4, 2025 at 2:56 PM Blaise Boscaccy > wrote: >> + >> +static int hornet_find_maps(struct bpf_prog *prog, struct hornet_maps *maps) >> +{ >> + struct bpf_insn *insn = prog->insnsi; >> + int insn_cnt = prog->len; >> + int i; >> + int

Re: [PATCH v8] KEYS: Add a list for unreferenced keys

2025-04-12 Thread Jarkko Sakkinen
On Sat, Apr 12, 2025 at 04:30:24AM +0300, Jarkko Sakkinen wrote: > On Fri, Apr 11, 2025 at 11:37:25PM +0300, Jarkko Sakkinen wrote: > > On Fri, Apr 11, 2025 at 04:59:11PM +0100, David Howells wrote: > > > Jarkko Sakkinen wrote: > > > > > > > + spin_lock_irqsave(&key_graveyard_lock, flags);

Re: [PATCH v8] KEYS: Add a list for unreferenced keys

2025-04-11 Thread Jarkko Sakkinen
On Fri, Apr 11, 2025 at 11:37:25PM +0300, Jarkko Sakkinen wrote: > On Fri, Apr 11, 2025 at 04:59:11PM +0100, David Howells wrote: > > Jarkko Sakkinen wrote: > > > > > + spin_lock_irqsave(&key_graveyard_lock, flags); > > > + list_splice_init(&key_graveyard, &graveyard); > > > + spin_unlock_irqrest

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-11 Thread Alexei Starovoitov
On Fri, Apr 11, 2025 at 5:30 PM Matteo Croce wrote: > > Il giorno sab 12 apr 2025 alle ore 02:19 Alexei Starovoitov > ha scritto: > > Similar to what I proposed here? > > https://lore.kernel.org/bpf/20211203191844.69709-2-mcr...@linux.microsoft.com/ ... > @@ -1346,6 +1346,8 @@ union bpf_attr { >

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-11 Thread Matteo Croce
Il giorno sab 12 apr 2025 alle ore 02:19 Alexei Starovoitov ha scritto: Similar to what I proposed here? https://lore.kernel.org/bpf/20211203191844.69709-2-mcr...@linux.microsoft.com/ > The verification of module signatures is a job of the module loading process. > The same thing should be done

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-11 Thread Alexei Starovoitov
On Fri, Apr 4, 2025 at 2:56 PM Blaise Boscaccy wrote: > + > +static int hornet_find_maps(struct bpf_prog *prog, struct hornet_maps *maps) > +{ > + struct bpf_insn *insn = prog->insnsi; > + int insn_cnt = prog->len; > + int i; > + int err; > + > + for (i = 0; i < insn_

Re: [PATCH v2 1/4] security: Hornet LSM

2025-04-11 Thread Paul Moore
On Apr 4, 2025 Blaise Boscaccy wrote: > > This adds the Hornet Linux Security Module which provides signature > verification of eBPF programs. This allows users to continue to > maintain an invariant that all code running inside of the kernel has > been signed. > > The primary target for signat

Re: [PATCH v8] KEYS: Add a list for unreferenced keys

2025-04-11 Thread Jarkko Sakkinen
On Fri, Apr 11, 2025 at 11:37:25PM +0300, Jarkko Sakkinen wrote: > > This is going to enable and disable interrupts twice and that can be > > expensive, depending on the arch. I wonder if it would be better to do: > > > > local_irq_save(flags); > > spin_loc

Re: [PATCH v8] KEYS: Add a list for unreferenced keys

2025-04-11 Thread Jarkko Sakkinen
On Fri, Apr 11, 2025 at 04:59:11PM +0100, David Howells wrote: > Jarkko Sakkinen wrote: > > > + spin_lock_irqsave(&key_graveyard_lock, flags); > > + list_splice_init(&key_graveyard, &graveyard); > > + spin_unlock_irqrestore(&key_graveyard_lock, flags); > > I would wrap this bit in a check

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-11 Thread Tyler Hicks
On 2025-04-04 14:54:50, Blaise Boscaccy wrote: > +static int hornet_verify_lskel(struct bpf_prog *prog, struct hornet_maps > *maps, > +void *sig, size_t sig_len) > +{ > + int fd; > + u32 i; > + void *buf; > + void *new; > + size_t buf_sz; > + str

Re: [PATCH v8] KEYS: Add a list for unreferenced keys

2025-04-11 Thread David Howells
Jarkko Sakkinen wrote: > + spin_lock_irqsave(&key_graveyard_lock, flags); > + list_splice_init(&key_graveyard, &graveyard); > + spin_unlock_irqrestore(&key_graveyard_lock, flags); I would wrap this bit in a check to see if key_graveyard is empty so that we can avoid disabling irqs an

Re: [PATCH v7 3/6] crypto: loongson - add Loongson RNG driver support

2025-04-10 Thread Qunqin Zhao
在 2025/4/6 下午5:05, Huacai Chen 写道: Hi, Qunqin, On Thu, Apr 3, 2025 at 10:46 AM Qunqin Zhao wrote: Loongson's Random Number Generator is found inside Loongson security engine. Co-developed-by: Yinggang Gu Signed-off-by: Yinggang Gu Signed-off-by: Qunqin Zhao Reviewed-by: Huacai Chen ---

Re: [PATCH v4] tpm: Mask TPM RC in tpm2_start_auth_session()

2025-04-10 Thread Jarkko Sakkinen
On Mon, Apr 07, 2025 at 03:51:21PM +0200, Stefano Garzarella wrote: > On Mon, Apr 07, 2025 at 03:28:05PM +0300, Jarkko Sakkinen wrote: > > tpm2_start_auth_session() does not mask TPM RC correctly from the callers: > > > > [ 28.766528] tpm tpm0: A TPM error (2307) occurred start auth session > >

Re: [PATCH v7 3/6] crypto: loongson - add Loongson RNG driver support

2025-04-10 Thread Qunqin Zhao
在 2025/4/7 下午12:04, Herbert Xu 写道: On Thu, Apr 03, 2025 at 10:46:42AM +0800, Qunqin Zhao wrote: Loongson's Random Number Generator is found inside Loongson security engine. Is this a hardware RNG or a pseudo RNG? If it's pseudo, it should provide a means of reseeding. Will provide a means o

Re: [PATCH v8] KEYS: Add a list for unreferenced keys

2025-04-10 Thread Jarkko Sakkinen
On Tue, Apr 08, 2025 at 07:01:47PM +0300, Jarkko Sakkinen wrote: > On Mon, Apr 07, 2025 at 03:58:01PM +0300, Jarkko Sakkinen wrote: > > From: Jarkko Sakkinen > > > > Add an isolated list of unreferenced keys to be queued for deletion, and > > try to pin the keys in the garbage collector before pr

Re: [PATCH v4] tpm: Mask TPM RC in tpm2_start_auth_session()

2025-04-08 Thread Jarkko Sakkinen
On Mon, Apr 07, 2025 at 09:13:37PM +0300, Jarkko Sakkinen wrote: > On Mon, Apr 07, 2025 at 03:51:21PM +0200, Stefano Garzarella wrote: > > On Mon, Apr 07, 2025 at 03:28:05PM +0300, Jarkko Sakkinen wrote: > > > tpm2_start_auth_session() does not mask TPM RC correctly from the callers: > > > > > > [

Re: [PATCH v8] KEYS: Add a list for unreferenced keys

2025-04-08 Thread Jarkko Sakkinen
On Mon, Apr 07, 2025 at 03:58:01PM +0300, Jarkko Sakkinen wrote: > From: Jarkko Sakkinen > > Add an isolated list of unreferenced keys to be queued for deletion, and > try to pin the keys in the garbage collector before processing anything. > Skip unpinnable keys. > > Use this list for blocking

Re: [PATCH v4] tpm: Mask TPM RC in tpm2_start_auth_session()

2025-04-07 Thread Stefano Garzarella
On Mon, Apr 07, 2025 at 03:28:05PM +0300, Jarkko Sakkinen wrote: tpm2_start_auth_session() does not mask TPM RC correctly from the callers: [ 28.766528] tpm tpm0: A TPM error (2307) occurred start auth session Process TPM RCs inside tpm2_start_auth_session(), and map them to POSIX error codes

Re: [PATCH v3] tpm: Mask TPM RC in tpm2_start_auth_session()

2025-04-07 Thread Stefano Garzarella
On Mon, Apr 07, 2025 at 02:30:05PM +0300, Jarkko Sakkinen wrote: On Mon, Apr 07, 2025 at 10:04:09AM +0200, Stefano Garzarella wrote: On Mon, Apr 07, 2025 at 10:20:57AM +0300, Jarkko Sakkinen wrote: > tpm2_start_auth_session() does not mask TPM RC correctly from the callers: > > [ 28.766528] tp

Re: [PATCH v7] KEYS: Add a list for unreferenced keys

2025-04-07 Thread Jarkko Sakkinen
On Mon, Apr 07, 2025 at 02:42:34PM +0200, Marek Szyprowski wrote: > On 07.04.2025 14:08, Jarkko Sakkinen wrote: > > On Mon, Apr 07, 2025 at 02:23:49PM +0300, Jarkko Sakkinen wrote: > >> On Mon, Apr 07, 2025 at 12:25:11PM +0200, Marek Szyprowski wrote: > >>> On 07.04.2025 04:39, Jarkko Sakkinen wrot

Re: [PATCH v7] KEYS: Add a list for unreferenced keys

2025-04-07 Thread Marek Szyprowski
On 07.04.2025 14:08, Jarkko Sakkinen wrote: > On Mon, Apr 07, 2025 at 02:23:49PM +0300, Jarkko Sakkinen wrote: >> On Mon, Apr 07, 2025 at 12:25:11PM +0200, Marek Szyprowski wrote: >>> On 07.04.2025 04:39, Jarkko Sakkinen wrote: From: Jarkko Sakkinen Add an isolated list of unreferen

Re: [PATCH v4] tpm: Mask TPM RC in tpm2_start_auth_session()

2025-04-07 Thread Jarkko Sakkinen
On Mon, Apr 07, 2025 at 03:28:05PM +0300, Jarkko Sakkinen wrote: > tpm2_start_auth_session() does not mask TPM RC correctly from the callers: > > [ 28.766528] tpm tpm0: A TPM error (2307) occurred start auth session > > Process TPM RCs inside tpm2_start_auth_session(), and map them to POSIX > e

Re: [PATCH v7] KEYS: Add a list for unreferenced keys

2025-04-07 Thread Jarkko Sakkinen
On Mon, Apr 07, 2025 at 02:23:49PM +0300, Jarkko Sakkinen wrote: > On Mon, Apr 07, 2025 at 12:25:11PM +0200, Marek Szyprowski wrote: > > On 07.04.2025 04:39, Jarkko Sakkinen wrote: > > > From: Jarkko Sakkinen > > > > > > Add an isolated list of unreferenced keys to be queued for deletion, and > >

Re: [PATCH v3] tpm: Mask TPM RC in tpm2_start_auth_session()

2025-04-07 Thread Jarkko Sakkinen
On Mon, Apr 07, 2025 at 10:04:09AM +0200, Stefano Garzarella wrote: > On Mon, Apr 07, 2025 at 10:20:57AM +0300, Jarkko Sakkinen wrote: > > tpm2_start_auth_session() does not mask TPM RC correctly from the callers: > > > > [ 28.766528] tpm tpm0: A TPM error (2307) occurred start auth session > >

Re: [PATCH v7] KEYS: Add a list for unreferenced keys

2025-04-07 Thread Jarkko Sakkinen
On Mon, Apr 07, 2025 at 12:25:11PM +0200, Marek Szyprowski wrote: > On 07.04.2025 04:39, Jarkko Sakkinen wrote: > > From: Jarkko Sakkinen > > > > Add an isolated list of unreferenced keys to be queued for deletion, and > > try to pin the keys in the garbage collector before processing anything. >

Re: [PATCH v7] KEYS: Add a list for unreferenced keys

2025-04-07 Thread Marek Szyprowski
>patch (sorry). > v3: > - Using spin_lock() fails since key_put() is executed inside IRQs. >Using spin_lock_irqsave() would neither work given the lock is >acquired for /proc/keys. Therefore, separate the lock for >graveyard and key_graveyard before reaping

Re: [PATCH v3] tpm: Mask TPM RC in tpm2_start_auth_session()

2025-04-07 Thread Stefano Garzarella
On Mon, Apr 07, 2025 at 10:20:57AM +0300, Jarkko Sakkinen wrote: tpm2_start_auth_session() does not mask TPM RC correctly from the callers: [ 28.766528] tpm tpm0: A TPM error (2307) occurred start auth session Process TPM RCs inside tpm2_start_auth_session(), and map them to POSIX error codes

Re: [PATCH v7 1/6] mfd: Add support for Loongson Security Module

2025-04-07 Thread Qunqin Zhao
Hi, Lee 在 2025/4/5 上午12:06, Lee Jones 写道: On Thu, 03 Apr 2025, Qunqin Zhao wrote: This driver supports Loongson Security Module, which provides the control for it's hardware encryption acceleration child devices. Co-developed-by: Yinggang Gu Signed-off-by: Yinggang Gu Signed-off-by: Qunqi

Re: [PATCH] hwrng: core - Add WARN_ON for buggy read return values

2025-04-06 Thread Herbert Xu
On Tue, Oct 08, 2024 at 02:28:27AM +0300, Jarkko Sakkinen wrote: > > I guess it is TPM2_StartAuthSession returning TPM_RC_VALUE. Probably > James should look into this as the bus encryption code is clearly > tripping here. OK I've just got a confirmation from the lkp that the tpm RNG is indeed bug

Re: [PATCH v7 3/6] crypto: loongson - add Loongson RNG driver support

2025-04-06 Thread Herbert Xu
On Thu, Apr 03, 2025 at 10:46:42AM +0800, Qunqin Zhao wrote: > Loongson's Random Number Generator is found inside Loongson security > engine. Is this a hardware RNG or a pseudo RNG? If it's pseudo, it should provide a means of reseeding. If it's a hardware RNG it should register with hwrng. Chee

Re: [PATCH v5] KEYS: Add a list for unreferenced keys

2025-04-06 Thread Jarkko Sakkinen
On Mon, Apr 07, 2025 at 03:10:45AM +0300, Jarkko Sakkinen wrote: > From: Jarkko Sakkinen > > Add an isolated list of unreferenced keys to be queued for deletion, and > try to pin the keys in the garbage collector before processing anything. > Skip unpinnable keys. > > Use this list for blocking

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-06 Thread kernel test robot
Hi Blaise, kernel test robot noticed the following build errors: [auto build test ERROR on shuah-kselftest/next] [also build test ERROR on shuah-kselftest/fixes herbert-cryptodev-2.6/master herbert-crypto-2.6/master masahiroy-kbuild/for-next masahiroy-kbuild/fixes v6.14] [cannot apply to linus/

Re: [PATCH v7 3/6] crypto: loongson - add Loongson RNG driver support

2025-04-06 Thread Huacai Chen
Hi, Qunqin, On Thu, Apr 3, 2025 at 10:46 AM Qunqin Zhao wrote: > > Loongson's Random Number Generator is found inside Loongson security > engine. > > Co-developed-by: Yinggang Gu > Signed-off-by: Yinggang Gu > Signed-off-by: Qunqin Zhao > Reviewed-by: Huacai Chen > --- > v7: Change the lsrng_

Re: [PATCH v2 security-next 1/4] security: Hornet LSM

2025-04-05 Thread kernel test robot
Hi Blaise, kernel test robot noticed the following build errors: [auto build test ERROR on shuah-kselftest/next] [also build test ERROR on shuah-kselftest/fixes herbert-cryptodev-2.6/master herbert-crypto-2.6/master masahiroy-kbuild/for-next masahiroy-kbuild/fixes v6.14] [cannot apply to linus/

  1   2   3   4   5   6   7   8   9   10   >