[PATCH v2 4/4] ima_violations.sh: additional ToMToU violation tests

2025-03-04 Thread Mimi Zohar
Kernel patch "ima: limit the number of ToMToU integrity violations" prevents superfluous ToMToU violations. Add corresponding LTP tests. Link: https://lore.kernel.org/linux-integrity/20250228205505.476845-3-zo...@linux.ibm.com/ Signed-off-by: Mimi Zohar --- .../integrity/ima/tests/ima_violatio

[PATCH v2 1/4] ima_violations.sh: force $LOG ToMToU violation earlier

2025-03-04 Thread Mimi Zohar
Violation tests are dependent on searching the $LOG file, which may itself result in a ToMToU violation. Preempt getting an additional violation during the tests by forcing the $LOG ToMToU violation earlier. Signed-off-by: Mimi Zohar --- testcases/kernel/security/integrity/ima/tests/ima_violati

[PATCH v2 3/4] ima_violations.sh: additional open-writer violation tests

2025-03-04 Thread Mimi Zohar
Kernel patch "ima: limit the number of open-writers integrity violations" prevents superfluous "open-writers" violations. Add corresponding LTP tests. Link: https://lore.kernel.org/linux-integrity/20250228205505.476845-2-zo...@linux.ibm.com/ Signed-off-by: Mimi Zohar --- .../integrity/ima/test

Re: [RFC PATCH v2 4/6] tpm: add interface to interact with devices based on TCG Simulator

2025-03-04 Thread Stefano Garzarella
On Sat, Mar 01, 2025 at 03:48:35AM +0200, Jarkko Sakkinen wrote: On Fri, Feb 28, 2025 at 06:07:18PM +0100, Stefano Garzarella wrote: This is primarily designed to support an enlightened driver for the The commit message is half-way cut. I.e. it lacks the explanation of "this". AMD SVSM base

Re: [PATCH v2 1/4] ima_violations.sh: force $LOG ToMToU violation earlier

2025-03-04 Thread Mimi Zohar
On Tue, 2025-03-04 at 13:57 +0100, Petr Vorel wrote: > Hi Mimi, > > > Violation tests are dependent on searching the $LOG file, which may > > itself result in a ToMToU violation. Preempt getting an additional > > violation during the tests by forcing the $LOG ToMToU violation > > earlier. > > >

Re: [PATCH v2 2/4] ima_violations.sh: Update validate() to support multiple violations

2025-03-04 Thread Mimi Zohar
On Tue, 2025-03-04 at 09:44 -0500, Mimi Zohar wrote: > On Tue, 2025-03-04 at 14:31 +0100, Petr Vorel wrote: > > Hi Mimi, > > > > > Add support for the number of expected violations. Include the > > > expected number of violations in the output. > > > > Unfortunately this works only on fixed kern

Re: [PATCH v2 1/4] ima_violations.sh: force $LOG ToMToU violation earlier

2025-03-04 Thread Petr Vorel
Hi Mimi, ... > > > + exec 3< $LOG || tst_brk TBROK "failed to read log file" > > > tst_res TINFO "using log $LOG" > > If you don't mind, I would reverse the order to get info about which log is > > used: > > tst_res TINFO "using log $LOG" > > exec 3< $LOG || tst_brk TBROK "failed to re

Re: [PATCH v2 1/4] ima_violations.sh: force $LOG ToMToU violation earlier

2025-03-04 Thread Petr Vorel
Hi Mimi, > Violation tests are dependent on searching the $LOG file, which may > itself result in a ToMToU violation. Preempt getting an additional > violation during the tests by forcing the $LOG ToMToU violation > earlier. > Signed-off-by: Mimi Zohar > --- > testcases/kernel/security/integri

Re: [PATCH v2 2/4] ima_violations.sh: Update validate() to support multiple violations

