* [PATCH ima-evm-utils] Add sanity check for file parameter of ima_boot_aggregate
@ 2020-07-17 12:04 Petr Vorel
2020-07-19 13:57 ` Mimi Zohar
0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2020-07-17 12:04 UTC (permalink / raw)
To: linux-integrity; +Cc: Petr Vorel, Mimi Zohar
Parameter expects to be a copy of
/sys/kernel/security/tpm0/binary_bios_measurements (i.e. regular file,
not a directory, block or character device, socket, ...)
Fixes: f49e982 ("ima-evm-utils: read the TPM 1.2 binary_bios_measurements")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi Mimi,
feel free to modify this patchset to fits your needs (unless I'm wrong
and this should not be applied at all).
Kind regards,
Petr
src/evmctl.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/evmctl.c b/src/evmctl.c
index 04dc2ad..3ad5039 100644
--- a/src/evmctl.c
+++ b/src/evmctl.c
@@ -2082,6 +2082,13 @@ static int read_binary_bios_measurements(char *file, struct tpm_bank_info *bank)
int len;
int i;
+ struct stat s;
+ stat(file, &s);
+ if (!S_ISREG(s.st_mode)) {
+ log_errno("Not a regular file or link to regular file.\n");
+ return 1;
+ }
+
fp = fopen(file, "r");
if (!fp) {
log_errno("Failed to open TPM 1.2 event log.\n");
--
2.27.0.rc0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH ima-evm-utils] Add sanity check for file parameter of ima_boot_aggregate
2020-07-17 12:04 [PATCH ima-evm-utils] Add sanity check for file parameter of ima_boot_aggregate Petr Vorel
@ 2020-07-19 13:57 ` Mimi Zohar
2020-07-20 8:00 ` Petr Vorel
0 siblings, 1 reply; 4+ messages in thread
From: Mimi Zohar @ 2020-07-19 13:57 UTC (permalink / raw)
To: Petr Vorel, linux-integrity; +Cc: Mimi Zohar
On Fri, 2020-07-17 at 14:04 +0200, Petr Vorel wrote:
> Parameter expects to be a copy of
> /sys/kernel/security/tpm0/binary_bios_measurements (i.e. regular file,
> not a directory, block or character device, socket, ...)
>
> Fixes: f49e982 ("ima-evm-utils: read the TPM 1.2 binary_bios_measurements")
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Hi Mimi,
>
> feel free to modify this patchset to fits your needs (unless I'm wrong
> and this should not be applied at all).
>
Thanks! I made minor changes as noted below. A subsequent patch
makes a similar change for the new TPM 1.2 PCRs.
>
> src/evmctl.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/src/evmctl.c b/src/evmctl.c
> index 04dc2ad..3ad5039 100644
> --- a/src/evmctl.c
> +++ b/src/evmctl.c
> @@ -2082,6 +2082,13 @@ static int read_binary_bios_measurements(char *file, struct tpm_bank_info *bank)
> int len;
> int i;
>
> + struct stat s;
> + stat(file, &s);
Checked stat return code.
> + if (!S_ISREG(s.st_mode)) {
> + log_errno("Not a regular file or link to regular file.\n");
Prefixed message with "Bios event log: not ..."
> + return 1;
> + }
> +
> fp = fopen(file, "r");
> if (!fp) {
> log_errno("Failed to open TPM 1.2 event log.\n");
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH ima-evm-utils] Add sanity check for file parameter of ima_boot_aggregate
2020-07-19 13:57 ` Mimi Zohar
@ 2020-07-20 8:00 ` Petr Vorel
2020-07-20 11:48 ` Mimi Zohar
0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2020-07-20 8:00 UTC (permalink / raw)
To: Mimi Zohar; +Cc: linux-integrity, Mimi Zohar
Hi Mimi,
...
> Thanks! I made minor changes as noted below. A subsequent patch
> makes a similar change for the new TPM 1.2 PCRs.
+1 to all the changes. I guess you haven't pushed it yet.
Kind regards,
Petr
> > src/evmctl.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> > diff --git a/src/evmctl.c b/src/evmctl.c
> > index 04dc2ad..3ad5039 100644
> > --- a/src/evmctl.c
> > +++ b/src/evmctl.c
> > @@ -2082,6 +2082,13 @@ static int read_binary_bios_measurements(char *file, struct tpm_bank_info *bank)
> > int len;
> > int i;
> > + struct stat s;
> > + stat(file, &s);
> Checked stat return code.
> > + if (!S_ISREG(s.st_mode)) {
> > + log_errno("Not a regular file or link to regular file.\n");
> Prefixed message with "Bios event log: not ..."
...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH ima-evm-utils] Add sanity check for file parameter of ima_boot_aggregate
2020-07-20 8:00 ` Petr Vorel
@ 2020-07-20 11:48 ` Mimi Zohar
0 siblings, 0 replies; 4+ messages in thread
From: Mimi Zohar @ 2020-07-20 11:48 UTC (permalink / raw)
To: Petr Vorel; +Cc: linux-integrity, Mimi Zohar
On Mon, 2020-07-20 at 10:00 +0200, Petr Vorel wrote:
> Hi Mimi,
>
> ...
> > Thanks! I made minor changes as noted below. A subsequent patch
> > makes a similar change for the new TPM 1.2 PCRs.
> +1 to all the changes. I guess you haven't pushed it yet.
Thank you for the reviews. Everything is there now.
Mimi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-20 11:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 12:04 [PATCH ima-evm-utils] Add sanity check for file parameter of ima_boot_aggregate Petr Vorel
2020-07-19 13:57 ` Mimi Zohar
2020-07-20 8:00 ` Petr Vorel
2020-07-20 11:48 ` Mimi Zohar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).