diff mbox series

[v11,10/14] HP BIOSCFG driver - passwdattr-interface

Message ID 20230420165454.9517-11-jorge.lopez2@hp.com (mailing list archive)
State Changes Requested, archived
Headers show
Series HP BIOSCFG driver | expand

Commit Message

Jorge Lopez April 20, 2023, 4:54 p.m. UTC
HP BIOS Configuration driver purpose is to provide a driver supporting
the latest sysfs class firmware attributes framework allowing the user
to change BIOS settings and security solutions on HP Inc.’s commercial
notebooks.

Many features of HP Commercial notebooks can be managed using Windows
Management Instrumentation (WMI). WMI is an implementation of Web-Based
Enterprise Management (WBEM) that provides a standards-based interface
for changing and monitoring system settings. HP BIOSCFG driver provides
a native Linux solution and the exposed features facilitates the
migration to Linux environments.

The Linux security features to be provided in hp-bioscfg driver enables
managing the BIOS settings and security solutions via sysfs, a virtual
filesystem that can be used by user-mode applications. The new
documentation cover HP-specific firmware sysfs attributes such Secure
Platform Management and Sure Start. Each section provides security
feature description and identifies sysfs directories and files exposed
by the driver.

Many HP Commercial notebooks include a feature called Secure Platform
Management (SPM), which replaces older password-based BIOS settings
management with public key cryptography. PC secure product management
begins when a target system is provisioned with cryptographic keys
that are used to ensure the integrity of communications between system
management utilities and the BIOS.

HP Commercial notebooks have several BIOS settings that control its
behaviour and capabilities, many of which are related to security.
To prevent unauthorized changes to these settings, the system can
be configured to use a cryptographic signature-based authorization
string that the BIOS will use to verify authorization to modify the
setting.

Linux Security components are under development and not published yet.
The only linux component is the driver (hp bioscfg) at this time.
Other published security components are under Windows.

Signed-off-by: Jorge Lopez <jorge.lopez2@hp.com>

---
Based on the latest platform-drivers-x86.git/for-next
---
 .../x86/hp/hp-bioscfg/passwdattr-interface.c  | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 drivers/platform/x86/hp/hp-bioscfg/passwdattr-interface.c

Comments