2025-03-04 Thread Petr Vorel
Hi Mimi, > Add support for the number of expected violations. Include the > expected number of violations in the output. Unfortunately this works only on fixed kernel (e.g. the one with v1 of your "ima: limit both open-writers and ToMToU violations" kernel patchset [1] (I haven't built v2 [2], b

Re: [PATCH v2 2/4] ima_violations.sh: Update validate() to support multiple violations

2025-03-04 Thread Mimi Zohar
On Tue, 2025-03-04 at 14:31 +0100, Petr Vorel wrote: > Hi Mimi, > > > Add support for the number of expected violations. Include the > > expected number of violations in the output. > > Unfortunately this works only on fixed kernel (e.g. the one with v1 of your > "ima: limit both open-writers an

Re: [PATCH v2 2/4] ima_violations.sh: Update validate() to support multiple violations

2025-03-04 Thread Petr Vorel
> On Tue, 2025-03-04 at 09:44 -0500, Mimi Zohar wrote: > > On Tue, 2025-03-04 at 14:31 +0100, Petr Vorel wrote: > > > Hi Mimi, > > > > Add support for the number of expected violations. Include the > > > > expected number of violations in the output. > > > Unfortunately this works only on fixed

Re: [PATCH v4 0/5] Add support for the TPM FF-A start method

2025-03-04 Thread Jarkko Sakkinen
On Mon, 2025-03-03 at 12:55 -0400, Jason Gunthorpe wrote: > On Sun, Mar 02, 2025 at 09:33:59PM +0200, Jarkko Sakkinen wrote: > > WARNING: line length of 102 exceeds 100 columns > > #764: FILE: drivers/char/tpm/tpm_crb.c:821: > > + FW_BUG "TPM2 ACPI table has wrong > > s

Re: [RFC PATCH v2 4/6] tpm: add interface to interact with devices based on TCG Simulator

2025-03-04 Thread Jarkko Sakkinen
On Tue, Mar 04, 2025 at 04:23:51PM +0100, Stefano Garzarella wrote: > > This commit got me lost tbh. > > Now I understand why you got lost, my bad! No need for apologies, just merely reporting what I do or do not understand with brutal honesty ;-) > I checked further and these structures seem to

Re: [PATCH v2] arch/x86: Fix size overflows in sgx_encl_create()

2025-03-04 Thread Dave Hansen
On 3/4/25 16:19, Jarkko Sakkinen wrote: > On Tue, Mar 04, 2025 at 04:18:03PM -0800, Dave Hansen wrote: >> On 3/4/25 16:06, Jarkko Sakkinen wrote: >>> + /* >>> +* This is a micro-architectural requirement. ECREATE would detect this >>> +* too without mentionable overhead but this check gua

[PATCH v2] arch/x86: Fix size overflows in sgx_encl_create()

2025-03-04 Thread Jarkko Sakkinen
The total size calculated for EPC can overflow u64 given the added up page for SECS. Further, the total size calculated for shmem can overflow even when the EPC size stays within limits of u64, given that it adds the extra space for 128 byte PCMD structures (one for each page). Address this by pr

Re: [PATCH v2] arch/x86: Fix size overflows in sgx_encl_create()

2025-03-04 Thread Jarkko Sakkinen
On Wed, Mar 05, 2025 at 02:06:02AM +0200, Jarkko Sakkinen wrote: > The total size calculated for EPC can overflow u64 given the added up page > for SECS. Further, the total size calculated for shmem can overflow even > when the EPC size stays within limits of u64, given that it adds the extra > sp

Re: [PATCH v2] arch/x86: Fix size overflows in sgx_encl_create()

2025-03-04 Thread Dave Hansen
On 3/4/25 16:06, Jarkko Sakkinen wrote: > + /* > + * This is a micro-architectural requirement. ECREATE would detect this > + * too without mentionable overhead but this check guarantees also that > + * the space calculations for EPC and shmem allocations never overflow. > +

Re: [PATCH v2] arch/x86: Fix size overflows in sgx_encl_create()

2025-03-04 Thread Jarkko Sakkinen
On Tue, Mar 04, 2025 at 04:18:03PM -0800, Dave Hansen wrote: > On 3/4/25 16:06, Jarkko Sakkinen wrote: > > + /* > > +* This is a micro-architectural requirement. ECREATE would detect this > > +* too without mentionable overhead but this check guarantees also that > > +* the space calc

Re: [PATCH] ima_kexec.sh: Detect kernel image from BOOT_IMAGE from /proc/cmdline

2025-03-04 Thread Petr Vorel
Hi all, > Default value was suitable only for x86_64. This helps to use other > archs on distros which set $BOOT_IMAGE. FYI merged. Kind regards, Petr

Re: [PATCH] ima_selinux.sh: Require ima_policy=critical_data kernel cmdline

2025-03-04 Thread Petr Vorel
Hi all, > Test requires not only func=CRITICAL_DATA IMA policy content but also > ima_policy=critical_data kernel cmdline. Without cmdline no measures are > done. FYI merged. Kind regards, Petr > https://ima-doc.readthedocs.io/en/latest/ima-policy.html#ima-policy-critical-data > https://git.ker

[PATCH v2 2/4] ima_violations.sh: Update validate() to support multiple violations

2025-03-04 Thread Mimi Zohar
Add support for the number of expected violations. Include the expected number of violations in the output. Signed-off-by: Mimi Zohar --- .../security/integrity/ima/tests/ima_violations.sh | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/testcases/kernel/securi

Re: [RFC PATCH v2 3/6] tpm: add send_recv() ops in tpm_class_ops

2025-03-04 Thread Jarkko Sakkinen
On Mon, 2025-03-03 at 17:21 +0100, Stefano Garzarella wrote: > On Sat, Mar 01, 2025 at 03:45:10AM +0200, Jarkko Sakkinen wrote: > > On Fri, Feb 28, 2025 at 06:07:17PM +0100, Stefano Garzarella wrote: > > > + int (*send_recv)(struct tpm_chip *chip, u8 *buf, size_t > > > buf_len, > > > +

Re: [PATCH v2 2/4] ima_violations.sh: Update validate() to support multiple violations

2025-03-04 Thread Mimi Zohar
On Tue, 2025-03-04 at 18:43 +0100, Petr Vorel wrote: > > On Tue, 2025-03-04 at 09:44 -0500, Mimi Zohar wrote: > > > On Tue, 2025-03-04 at 14:31 +0100, Petr Vorel wrote: > > > > Hi Mimi, > > > > > > Add support for the number of expected violations. Include the > > > > > expected number of violati

Re: [RFC PATCH v2 3/6] tpm: add send_recv() ops in tpm_class_ops

2025-03-04 Thread Jarkko Sakkinen
On Tue, Mar 04, 2025 at 06:56:02PM +0200, Jarkko Sakkinen wrote: > On Mon, 2025-03-03 at 17:21 +0100, Stefano Garzarella wrote: > > On Sat, Mar 01, 2025 at 03:45:10AM +0200, Jarkko Sakkinen wrote: > > > On Fri, Feb 28, 2025 at 06:07:17PM +0100, Stefano Garzarella wrote: > > > > + int (*send_r

Re: [RFC PATCH v2 5/6] tpm: add SNP SVSM vTPM driver

2025-03-04 Thread Jarkko Sakkinen
On Mon, Mar 03, 2025 at 05:46:16PM +0100, Stefano Garzarella wrote: > On Sat, Mar 01, 2025 at 03:51:46AM +0200, Jarkko Sakkinen wrote: > > On Fri, Feb 28, 2025 at 06:07:19PM +0100, Stefano Garzarella wrote: > > > Add driver for the vTPM defined by the AMD SVSM spec [1]. > > > > > > The specificati

Re: [PATCH v2] arch/x86: Fix size overflows in sgx_encl_create()

2025-03-04 Thread Jarkko Sakkinen
On Tue, Mar 04, 2025 at 04:30:21PM -0800, Dave Hansen wrote: > On 3/4/25 16:19, Jarkko Sakkinen wrote: > > On Tue, Mar 04, 2025 at 04:18:03PM -0800, Dave Hansen wrote: > >> On 3/4/25 16:06, Jarkko Sakkinen wrote: > >>> + /* > >>> + * This is a micro-architectural requirement. ECREATE would detect