lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210114110552.1522-1-xypron.glpk@gmx.de>
Date:   Thu, 14 Jan 2021 12:05:52 +0100
From:   Heinrich Schuchardt <xypron.glpk@....de>
To:     Ivan Hu <ivan.hu@...onical.com>, Ard Biesheuvel <ardb@...nel.org>
Cc:     linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org,
        Heinrich Schuchardt <xypron.glpk@....de>
Subject: [PATCH 1/1] efi/efi_test: read Revision

For testing UEFI conformance using the Firmware Test Suite it is necessary
to know the revision of the UEFI specification followed by the firmware.

With this patch an IOCTL call is provided to read the value of the field
Revision of the UEFI system table , e.g.

    #define EFI_RUNTIME_GET_REVISION \
            _IOR('p', 0x0D, unsigned int)
    unsigned int revision;
    fd = open("/dev/efi_test", O_RDWR);
    ret = ioctl(fd, EFI_RUNTIME_GET_REVISION, &revision);

For UEFI specification 2.8 this will yield

    revision == 0x250 == (2 << 16) | 80

Signed-off-by: Heinrich Schuchardt <xypron.glpk@....de>
---
For testing you can use:
https://github.com/xypron/rtmask
---
 drivers/firmware/efi/test/efi_test.c | 16 ++++++++++++++++
 drivers/firmware/efi/test/efi_test.h |  3 +++
 2 files changed, 19 insertions(+)

diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/test/efi_test.c
index 47d67bb0a516..115e2c8ca8cf 100644
--- a/drivers/firmware/efi/test/efi_test.c
+++ b/drivers/firmware/efi/test/efi_test.c
@@ -676,6 +676,19 @@ static long efi_runtime_get_supported_mask(unsigned long arg)
 	return rv;
 }

+static long efi_runtime_get_revision(unsigned long arg)
+{
+	unsigned int __user *revision;
+	int rv = 0;
+
+	revision = (unsigned int *)arg;
+
+	if (put_user(efi.runtime_version, revision))
+		rv = -EFAULT;
+
+	return rv;
+}
+
 static long efi_test_ioctl(struct file *file, unsigned int cmd,
 							unsigned long arg)
 {
@@ -715,6 +728,9 @@ static long efi_test_ioctl(struct file *file, unsigned int cmd,

 	case EFI_RUNTIME_GET_SUPPORTED_MASK:
 		return efi_runtime_get_supported_mask(arg);
+
+	case EFI_RUNTIME_GET_REVISION:
+		return efi_runtime_get_revision(arg);
 	}

 	return -ENOTTY;
diff --git a/drivers/firmware/efi/test/efi_test.h b/drivers/firmware/efi/test/efi_test.h
index 117349e57993..c8ab162256c8 100644
--- a/drivers/firmware/efi/test/efi_test.h
+++ b/drivers/firmware/efi/test/efi_test.h
@@ -121,4 +121,7 @@ struct efi_resetsystem {
 #define EFI_RUNTIME_GET_SUPPORTED_MASK \
 	_IOR('p', 0x0C, unsigned int)

+#define EFI_RUNTIME_GET_REVISION \
+	_IOR('p', 0x0D, unsigned int)
+
 #endif /* _DRIVERS_FIRMWARE_EFI_TEST_H_ */
--
2.29.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