Thomas Weißschuh April 23, 2023, 12:58 p.m. UTC | #1
On 2023-04-20 11:54:50-0500, Jorge Lopez wrote:
> ---
>  .../x86/hp/hp-bioscfg/passwdattr-interface.c  | 51 +++++++++++++++++++
>  1 file changed, 51 insertions(+)
>  create mode 100644 drivers/platform/x86/hp/hp-bioscfg/passwdattr-interface.c
> 
> diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdattr-interface.c b/drivers/platform/x86/hp/hp-bioscfg/passwdattr-interface.c
> new file mode 100644
> index 000000000000..02fc766eb3cf
> --- /dev/null
> +++ b/drivers/platform/x86/hp/hp-bioscfg/passwdattr-interface.c
> @@ -0,0 +1,51 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Functions corresponding to SET password methods under
> + * HP_WMI_SET_BIOS_SETTING_GUID for use with hp-bioscfg driver.
> + *
> + * Copyright (c) 2022 Hewlett-Packard Inc.
> + */
> +
> +#include <linux/wmi.h>
> +#include "bioscfg.h"
> +
> +static int bios_attr_pass_interface_probe(struct wmi_device *wdev,
> +					  const void *context)
> +{
> +	mutex_lock(&bioscfg_drv.mutex);
> +	bioscfg_drv.password_attr_wdev = wdev;

This wdev is never used. It seems this full subdriver can be dropped.
Or the one UUID-based callsite using the same UUID can use the driver.

> +	mutex_unlock(&bioscfg_drv.mutex);
> +	return 0;
> +}
> +
> +static void bios_attr_pass_interface_remove(struct wmi_device *wdev)
> +{
> +	mutex_lock(&bioscfg_drv.mutex);
> +	bioscfg_drv.password_attr_wdev = NULL;
> +	mutex_unlock(&bioscfg_drv.mutex);
> +}
> +
> +static const struct wmi_device_id bios_attr_pass_interface_id_table[] = {
> +	{ .guid_string = HP_WMI_SET_BIOS_SETTING_GUID },
> +	{ },

No comma after end-of-array marker.

> +};
> +static struct wmi_driver bios_attr_pass_interface_driver = {
> +	.driver = {
> +		.name = DRIVER_NAME"-password"
> +	},
> +	.probe = bios_attr_pass_interface_probe,
> +	.remove = bios_attr_pass_interface_remove,
> +	.id_table = bios_attr_pass_interface_id_table,
> +};
> +
> +int init_bios_attr_pass_interface(void)
> +{
> +	return wmi_driver_register(&bios_attr_pass_interface_driver);
> +}
> +
> +void exit_bios_attr_pass_interface(void)
> +{
> +	wmi_driver_unregister(&bios_attr_pass_interface_driver);
> +}
> +
> +MODULE_DEVICE_TABLE(wmi, bios_attr_pass_interface_id_table);
> -- 
> 2.34.1
>
Jorge Lopez May 3, 2023, 9:16 p.m. UTC | #2
On Sun, Apr 23, 2023 at 7:58 AM Thomas Weißschuh <thomas@t-8ch.de> wrote:
>
> On 2023-04-20 11:54:50-0500, Jorge Lopez wrote:
> > ---
> >  .../x86/hp/hp-bioscfg/passwdattr-interface.c  | 51 +++++++++++++++++++
> >  1 file changed, 51 insertions(+)
> >  create mode 100644 drivers/platform/x86/hp/hp-bioscfg/passwdattr-interface.c
> >
> > diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdattr-interface.c b/drivers/platform/x86/hp/hp-bioscfg/passwdattr-interface.c
> > new file mode 100644
> > index 000000000000..02fc766eb3cf
> > --- /dev/null
> > +++ b/drivers/platform/x86/hp/hp-bioscfg/passwdattr-interface.c
> > @@ -0,0 +1,51 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Functions corresponding to SET password methods under
> > + * HP_WMI_SET_BIOS_SETTING_GUID for use with hp-bioscfg driver.
> > + *
> > + * Copyright (c) 2022 Hewlett-Packard Inc.
> > + */
> > +
> > +#include <linux/wmi.h>
> > +#include "bioscfg.h"
> > +
> > +static int bios_attr_pass_interface_probe(struct wmi_device *wdev,
> > +                                       const void *context)
> > +{
> > +     mutex_lock(&bioscfg_drv.mutex);
> > +     bioscfg_drv.password_attr_wdev = wdev;
>
> This wdev is never used. It seems this full subdriver can be dropped.
> Or the one UUID-based callsite using the same UUID can use the driver.

I will remove the subdriver.

>
> > +     mutex_unlock(&bioscfg_drv.mutex);
> > +     return 0;
> > +}
> > +
> > +static void bios_attr_pass_interface_remove(struct wmi_device *wdev)
> > +{
> > +     mutex_lock(&bioscfg_drv.mutex);
> > +     bioscfg_drv.password_attr_wdev = NULL;
> > +     mutex_unlock(&bioscfg_drv.mutex);
> > +}
> > +
> > +static const struct wmi_device_id bios_attr_pass_interface_id_table[] = {
> > +     { .guid_string = HP_WMI_SET_BIOS_SETTING_GUID },
> > +     { },
>
> No comma after end-of-array marker.
>
> > +};
> > +static struct wmi_driver bios_attr_pass_interface_driver = {
> > +     .driver = {
> > +             .name = DRIVER_NAME"-password"
> > +     },
> > +     .probe = bios_attr_pass_interface_probe,
> > +     .remove = bios_attr_pass_interface_remove,
> > +     .id_table = bios_attr_pass_interface_id_table,
> > +};
> > +
> > +int init_bios_attr_pass_interface(void)
> > +{
> > +     return wmi_driver_register(&bios_attr_pass_interface_driver);
> > +}
> > +
> > +void exit_bios_attr_pass_interface(void)
> > +{
> > +     wmi_driver_unregister(&bios_attr_pass_interface_driver);
> > +}
> > +
> > +MODULE_DEVICE_TABLE(wmi, bios_attr_pass_interface_id_table);
> > --
> > 2.34.1
> >
diff mbox series

Patch

diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdattr-interface.c b/drivers/platform/x86/hp/hp-bioscfg/passwdattr-interface.c
new file mode 100644
index 000000000000..02fc766eb3cf
--- /dev/null
+++ b/drivers/platform/x86/hp/hp-bioscfg/passwdattr-interface.c
@@ -0,0 +1,51 @@ 
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Functions corresponding to SET password methods under
+ * HP_WMI_SET_BIOS_SETTING_GUID for use with hp-bioscfg driver.
+ *
+ * Copyright (c) 2022 Hewlett-Packard Inc.
+ */
+
+#include <linux/wmi.h>
+#include "bioscfg.h"
+
+static int bios_attr_pass_interface_probe(struct wmi_device *wdev,
+					  const void *context)
+{
+	mutex_lock(&bioscfg_drv.mutex);
+	bioscfg_drv.password_attr_wdev = wdev;
+	mutex_unlock(&bioscfg_drv.mutex);
+	return 0;
+}
+
+static void bios_attr_pass_interface_remove(struct wmi_device *wdev)
+{
+	mutex_lock(&bioscfg_drv.mutex);
+	bioscfg_drv.password_attr_wdev = NULL;
+	mutex_unlock(&bioscfg_drv.mutex);
+}
+
+static const struct wmi_device_id bios_attr_pass_interface_id_table[] = {
+	{ .guid_string = HP_WMI_SET_BIOS_SETTING_GUID },
+	{ },
+};
+static struct wmi_driver bios_attr_pass_interface_driver = {
+	.driver = {
+		.name = DRIVER_NAME"-password"
+	},
+	.probe = bios_attr_pass_interface_probe,
+	.remove = bios_attr_pass_interface_remove,
+	.id_table = bios_attr_pass_interface_id_table,
+};
+
+int init_bios_attr_pass_interface(void)
+{
+	return wmi_driver_register(&bios_attr_pass_interface_driver);
+}
+
+void exit_bios_attr_pass_interface(void)
+{
+	wmi_driver_unregister(&bios_attr_pass_interface_driver);
+}
+
+MODULE_DEVICE_TABLE(wmi, bios_attr_pass_interface_id_table);