Skip to contentSkip to conversation

Introduce support for Systems Management Driver over WMI for Dell Systems

PATCH Superseded Divya Bharathi 4 participants 9 messages Sep 23, 2020 – Sep 25, 2020

Subsystems (3)

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 Introduce support for Systems Management Driver over WMI for Dell Systems

The Dell WMI Systems Management Driver provides a sysfs interface for systems management to enable BIOS configuration capability on certain Dell Systems.

This driver allows user to configure Dell systems with a uniform common interface. To facilitate this, the patch introduces a generic way for driver to be able to create configurable BIOS Attributes available in Setup (F2) screen.

Cc Hans de Goede <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc mark gross <[email protected]>

---

Changes from v3 to v4:
- Create a firmware-attributes class and tie ksets to a virtual device in it
- Make modifier and value_modifier "dell only" attributes.
- Correct some errors caught by kernel build bot around missing prototypes
- Remove mutexes from populate_* functions and put in init_dell_bios_attrib_wmi instead
- Move all code into a subdirectory drivers/platform/x86/dell-wmi-sysman and remove dell-wmi-* prefix on files
- Move all data structures into shared struct
- In alloc functions instead of kzalloc use kcalloc and check that there is no overflow
+ Same check for other alloc_foo-data functions
- populate_*: Move sysfs_create_group to end of the function to prevent race conditions
- Save kernel object into each data instance and only remove that rather than sysfs_remove_group
- Document in sysfs file what causes change uevents to come through
- Only notify with change uevent one time on multiple settings modifications
- Adjust lots of string handling
- Make more objects static
- Various whitespace corrections
- Document map_wmi_error properly
- Bump version to 5.11 (February 2021)

Changes from v2 to v3:
- Fix a possible NULL pointer error in init
- Add missing newlines to all dev_err/dev_dbg/pr_err/pr_debug statements
- Correct updating passwords when both Admin and System password are set
- Correct the WMI driver name
- Correct some namespace clashing when compiled into the kernel (Reported by Mark Gross)
- Correct some comment typos
- Adopt suggestions made by Hans:
+ Use single global mutex
+ Clarify reason for uevents with a comment
+ Remove functions for set and get current password
+ Rename lower_bound to min_value and upper_bound to max_value
+ Rename possible_value to possible_values
+ Remove references to float
+ Build a separate passwords directory again since it behaves differently from the other attributes
+ Move more calls from pr_err -> dev_err
- Documentation cleanups (see v2 patch feedback)
+ Grouping types
+ Syntax of modifier output

Changes from v1 to v2:
- use pr_fmt instead of pr_err(DRIVER_NAME
- re-order variables reverse xmas tree order
- correct returns of -1 to error codes
- correct usage of {} on some split line statements
- Refine all documentation deficiencies suggested by Hans
- Merge all attributes to a single directory
- Overhaul WMI interface interaction as suggested by Hans
* Move WMI driver registration to start of module
* Remove usage of lists that only use first entry for WMI interfaces
* Create a global structure shared across interface source files
* Make get_current_password function static
* Remove get_pending changes function, shared across global structure now.
- Overhaul use of mutexes
* Make kset list mutex shared across source files
* Remove unneeded dell-wmi-sysman call_mutex
* Keep remaining call_mutexes in WMI functions
- Move security area calculation into a function
- Use NLS helper for utf8->utf16 conversion

 .../testing/sysfs-class-firmware-attributes   | 199 ++++++
 MAINTAINERS                                   |   8 +
 drivers/platform/x86/Kconfig                  |  12 +
 drivers/platform/x86/Makefile                 |   1 +
 drivers/platform/x86/dell-wmi-sysman/Makefile |   8 +
 .../x86/dell-wmi-sysman/biosattr-interface.c  | 199 ++++++
 .../x86/dell-wmi-sysman/dell-wmi-sysman.h     | 196 ++++++
 .../x86/dell-wmi-sysman/enum-attributes.c     | 188 ++++++
 .../x86/dell-wmi-sysman/int-attributes.c      | 169 +++++
 .../x86/dell-wmi-sysman/passobj-attributes.c  | 153 +++++
 .../dell-wmi-sysman/passwordattr-interface.c  | 167 +++++
 .../x86/dell-wmi-sysman/string-attributes.c   | 156 +++++
 drivers/platform/x86/dell-wmi-sysman/sysman.c | 589 ++++++++++++++++++
 13 files changed, 2045 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-class-firmware-attributes
 create mode 100644 drivers/platform/x86/dell-wmi-sysman/Makefile
 create mode 100644 drivers/platform/x86/dell-wmi-sysman/biosattr-interface.c
 create mode 100644 drivers/platform/x86/dell-wmi-sysman/dell-wmi-sysman.h
 create mode 100644 drivers/platform/x86/dell-wmi-sysman/enum-attributes.c
 create mode 100644 drivers/platform/x86/dell-wmi-sysman/int-attributes.c
 create mode 100644 drivers/platform/x86/dell-wmi-sysman/passobj-attributes.c
 create mode 100644 drivers/platform/x86/dell-wmi-sysman/passwordattr-interface.c
 create mode 100644 drivers/platform/x86/dell-wmi-sysman/string-attributes.c
 create mode 100644 drivers/platform/x86/dell-wmi-sysman/sysman.c
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +199 -0
new file mode 100644
index 000000000000..ad45d5717071
@@ -0,0 +1,199 @@
+What:		/sys/class/firmware-attributes/*/attributes/*/
+Date:		February 2021
+KernelVersion:	5.11
+Contact:	Divya Bharathi <[email protected]>,
+		Mario Limonciello <[email protected]>,
+		Prasanth KSR <[email protected]>
+Description:
+		A sysfs interface for systems management software to enable
+		configuration capability on supported systems.  This directory
+		exposes interfaces for interacting with configuration options.
+
+		Attributes can accept:
+		- a set of pre-defined valid values (enumeration)
+		- a range of numerical values (integer)
+		- a string
+
+		All attribute types support the following values:
+
+		current_value:	A file that can be read to obtain the current
+		value of the <attr>
+
+		This file can also be written to in order to update
+		the value of a <attr>
+
+		default_value:	A file that can be read to obtain the default
+		value of the <attr>
+
+		display_name:	A file that can be read to obtain a user friendly
+		description of the at <attr>
+
+		display_name_language_code:	A file that can be read to obtain
+		the IETF language tag corresponding to the "display_name" of the <attr>
+
+		"enumeration"-type specific properties:
+
+		possible_values: A file that can be read to obtain the possible
+		values of the <attr>. Values are separated using semi-colon.
+
+		"integer"-type specific properties:
+
+		min_value:	A file that can be read to obtain the lower
+		bound value of the <attr>
+
+		max_value:	A file that can be read to obtain the upper
+		bound value of the <attr>
+
+		scalar_increment:	A file that can be read to obtain the
+		resolution of the incremental value this attribute accepts.
+
+		"string"-type specific properties:
+
+		max_length:	A file that can be read to obtain the maximum
+		length value of the <attr>
+
+		min_length:	A file that can be read to obtain the minimum
+		length value of the <attr>
+
+		Dell specific class extensions
+		--------------------------
+
+		On Dell systems the following additional attributes are available:
+
+		dell_modifier: A file that can be read to obtain attribute-level
+		dependency rule. It says an attribute X will become read-only or
+		suppressed, if/if-not attribute Y is configured.
+
+		modifier rules can be in following format,
+		[ReadOnlyIf:<attribute>=<value>]
+		[ReadOnlyIfNot:<attribute>=<value>]
+		[SuppressIf:<attribute>=<value>]
+		[SuppressIfNot:<attribute>=<value>]
+
+		For example:
+		AutoOnFri/dell_modifier has value,
+			[SuppressIfNot:AutoOn=SelectDays]
+		This means AutoOnFri will be suppressed in BIOS setup if AutoOn
+		attribute is not "SelectDays" and its value will not be effective
+		through sysfs until this rule is met.
+
+		Enumeration attributes also support the following:
+
+		dell_value_modifier:	A file that can be read to obtain value-level
+		dependency. This file is similar to dell_modifier but here, an
+		attribute's current value will be forcefully changed based dependent
+		attributes value.
+
+		dell_value_modifier rules can be in following format,
+		<value>[ForceIf:<attribute>=<value>]
+		<value>[ForceIfNot:<attribute>=<value>]
+
+		For example,
+		LegacyOrom/dell_value_modifier has value,
+			Disabled[ForceIf:SecureBoot=Enabled]
+		This means LegacyOrom's current value will be forced to "Disabled"
+		in BIOS setup if SecureBoot is Enabled and its value will not be
+		effective through sysfs until this rule is met.
+
+What:		/sys/class/firmware-attributes/*/authentication/
+Date:		February 2021
+KernelVersion:	5.11
+Contact:	Divya Bharathi <[email protected]>,
+		Mario Limonciello <[email protected]>,
+		Prasanth KSR <[email protected]>
+
+		Devices support various authentication mechanisms which can be exposed
+		as a separate configuration object.
+
+		For example a "BIOS Admin" password and "System" Password can be set,
+		reset or cleared using these attributes.
+		- An "Admin" password is used for preventing modification to the BIOS
+		  settings.
+		- A "System" password is required to boot a machine.
+
+		Change in any of these two authentication methods will also generate an
+		uevent KOBJ_CHANGE.
+
+		is_authentication_set:	A file that can be read
+		to obtain flag to see if a password is set on <attr>
+
+		max_password_length:	A file that can be read to obtain the
+		maximum length of the Password
+
+		min_password_length:	A file that can be read to obtain the
+		minimum length of the Password
+
+		current_password: A write only value used for privileged access
+		such as setting attributes when a system or admin password is set
+		or resetting to a new password
+
+		new_password: A write only value that when used in tandem with
+		current_password will reset a system or admin password.
+
+		Note, password management is session specific. If Admin password is set,
+		same password must be written into current_password file (required for
+		password-validation) and must be cleared once the session is over.
+		For example:
+			echo "password" > current_password
+			echo "disabled" > TouchScreen/current_value
+			echo "" > current_password
+
+		Drivers may emit a CHANGE uevent when a password is set or unset
+		userspace may check it again.
+
+		On Dell systems, if Admin password is set, then all BIOS attributes
+		require password validation.
+
+What:		/sys/class/firmware-attributes/*/attributes/pending_reboot
+Date:		February 2021
+KernelVersion:	5.11
+Contact:	Divya Bharathi <[email protected]>,
+		Mario Limonciello <[email protected]>,
+		Prasanth KSR <[email protected]>
+Description:
+		A read-only attribute reads 1 if a reboot is necessary to apply
+		pending BIOS attribute changes. Also, an uevent_KOBJ_CHANGE is
+		generated when it changes to 1.
+
+			0:	All BIOS attributes setting are current
+			1:	A reboot is necessary to get pending BIOS attribute changes
+				applied
+
+		Note, userspace applications need to follow below steps for efficient
+		BIOS management,
+		1.	Check if admin password is set. If yes, follow session method for
+			password management as briefed under authentication section above.
+		2.	Before setting any attribute, check if it has any modifiers
+			or value_modifiers. If yes, incorporate them and then modify
+			attribute.
+
+		Drivers may emit a CHANGE uevent when this value changes and userspace
+		may check it again.
+
+What:		/sys/class/firmware-attributes/*/attributes/reset_bios
+Date:		February 2021
+KernelVersion:	5.11
+Contact:	Divya Bharathi <[email protected]>,
+		Mario Limonciello <[email protected]>,
+		Prasanth KSR <[email protected]>
+Description:
+		This attribute can be used to reset the BIOS Configuration.
+		Specifically, it tells which type of reset BIOS configuration is being
+		requested on the host.
+
+		Reading from it returns a list of supported options encoded as:
+
+			'builtinsafe' (Built in safe configuration profile)
+			'lastknowngood' (Last known good saved configuration profile)
+			'factory' (Default factory settings configuration profile)
+			'custom' (Custom saved configuration profile)
+
+		The currently selected option is printed in square brackets as
+		shown below:
+
+		# echo "factory" > /sys/class/firmware-attributes/*/device/attributes/reset_bios
+		# cat /sys/class/firmware-attributes/*/device/attributes/reset_bios
+		# builtinsafe lastknowngood [factory] custom
+
+		Note that any changes to this attribute requires a reboot
+		for changes to take effect.
MAINTAINERS +8 -0
index 9350506a1127..adc57e0f3d60 100644
@@ -4951,6 +4951,14 @@ M:	Mario Limonciello <[email protected]>
 S:	Maintained
 F:	drivers/platform/x86/dell-wmi-descriptor.c
 
+DELL WMI SYSMAN DRIVER
+M:	Divya Bharathi <[email protected]>
+M:	Mario Limonciello <[email protected]>
+M:	Prasanth Ksr <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/platform/x86/dell-wmi-syman/*
+
 DELL WMI NOTIFICATIONS DRIVER
 M:	Matthew Garrett <[email protected]>
 M:	Pali Rohár <[email protected]>
drivers/platform/x86/Kconfig +12 -0
index 40219bba6801..4fd7a3f0a904 100644
@@ -430,6 +430,18 @@ config DELL_WMI
 	  To compile this driver as a module, choose M here: the module will
 	  be called dell-wmi.
 
+config DELL_WMI_SYSMAN
+	tristate "Dell WMI Systems management WMI driver"
+	depends on ACPI_WMI
+	depends on DMI
+	select NLS
+	help
+	  This driver allows changing BIOS settings on many Dell machines from
+	  2018 and newer without the use of any additional software.
+
+	  To compile this driver as a module, choose M here: the module will
+	  be called dell-wmi-sysman.
+
 config DELL_WMI_DESCRIPTOR
 	tristate
 	depends on ACPI_WMI
drivers/platform/x86/Makefile +1 -0
index 5f823f7eff45..36ce38e80c8f 100644
@@ -47,6 +47,7 @@ obj-$(CONFIG_DELL_WMI)			+= dell-wmi.o
 obj-$(CONFIG_DELL_WMI_DESCRIPTOR)	+= dell-wmi-descriptor.o
 obj-$(CONFIG_DELL_WMI_AIO)		+= dell-wmi-aio.o
 obj-$(CONFIG_DELL_WMI_LED)		+= dell-wmi-led.o
+obj-$(CONFIG_DELL_WMI_SYSMAN)		+= dell-wmi-sysman/
 
 # Fujitsu
 obj-$(CONFIG_AMILO_RFKILL)	+= amilo-rfkill.o
drivers/platform/x86/dell-wmi-sysman/Makefile new file +8 -0
new file mode 100644
index 000000000000..825fb2fbeea8
@@ -0,0 +1,8 @@
+obj-$(CONFIG_DELL_WMI_SYSMAN)  += dell-wmi-sysman.o
+dell-wmi-sysman-objs := 	sysman.o		\
+				enum-attributes.o	\
+				int-attributes.o	\
+				string-attributes.o	\
+				passobj-attributes.o	\
+				biosattr-interface.o	\
+				passwordattr-interface.o
drivers/platform/x86/dell-wmi-sysman/biosattr-interface.c new file +199 -0

199 lines not on this page · raw message

drivers/platform/x86/dell-wmi-sysman/dell-wmi-sysman.h new file +196 -0

196 lines not on this page · raw message

drivers/platform/x86/dell-wmi-sysman/enum-attributes.c new file +188 -0

188 lines not on this page · raw message

drivers/platform/x86/dell-wmi-sysman/int-attributes.c new file +169 -0

169 lines not on this page · raw message

drivers/platform/x86/dell-wmi-sysman/passobj-attributes.c new file +153 -0

153 lines not on this page · raw message

drivers/platform/x86/dell-wmi-sysman/passwordattr-interface.c new file +167 -0

167 lines not on this page · raw message

drivers/platform/x86/dell-wmi-sysman/string-attributes.c new file +156 -0

156 lines not on this page · raw message

drivers/platform/x86/dell-wmi-sysman/sysman.c new file +589 -0

589 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw

Hi,

drivers/platform/x86/Kconfig config DELL_WMI · line 434

Quoted 10 lines · Divya Bharathi
drivers/platform/x86/Kconfig +2 -0
index 40219bba6801..4fd7a3f0a904 100644
@@ -430,6 +430,18 @@ config DELL_WMI
 	  To compile this driver as a module, choose M here: the module will
 	  be called dell-wmi.
 
+config DELL_WMI_SYSMAN
+	tristate "Dell WMI Systems management WMI driver"

Could you drop one of those "WMI" strings or are both of them needed?

drivers/platform/x86/Kconfig config DELL_WMI · line 443

Quoted 9 lines
drivers/platform/x86/Kconfig +9 -0
+	depends on ACPI_WMI
+	depends on DMI
+	select NLS
+	help
+	  This driver allows changing BIOS settings on many Dell machines from
+	  2018 and newer without the use of any additional software.
+
+	  To compile this driver as a module, choose M here: the module will
+	  be called dell-wmi-sysman.

thanks.

Signature · 1 line
~Randy
#2 lore raw
Quoted 23 lines

-----Original Message-----
From: Randy Dunlap <[email protected]>
Sent: Wednesday, September 23, 2020 12:12
To: Divya Bharathi; [email protected]
Cc: LKML; [email protected]; Bharathi, Divya; Hans de Goede; Andy Shevchenko; mark gross; Limonciello, Mario; Ksr, Prasanth
Subject: Re: [PATCH v4] Introduce support for Systems Management Driver over WMI for Dell Systems

[EXTERNAL EMAIL]

Hi,

Quoted 8 lines · Divya Bharathi
drivers/platform/x86/Kconfig +0 -0
index 40219bba6801..4fd7a3f0a904 100644
@@ -430,6 +430,18 @@ config DELL_WMI
 	  To compile this driver as a module, choose M here: the module will
 	  be called dell-wmi.
 
Quoted 5 lines

drivers/platform/x86/Kconfig config DELL_WMI · line 434

Quoted 2 lines
drivers/platform/x86/Kconfig +2 -0
+config DELL_WMI_SYSMAN
+	tristate "Dell WMI Systems management WMI driver"

Could you drop one of those "WMI" strings or are both of them needed?

Thanks, that's a good suggestion. How about instead:

"Dell WMI based Systems management driver"

#3 lore raw
Quoted 29 lines · Mario
Quoted 23 lines

-----Original Message-----
From: Randy Dunlap <[email protected]>
Sent: Wednesday, September 23, 2020 12:12
To: Divya Bharathi; [email protected]
Cc: LKML; [email protected]; Bharathi, Divya; Hans de Goede; Andy Shevchenko; mark gross; Limonciello, Mario; Ksr, Prasanth
Subject: Re: [PATCH v4] Introduce support for Systems Management Driver over WMI for Dell Systems

[EXTERNAL EMAIL]

Hi,

Quoted 8 lines · Divya Bharathi
drivers/platform/x86/Kconfig +0 -0
index 40219bba6801..4fd7a3f0a904 100644
@@ -430,6 +430,18 @@ config DELL_WMI
 	  To compile this driver as a module, choose M here: the module will
 	  be called dell-wmi.
 
Quoted 5 lines

drivers/platform/x86/Kconfig config DELL_WMI · line 434

Quoted 2 lines
drivers/platform/x86/Kconfig +2 -0
+config DELL_WMI_SYSMAN
+	tristate "Dell WMI Systems management WMI driver"

Could you drop one of those "WMI" strings or are both of them needed?

Quoted 3 lines

Thanks, that's a good suggestion. How about instead:

"Dell WMI based Systems management driver"

WMI-based

OK. Thanks.

Signature · 1 line
~Randy
#4 lore raw
In reply to Divya Bharathi

Hi,

So as usual I will split my remarks in 2 parts,
this first email will focus on the sysfs bits.

I will do a detailed review of the code coming Monday.

Quoted 31 lines · Divya Bharathi

The Dell WMI Systems Management Driver provides a sysfs interface for systems management to enable BIOS configuration capability on certain Dell Systems.

This driver allows user to configure Dell systems with a uniform common interface. To facilitate this, the patch introduces a generic way for driver to be able to create configurable BIOS Attributes available in Setup (F2) screen.

Cc Hans de Goede <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc mark gross <[email protected]>

---

Changes from v3 to v4:
- Create a firmware-attributes class and tie ksets to a virtual device in it
- Make modifier and value_modifier "dell only" attributes.
- Correct some errors caught by kernel build bot around missing prototypes
- Remove mutexes from populate_* functions and put in init_dell_bios_attrib_wmi instead
- Move all code into a subdirectory drivers/platform/x86/dell-wmi-sysman and remove dell-wmi-* prefix on files
- Move all data structures into shared struct
- In alloc functions instead of kzalloc use kcalloc and check that there is no overflow
+ Same check for other alloc_foo-data functions
- populate_*: Move sysfs_create_group to end of the function to prevent race conditions

Quoted 8 lines

- Save kernel object into each data instance and only remove that rather than sysfs_remove_group
- Document in sysfs file what causes change uevents to come through
- Only notify with change uevent one time on multiple settings modifications
- Adjust lots of string handling
- Make more objects static
- Various whitespace corrections
- Document map_wmi_error properly
- Bump version to 5.11 (February 2021)

Thank you for all these changes.

Things are starting to look pretty good now to me, good work.

Quoted 80 lines

Changes from v2 to v3:
- Fix a possible NULL pointer error in init
- Add missing newlines to all dev_err/dev_dbg/pr_err/pr_debug statements
- Correct updating passwords when both Admin and System password are set
- Correct the WMI driver name
- Correct some namespace clashing when compiled into the kernel (Reported by Mark Gross)
- Correct some comment typos
- Adopt suggestions made by Hans:
+ Use single global mutex
+ Clarify reason for uevents with a comment
+ Remove functions for set and get current password
+ Rename lower_bound to min_value and upper_bound to max_value
+ Rename possible_value to possible_values
+ Remove references to float
+ Build a separate passwords directory again since it behaves differently from the other attributes
+ Move more calls from pr_err -> dev_err
- Documentation cleanups (see v2 patch feedback)
+ Grouping types
+ Syntax of modifier output

Changes from v1 to v2:
- use pr_fmt instead of pr_err(DRIVER_NAME
- re-order variables reverse xmas tree order
- correct returns of -1 to error codes
- correct usage of {} on some split line statements
- Refine all documentation deficiencies suggested by Hans
- Merge all attributes to a single directory
- Overhaul WMI interface interaction as suggested by Hans
* Move WMI driver registration to start of module
* Remove usage of lists that only use first entry for WMI interfaces
* Create a global structure shared across interface source files
* Make get_current_password function static
* Remove get_pending changes function, shared across global structure now.
- Overhaul use of mutexes
* Make kset list mutex shared across source files
* Remove unneeded dell-wmi-sysman call_mutex
* Keep remaining call_mutexes in WMI functions
- Move security area calculation into a function
- Use NLS helper for utf8->utf16 conversion

  .../testing/sysfs-class-firmware-attributes   | 199 ++++++
  MAINTAINERS                                   |   8 +
  drivers/platform/x86/Kconfig                  |  12 +
  drivers/platform/x86/Makefile                 |   1 +
  drivers/platform/x86/dell-wmi-sysman/Makefile |   8 +
  .../x86/dell-wmi-sysman/biosattr-interface.c  | 199 ++++++
  .../x86/dell-wmi-sysman/dell-wmi-sysman.h     | 196 ++++++
  .../x86/dell-wmi-sysman/enum-attributes.c     | 188 ++++++
  .../x86/dell-wmi-sysman/int-attributes.c      | 169 +++++
  .../x86/dell-wmi-sysman/passobj-attributes.c  | 153 +++++
  .../dell-wmi-sysman/passwordattr-interface.c  | 167 +++++
  .../x86/dell-wmi-sysman/string-attributes.c   | 156 +++++
  drivers/platform/x86/dell-wmi-sysman/sysman.c | 589 ++++++++++++++++++
  13 files changed, 2045 insertions(+)

create mode 100644 Documentation/ABI/testing/sysfs-class-firmware-attributes create mode 100644 drivers/platform/x86/dell-wmi-sysman/Makefile create mode 100644 drivers/platform/x86/dell-wmi-sysman/biosattr-interface.c create mode 100644 drivers/platform/x86/dell-wmi-sysman/dell-wmi-sysman.h create mode 100644 drivers/platform/x86/dell-wmi-sysman/enum-attributes.c create mode 100644 drivers/platform/x86/dell-wmi-sysman/int-attributes.c create mode 100644 drivers/platform/x86/dell-wmi-sysman/passobj-attributes.c create mode 100644 drivers/platform/x86/dell-wmi-sysman/passwordattr-interface.c create mode 100644 drivers/platform/x86/dell-wmi-sysman/string-attributes.c create mode 100644 drivers/platform/x86/dell-wmi-sysman/sysman.c

Documentation/ABI/testing/sysfs-class-firmware-attributes new file +7 -0
new file mode 100644
index 000000000000..ad45d5717071
@@ -0,0 +1,199 @@
+What:		/sys/class/firmware-attributes/*/attributes/*/
+Date:		February 2021
+KernelVersion:	5.11
+Contact:	Divya Bharathi <[email protected]>,
+		Mario Limonciello <[email protected]>,
+		Prasanth KSR <[email protected]>
+Description:

Documentation/ABI/testing/sysfs-class-firmware-attributes line 17

Quoted 10 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +10 -0
+		A sysfs interface for systems management software to enable
+		configuration capability on supported systems.  This directory
+		exposes interfaces for interacting with configuration options.
+
+		Attributes can accept:
+		- a set of pre-defined valid values (enumeration)
+		- a range of numerical values (integer)
+		- a string
+
+		All attribute types support the following values:

This list seems to miss a "type" sysfs attribute, which tells which type the firmware-attribute in question is. Sorry for not noticing that sooner.

Documentation/ABI/testing/sysfs-class-firmware-attributes line 20

Quoted 3 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +3 -0
+
+		current_value:	A file that can be read to obtain the current
+		value of the <attr>

Can you indent the continuation on the second line to align with the start of the description on the first line please?, e.g.:

current_value: A file that can be read to obtain the current
value of the <attr>

This goes for all the sysfs-attribute description texts.

Quoted 7 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +7 -0
+
+		This file can also be written to in order to update
+		the value of a <attr>
+
+		default_value:	A file that can be read to obtain the default
+		value of the <attr>
+

Documentation/ABI/testing/sysfs-class-firmware-attributes line 37

Quoted 10 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +10 -0
+		display_name:	A file that can be read to obtain a user friendly
+		description of the at <attr>
+
+		display_name_language_code:	A file that can be read to obtain
+		the IETF language tag corresponding to the "display_name" of the <attr>
+
+		"enumeration"-type specific properties:
+
+		possible_values: A file that can be read to obtain the possible
+		values of the <attr>. Values are separated using semi-colon.

As non-native English speaker I had to lookup semi-colon to make sure that it indeed is ';' as I already sorta expected. So can we add "(';')" (without the "") behind the semi-colon to make this easier to parse for non-native English speakers?

Documentation/ABI/testing/sysfs-class-firmware-attributes line 48

Quoted 10 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +10 -0
+		"integer"-type specific properties:
+
+		min_value:	A file that can be read to obtain the lower
+		bound value of the <attr>
+
+		max_value:	A file that can be read to obtain the upper
+		bound value of the <attr>
+
+		scalar_increment:	A file that can be read to obtain the
+		resolution of the incremental value this attribute accepts.

Can we have an example here? I guess if for some reason only even/odd values are allowed then this would contain "2" ?

Documentation/ABI/testing/sysfs-class-firmware-attributes line 56

Quoted 8 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +8 -0
+
+		"string"-type specific properties:
+
+		max_length:	A file that can be read to obtain the maximum
+		length value of the <attr>
+
+		min_length:	A file that can be read to obtain the minimum
+		length value of the <attr>

So I have been taking a look at a community written driven to allow changing BIOS-settings / firmware-attributes on some Lenovo laptops:

https://github.com/iksaif/thinkpad-wmi

My main reason for doing so is to check if other vendors also support things like "display_name", "default_value", etc.

So for the normal attributes, it seems that for the Thinkpad WMI interface they are all enums and the do contain possible_values. So that is fine.

But they do not have a separate display_name only a name-name, nor do they have a default_value.

So I think we should mark the display_name, display_name_language_code and default_value sysfs-attributes optional, e.g. make the description look like this:

default_value: An optional file that can be read to obtain the
default value of the <attr>

Quoted 29 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +29 -0
+		Dell specific class extensions
+		--------------------------
+
+		On Dell systems the following additional attributes are available:
+
+		dell_modifier: A file that can be read to obtain attribute-level
+		dependency rule. It says an attribute X will become read-only or
+		suppressed, if/if-not attribute Y is configured.
+
+		modifier rules can be in following format,
+		[ReadOnlyIf:<attribute>=<value>]
+		[ReadOnlyIfNot:<attribute>=<value>]
+		[SuppressIf:<attribute>=<value>]
+		[SuppressIfNot:<attribute>=<value>]
+
+		For example:
+		AutoOnFri/dell_modifier has value,
+			[SuppressIfNot:AutoOn=SelectDays]
+		This means AutoOnFri will be suppressed in BIOS setup if AutoOn
+		attribute is not "SelectDays" and its value will not be effective
+		through sysfs until this rule is met.
+
+		Enumeration attributes also support the following:
+
+		dell_value_modifier:	A file that can be read to obtain value-level
+		dependency. This file is similar to dell_modifier but here, an
+		attribute's current value will be forcefully changed based dependent
+		attributes value.
+

Documentation/ABI/testing/sysfs-class-firmware-attributes line 96

Quoted 10 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +10 -0
+		dell_value_modifier rules can be in following format,
+		<value>[ForceIf:<attribute>=<value>]
+		<value>[ForceIfNot:<attribute>=<value>]
+
+		For example,
+		LegacyOrom/dell_value_modifier has value,
+			Disabled[ForceIf:SecureBoot=Enabled]
+		This means LegacyOrom's current value will be forced to "Disabled"
+		in BIOS setup if SecureBoot is Enabled and its value will not be
+		effective through sysfs until this rule is met.

Thank you for making these Dell specific.

Quoted 35 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +35 -0
+What:		/sys/class/firmware-attributes/*/authentication/
+Date:		February 2021
+KernelVersion:	5.11
+Contact:	Divya Bharathi <[email protected]>,
+		Mario Limonciello <[email protected]>,
+		Prasanth KSR <[email protected]>
+
+		Devices support various authentication mechanisms which can be exposed
+		as a separate configuration object.
+
+		For example a "BIOS Admin" password and "System" Password can be set,
+		reset or cleared using these attributes.
+		- An "Admin" password is used for preventing modification to the BIOS
+		  settings.
+		- A "System" password is required to boot a machine.
+
+		Change in any of these two authentication methods will also generate an
+		uevent KOBJ_CHANGE.
+
+		is_authentication_set:	A file that can be read
+		to obtain flag to see if a password is set on <attr>
+
+		max_password_length:	A file that can be read to obtain the
+		maximum length of the Password
+
+		min_password_length:	A file that can be read to obtain the
+		minimum length of the Password
+
+		current_password: A write only value used for privileged access
+		such as setting attributes when a system or admin password is set
+		or resetting to a new password
+
+		new_password: A write only value that when used in tandem with
+		current_password will reset a system or admin password.
+

Documentation/ABI/testing/sysfs-class-firmware-attributes line 142

Quoted 10 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +10 -0
+		Note, password management is session specific. If Admin password is set,
+		same password must be written into current_password file (required for
+		password-validation) and must be cleared once the session is over.
+		For example:
+			echo "password" > current_password
+			echo "disabled" > TouchScreen/current_value
+			echo "" > current_password
+
+		Drivers may emit a CHANGE uevent when a password is set or unset
+		userspace may check it again.

First of all some generic remarks:

Currently the "Admin" and "System" names come directly from the Dell WMI interface. I have 2 concerns with this:

1) What if we do get multiple authentication mechanisms for a single user, e.g. both a type == "pasword" and type == "hotp" authentication. The way I have been thinking about that sofar, is that we then get 2 admin dirs under the /sys/class/firmware-attributes/*/authentication dir, with a type attribute per dir, following how we do the attributes. So we would get e.g. these 2 dirs:

/sys/class/firmware-attributes/dell/authentication/admin-password /sys/class/firmware-attributes/dell/authentication/admin-hotp

For the admin user. If want to do it like this in the future we should add some indirection between the WMI username and the dir which is created now and create the Admin dir as admin-password starting now.

2) The "Admin" name is clear enough, but the "System" name is somewhat ambiguous and other vendors may call this differently, I think I have at least seen it called the "User" password in some cases and Lenovo seems to call it a power-on-password. I think that just calling it the "boot" password makes sense. My main concern is that "System" is a bit too vague. So then for now we would get:

/sys/class/firmware-attributes/dell/authentication/admin-password /sys/class/firmware-attributes/dell/authentication/boot-password

The spec. should also specify that the part before the first '-' is the username, and the part after it is the authentication type. E.g. the docs for this could look something like this:

Directories under /sys/class/firmware-attributes/*/authentication/ use the following directory-name pattern:
<username>-<authentication_method>

Where username must be one of: "admin" or "boot":

admin If any authentication_method is enabled for the admin user, then
authentication as the admin user is required to modify BIOS settings.
boot If any authentication_method is enabled for the admin user, then
authentication as the boot user is required to boot the machine.

And where authentication_method must be "password". Note in the future both more usernames and more authentication_method-s may be added.

All authentication_methods must have the following sysfs-attributes:

is_enabled: This reads "1" if the authentication_method is enabled,
and "0" if its disabled

Any changes to authentication_methods will generate a change uevent, upon receiving this event applications should recheck the authentication settings such as the is_enabled flag.

Password authentication_method specific sysfs-attributes:

max_password_length: ... (continue with the old text)

Note:

1) This is a proposal to make the authentication bits a bit more generic / future proof. This is very much open for discussion.

2) The new generic is_enabled sysfs-attribute replaces the is_authentication_set flag

###

So as with the actual firmware-attributes I have also been comparing the authentication bits for the Dell case with the community thinkpad_wmi code. And again things are a pretty good match already, including being able to query a minimum and maximin password length.

The only thing which is different, which I think would be good to add now, is a password_encoding sysfs-attribute. The Lenovo password interface supports 2 encodings, "ascii" and "scancodes". Although I wonder if scancodes still works on modern UEFI based platforms.

Since the Dell password code uses UTF8 to UTF16 translation routines, I guess the encoding for the Dell password is UTF8 (at the sysfs level). So I would like to propose an extra password-authentication attribute like:

password_encoding: A file that can be read to obtain the encoding used by
the current_password and new_password attributes. The value returned should be one of: "utf8", "ascii". In some cases this may return a vendor-specific encoding like, e.g. "lenovo-scancodes".

And for the Dell driver this would just be hardcoded to utf8.

Documentation/ABI/testing/sysfs-class-firmware-attributes line 145

Quoted 3 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +3 -0
+
+		On Dell systems, if Admin password is set, then all BIOS attributes
+		require password validation.

I think that this bit can be dropped both the new authentication text which I suggest above, but even the old text:

Documentation/ABI/testing/sysfs-class-firmware-attributes line 111

Quoted 2 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +2 -0
+		- An "Admin" password is used for preventing modification to the BIOS
+		  settings.

Already makes it clear that if an Admin password is set modification of (any) BIOS settings is not allowed without the password. So this seems redundant.

If in the future some attributes can be changed without the Admin password, then we can deal with that then by introducing a new authorization_required attribute, which could contain, e.g. one of "none, "admin", "<new-to-be-defined -power-user-level-user>".

And when we define that optional attribute then we add that the absence of said attribute means that the consumer of the API should behave as if the authorization_requires attribute contains "admin", which existing API consumers will already do as that is the behavior we define currently.

Quoted 44 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +44 -0
+
+What:		/sys/class/firmware-attributes/*/attributes/pending_reboot
+Date:		February 2021
+KernelVersion:	5.11
+Contact:	Divya Bharathi <[email protected]>,
+		Mario Limonciello <[email protected]>,
+		Prasanth KSR <[email protected]>
+Description:
+		A read-only attribute reads 1 if a reboot is necessary to apply
+		pending BIOS attribute changes. Also, an uevent_KOBJ_CHANGE is
+		generated when it changes to 1.
+
+			0:	All BIOS attributes setting are current
+			1:	A reboot is necessary to get pending BIOS attribute changes
+				applied
+
+		Note, userspace applications need to follow below steps for efficient
+		BIOS management,
+		1.	Check if admin password is set. If yes, follow session method for
+			password management as briefed under authentication section above.
+		2.	Before setting any attribute, check if it has any modifiers
+			or value_modifiers. If yes, incorporate them and then modify
+			attribute.
+
+		Drivers may emit a CHANGE uevent when this value changes and userspace
+		may check it again.
+
+What:		/sys/class/firmware-attributes/*/attributes/reset_bios
+Date:		February 2021
+KernelVersion:	5.11
+Contact:	Divya Bharathi <[email protected]>,
+		Mario Limonciello <[email protected]>,
+		Prasanth KSR <[email protected]>
+Description:
+		This attribute can be used to reset the BIOS Configuration.
+		Specifically, it tells which type of reset BIOS configuration is being
+		requested on the host.
+
+		Reading from it returns a list of supported options encoded as:
+
+			'builtinsafe' (Built in safe configuration profile)
+			'lastknowngood' (Last known good saved configuration profile)
+			'factory' (Default factory settings configuration profile)
+			'custom' (Custom saved configuration profile)

Documentation/ABI/testing/sysfs-class-firmware-attributes line 199

Quoted 10 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +10 -0
+
+		The currently selected option is printed in square brackets as
+		shown below:
+
+		# echo "factory" > /sys/class/firmware-attributes/*/device/attributes/reset_bios
+		# cat /sys/class/firmware-attributes/*/device/attributes/reset_bios
+		# builtinsafe lastknowngood [factory] custom
+
+		Note that any changes to this attribute requires a reboot
+		for changes to take effect.

Regards,

Hans

#5 lore raw

So I do want to preface this response by mentioning that Dell's implementation is based off the PLDM specification from the DMTF.
https://www.dmtf.org/sites/default/files/standards/documents/DSP0247_1.0.0.pdf

A lot of the nomenclature that has been already proposed to change followed nomenclature previously used in the PLDM specification. In the spirit of matching that specification in the Linux implementation we may consider to change things like proposed to be renamed min_value back to lower_bound, but that's up to your decision.

Quoted 3 lines

This list seems to miss a "type" sysfs attribute, which tells which type the firmware-attribute in question is. Sorry for not noticing that sooner.

Whoops :)

Quoted 26 lines

Documentation/ABI/testing/sysfs-class-firmware-attributes line 20

Quoted 4 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +3 -0
+
+		current_value:	A file that can be read to obtain the current
+		value of the <attr>

Can you indent the continuation on the second line to align with the start of the description on the first line please?, e.g.:

current_value: A file that can be read to obtain the current
value of the <attr>

This goes for all the sysfs-attribute description texts.

Documentation/ABI/testing/sysfs-class-firmware-attributes

Quoted 12 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +12 -0
+
+		This file can also be written to in order to update
+		the value of a <attr>
+
+		default_value:	A file that can be read to obtain the default
+		value of the <attr>
+
+		display_name:	A file that can be read to obtain a user friendly
+		description of the at <attr>
+
+		display_name_language_code:	A file that can be read to obtain
+		the IETF language tag corresponding to the "display_name" of the

<attr>

Quoted 11 lines

Documentation/ABI/testing/sysfs-class-firmware-attributes line 37

Quoted 5 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +5 -0
+
+		"enumeration"-type specific properties:
+
+		possible_values: A file that can be read to obtain the possible
+		values of the <attr>. Values are separated using semi-colon.

As non-native English speaker I had to lookup semi-colon to make sure that it indeed is ';' as I already sorta expected. So can we add "(';')" (without the "") behind the semi-colon to make this easier to parse for non-native English
speakers?

Some parts of the kernel documentation seem to use semi-colon (``;``) - example of admin-guide/bootconfig.rst

and others just set semi-colon - example of admin-guide/device-mapper/dm-init.rst.

But I don't see a problem with this change.

Quoted 14 lines

Documentation/ABI/testing/sysfs-class-firmware-attributes line 48

Quoted 11 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +10 -0
+		"integer"-type specific properties:
+
+		min_value:	A file that can be read to obtain the lower
+		bound value of the <attr>
+
+		max_value:	A file that can be read to obtain the upper
+		bound value of the <attr>
+
+		scalar_increment:	A file that can be read to obtain the
+		resolution of the incremental value this attribute accepts.

Can we have an example here? I guess if for some reason only even/odd values are allowed then this would contain "2" ?

Maybe adopting the PLDM description is better to explain it.

"The scalar value that is used for the increments to this integer"

Quoted 25 lines

Documentation/ABI/testing/sysfs-class-firmware-attributes line 56

Quoted 9 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +8 -0
+
+		"string"-type specific properties:
+
+		max_length:	A file that can be read to obtain the maximum
+		length value of the <attr>
+
+		min_length:	A file that can be read to obtain the minimum
+		length value of the <attr>

So I have been taking a look at a community written driven to allow changing BIOS-settings / firmware-attributes on some Lenovo laptops:

https://github.com/iksaif/thinkpad-wmi

My main reason for doing so is to check if other vendors also support things like "display_name", "default_value", etc.

So for the normal attributes, it seems that for the Thinkpad WMI interface they
are all enums and the do contain possible_values. So that is fine.

But they do not have a separate display_name only a name-name, nor do they have a default_value.

Quoted 7 lines

So I think we should mark the display_name, display_name_language_code and default_value sysfs-attributes optional, e.g. make the description look like this:

default_value: An optional file that can be read to obtain the
default value of the <attr>

At this point, why don't we just make a declaration at the top that all attributes are optional? If you want this to scale to non-BIOS implementations of settings you couldn't know what they'll be able to offer and it sets an expectation that userspace to need to look for every sysfs file exists rather than just the vendor specific ones.

+

Quoted 16 lines

Documentation/ABI/testing/sysfs-class-firmware-attributes line 142

Quoted 2 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +2 -0
+		Drivers may emit a CHANGE uevent when a password is set or unset
+		userspace may check it again.

First of all some generic remarks:

Currently the "Admin" and "System" names come directly from the Dell WMI interface. I have 2 concerns with this:

1) What if we do get multiple authentication mechanisms for a single user, e.g. both a type == "pasword" and type == "hotp" authentication. The way I have
been thinking about that sofar, is that we then get 2 admin dirs under the /sys/class/firmware-attributes/*/authentication dir, with a type attribute per dir, following how we do the attributes. So we would get e.g. these 2 dirs:

Quoted 6 lines

/sys/class/firmware-attributes/dell/authentication/admin-password /sys/class/firmware-attributes/dell/authentication/admin-hotp

For the admin user. If want to do it like this in the future we should add some indirection between the WMI username and the dir which is created now and create the Admin dir as admin-password starting now.

Yeah I think if HOTP is added to some vendor some day that's how it would work. The indirection can be added at that time. One way to do this is to add

Quoted 10 lines

2) The "Admin" name is clear enough, but the "System" name is somewhat ambiguous and other vendors may call this differently, I think I have at least seen it called the "User" password in some cases and Lenovo seems to call it a power-on-password. I think that just calling it the "boot" password makes sense. My main concern is that "System" is a bit too vague. So then for now we would get:

/sys/class/firmware-attributes/dell/authentication/admin-password /sys/class/firmware-attributes/dell/authentication/boot-password

I want to be cognizant that vendors are going to call things differently in their attributes and we want the specifications and/or whitepapers that vendors use to refer to this to make sense to the system's administrator.

Dell uses the nomenclature "System" in all of it's documentation. If the Linux implementation calls it "boot password" or "power on password" it will be confusing to decode when someone see it.

Dell also has other terms used such as Master password and HDD password. They're not exposed in this interface but these all might have a different connotation across vendors.

So instead I would propose that within the folder the "type" attribute correspond to something decodable. So the name the vendor uses is the folder and the type of password is within a sysfs file "type".

Proposed types:
* "bios-admin"
* "power-on"

Those two types can then be hardcoded by the implementation.

So a user would see the different authentication mechanisms available by looking At the contents of /sys/class/firmware-attributes/*/authentication and if they don't understand it's purpose they look at the type sysfs file.

Quoted 10 lines

The spec. should also specify that the part before the first '-' is the username, and the part after it is the authentication type. E.g. the docs for this could look something like this:

Directories under /sys/class/firmware-attributes/*/authentication/ use the following directory-name pattern:
<username>-<authentication_method>

Where username must be one of: "admin" or "boot":

Username is inappropriate in this context, especially since firmware doesn't have a concept of multi-user. It's a configurable permissions scheme to what you are allowed to do in firmware.

Quoted 50 lines

admin If any authentication_method is enabled for the admin user, then
authentication as the admin user is required to modify BIOS
settings.
boot If any authentication_method is enabled for the admin user, then
authentication as the boot user is required to boot the machine.

And where authentication_method must be "password". Note in the future both more usernames and more authentication_method-s may be added.

All authentication_methods must have the following sysfs-attributes:

is_enabled: This reads "1" if the authentication_method is enabled,
and "0" if its disabled

Any changes to authentication_methods will generate a change uevent, upon receiving this event applications should recheck the authentication settings such as the is_enabled flag.

Password authentication_method specific sysfs-attributes:

max_password_length: ... (continue with the old text)

Note:

1) This is a proposal to make the authentication bits a bit more generic / future proof. This is very much open for discussion.

2) The new generic is_enabled sysfs-attribute replaces the is_authentication_set flag

###

So as with the actual firmware-attributes I have also been comparing the authentication
bits for the Dell case with the community thinkpad_wmi code. And again things are a pretty
good match already, including being able to query a minimum and maximin password length.

The only thing which is different, which I think would be good to add now, is a password_encoding sysfs-attribute. The Lenovo password interface supports 2 encodings, "ascii" and "scancodes". Although I wonder if scancodes still works on modern UEFI based platforms.

Since the Dell password code uses UTF8 to UTF16 translation routines, I guess the encoding for the Dell password is UTF8 (at the sysfs level). So I would like to propose
an extra password-authentication attribute like:

Quoted 8 lines

password_encoding: A file that can be read to obtain the encoding used
by
the current_password and new_password attributes. The value returned should be one of: "utf8", "ascii". In some cases this may return a vendor-specific encoding like, e.g. "lenovo-scancodes".

And for the Dell driver this would just be hardcoded to utf8.

I don't really believe that another vendor's implementation would be likely to use scan codes for the input into the WMI method.

Think back to how this all works on Windows...

Here is the Dell whitepaper that supports this interface for Windows:
https://downloads.dell.com/manuals/common/dell-agentless-client-manageability.pdf

(And yes I acknowledge we should probably reference this and the PLDM spec it's based From in the commit message)

You're supposed to get a WMI method which you can interact with from Powershell. You get a reference to the namespace, and then you make a function call from something in the binary MOF (which maps to an ACPI WM** method).

This is how a command using a password argument works on Windows (from that whitepaper)

$pwd = ”PASSWORD”
$encoder = New-Object System.Text.UTF8Encoding
$bytes = $encoder.GetBytes($pwd) $BAI.SetAttribute(1,$bytes.Length,$bytes,"UefiNwStack","Disabled")

I don't see any other encoders other than Unicode in the System.Text namespace
https://docs.microsoft.com/en-us/dotnet/api/system.text?view=netcore-3.1

So if you had to manually convert to scancodes, that would not at all user friendly.

I would much prefer that this attribute only be added if it's actually deemed necessary. Or to my point that all attributes can be considered optional, Dell's implementation would just not offer it.

#6 lore raw

Hi,

Quoted 9 lines · Mario

So I do want to preface this response by mentioning that Dell's implementation is based off the PLDM specification from the DMTF.
https://www.dmtf.org/sites/default/files/standards/documents/DSP0247_1.0.0.pdf

A lot of the nomenclature that has been already proposed to change followed nomenclature previously used in the PLDM specification. In the spirit of matching that specification in the Linux implementation we may consider to change things like proposed to be renamed min_value back to lower_bound, but that's up to your decision.

I really prefer min_value and max_value here, those have 2 advantages:

1. min/max is used almost everywhere in the kernel/sysfs for things like this, upper-/lower-bound feels a bit like archaic Enlish to me.

2. The _value postfix makes it immediately clear that they are the bounds for the current_value attribute.

Also in case of the password sysfs inteface min/max_lenght is used, not e.g. password_length_lower_bound. So again using min/max seems more consistent.

Quoted 102 lines
Quoted 2 lines

This list seems to miss a "type" sysfs attribute, which tells which type the firmware-attribute in question is. Sorry for not noticing that sooner.

Whoops :)

Quoted 26 lines

Documentation/ABI/testing/sysfs-class-firmware-attributes line 20

Quoted 4 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +3 -0
+
+		current_value:	A file that can be read to obtain the current
+		value of the <attr>

Can you indent the continuation on the second line to align with the start of the description on the first line please?, e.g.:

current_value: A file that can be read to obtain the current
value of the <attr>

This goes for all the sysfs-attribute description texts.

Documentation/ABI/testing/sysfs-class-firmware-attributes

Quoted 12 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +12 -0
+
+		This file can also be written to in order to update
+		the value of a <attr>
+
+		default_value:	A file that can be read to obtain the default
+		value of the <attr>
+
+		display_name:	A file that can be read to obtain a user friendly
+		description of the at <attr>
+
+		display_name_language_code:	A file that can be read to obtain
+		the IETF language tag corresponding to the "display_name" of the

<attr>

Quoted 11 lines

Documentation/ABI/testing/sysfs-class-firmware-attributes line 37

Quoted 5 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +5 -0
+
+		"enumeration"-type specific properties:
+
+		possible_values: A file that can be read to obtain the possible
+		values of the <attr>. Values are separated using semi-colon.

As non-native English speaker I had to lookup semi-colon to make sure that it indeed is ';' as I already sorta expected. So can we add "(';')" (without the "") behind the semi-colon to make this easier to parse for non-native English
speakers?

Some parts of the kernel documentation seem to use semi-colon (``;``) - example of admin-guide/bootconfig.rst

and others just set semi-colon - example of admin-guide/device-mapper/dm-init.rst.

But I don't see a problem with this change.

Quoted 14 lines

Documentation/ABI/testing/sysfs-class-firmware-attributes line 48

Quoted 11 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +10 -0
+		"integer"-type specific properties:
+
+		min_value:	A file that can be read to obtain the lower
+		bound value of the <attr>
+
+		max_value:	A file that can be read to obtain the upper
+		bound value of the <attr>
+
+		scalar_increment:	A file that can be read to obtain the
+		resolution of the incremental value this attribute accepts.

Can we have an example here? I guess if for some reason only even/odd values are allowed then this would contain "2" ?

Maybe adopting the PLDM description is better to explain it.

"The scalar value that is used for the increments to this integer"

Quoted 25 lines

Documentation/ABI/testing/sysfs-class-firmware-attributes line 56

Quoted 9 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +8 -0
+
+		"string"-type specific properties:
+
+		max_length:	A file that can be read to obtain the maximum
+		length value of the <attr>
+
+		min_length:	A file that can be read to obtain the minimum
+		length value of the <attr>

So I have been taking a look at a community written driven to allow changing BIOS-settings / firmware-attributes on some Lenovo laptops:

https://github.com/iksaif/thinkpad-wmi

My main reason for doing so is to check if other vendors also support things like "display_name", "default_value", etc.

So for the normal attributes, it seems that for the Thinkpad WMI interface they
are all enums and the do contain possible_values. So that is fine.

But they do not have a separate display_name only a name-name, nor do they have a default_value.

Quoted 7 lines

So I think we should mark the display_name, display_name_language_code and default_value sysfs-attributes optional, e.g. make the description look like this:

default_value: An optional file that can be read to obtain the
default value of the <attr>

Quoted 5 lines

At this point, why don't we just make a declaration at the top that all attributes are optional? If you want this to scale to non-BIOS implementations of settings you couldn't know what they'll be able to offer and it sets an expectation that userspace to need to look for every sysfs file exists rather than just the vendor specific ones.

Sure I would be happy to have it documented that all firmware-attributes sysfs-files are optional *except for type and current_value*. If you prefer that go for it.

Quoted 21 lines

+

Quoted 19 lines

Documentation/ABI/testing/sysfs-class-firmware-attributes line 142

Quoted 2 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +2 -0
+		Drivers may emit a CHANGE uevent when a password is set or unset
+		userspace may check it again.

First of all some generic remarks:

Currently the "Admin" and "System" names come directly from the Dell WMI interface. I have 2 concerns with this:

1) What if we do get multiple authentication mechanisms for a single user, e.g. both a type == "pasword" and type == "hotp" authentication. The way I have
been thinking about that sofar, is that we then get 2 admin dirs under the /sys/class/firmware-attributes/*/authentication dir, with a type attribute per dir, following how we do the attributes. So we would get e.g. these 2 dirs:

/sys/class/firmware-attributes/dell/authentication/admin-password /sys/class/firmware-attributes/dell/authentication/admin-hotp

Quoted 6 lines
Quoted 3 lines

For the admin user. If want to do it like this in the future we should add some indirection between the WMI username and the dir which is created now and create the Admin dir as admin-password starting now.

Yeah I think if HOTP is added to some vendor some day that's how it would work. The indirection can be added at that time. One way to do this is to add

It seems you never finished your sentence here?

Quoted 26 lines
Quoted 9 lines

2) The "Admin" name is clear enough, but the "System" name is somewhat ambiguous and other vendors may call this differently, I think I have at least seen it called the "User" password in some cases and Lenovo seems to call it a power-on-password. I think that just calling it the "boot" password makes sense. My main concern is that "System" is a bit too vague. So then for now we would get:

/sys/class/firmware-attributes/dell/authentication/admin-password /sys/class/firmware-attributes/dell/authentication/boot-password

I want to be cognizant that vendors are going to call things differently in their attributes and we want the specifications and/or whitepapers that vendors use to refer to this to make sense to the system's administrator.

Dell uses the nomenclature "System" in all of it's documentation. If the Linux implementation calls it "boot password" or "power on password" it will be confusing to decode when someone see it.

Dell also has other terms used such as Master password and HDD password. They're not exposed in this interface but these all might have a different connotation across vendors.

So instead I would propose that within the folder the "type" attribute correspond to something decodable. So the name the vendor uses is the folder and the type of password is within a sysfs file "type".

Quoted 5 lines

Proposed types:
* "bios-admin"
* "power-on"

Those two types can then be hardcoded by the implementation.

If re-using the WMI names is important for you, then having a sysfs-attribute with some standardized value to say what is what inside the authentication-sub-dir is fine with me.

Except that I would not call it type, when thinking about authentication-types I think about things like password / totp / hotp. Can we call the sysfs-attribute for this "role" instead ?

Quoted 3 lines

So a user would see the different authentication mechanisms available by looking At the contents of /sys/class/firmware-attributes/*/authentication and if they don't understand it's purpose they look at the type sysfs file.

But one role can still have multiple mechanisms, so for Dell in the future we could have say:

/sys/class/firmware-attributes/dell/authentication/Admin-password /sys/class/firmware-attributes/dell/authentication/Admin-hotp /sys/class/firmware-attributes/dell/authentication/System-password

So although I'm fine with taking the role_name directly from WMI (combined with a roll attribute with standardized values) I think we still need to postfix a -password to it now, to allow room for adding say a -hotp mechanism for the same role_name in the future ?

(I guess this also ties into your unanswered question from above.

Quoted 8 lines
Quoted 8 lines

The spec. should also specify that the part before the first '-' is the username, and the part after it is the authentication type. E.g. the docs for this could look something like this:

Directories under /sys/class/firmware-attributes/*/authentication/ use the following directory-name pattern:
<username>-<authentication_method>

Quoted 5 lines
Quoted 1 line

Where username must be one of: "admin" or "boot":

Username is inappropriate in this context, especially since firmware doesn't have a concept of multi-user. It's a configurable permissions scheme to what you are allowed to do in firmware.

Ack, so as I asked above, what do you think of using "role" here instead?

Quoted 56 lines
Quoted 56 lines

admin If any authentication_method is enabled for the admin user, then
authentication as the admin user is required to modify BIOS
settings.
boot If any authentication_method is enabled for the admin user, then
authentication as the boot user is required to boot the machine.

And where authentication_method must be "password". Note in the future both more usernames and more authentication_method-s may be added.

All authentication_methods must have the following sysfs-attributes:

is_enabled: This reads "1" if the authentication_method is enabled,
and "0" if its disabled

Any changes to authentication_methods will generate a change uevent, upon receiving this event applications should recheck the authentication settings such as the is_enabled flag.

Password authentication_method specific sysfs-attributes:

max_password_length: ... (continue with the old text)

Note:

1) This is a proposal to make the authentication bits a bit more generic / future proof. This is very much open for discussion.

2) The new generic is_enabled sysfs-attribute replaces the is_authentication_set flag

###

So as with the actual firmware-attributes I have also been comparing the authentication
bits for the Dell case with the community thinkpad_wmi code. And again things are a pretty
good match already, including being able to query a minimum and maximin password length.

The only thing which is different, which I think would be good to add now, is a password_encoding sysfs-attribute. The Lenovo password interface supports 2 encodings, "ascii" and "scancodes". Although I wonder if scancodes still works on modern UEFI based platforms.

Since the Dell password code uses UTF8 to UTF16 translation routines, I guess the encoding for the Dell password is UTF8 (at the sysfs level). So I would like to propose
an extra password-authentication attribute like:

password_encoding: A file that can be read to obtain the encoding used
by
the current_password and new_password attributes. The value returned should be one of: "utf8", "ascii". In some cases this may return a vendor-specific encoding like, e.g. "lenovo-scancodes".

Quoted 4 lines
Quoted 1 line

And for the Dell driver this would just be hardcoded to utf8.

I don't really believe that another vendor's implementation would be likely to use scan codes for the input into the WMI method.

I did not make that example up, Lenovo really as a scan-codes encoding for their password authentication mechanism, see:

https://download.lenovo.com/pccbbs/mobiles_pdf/kbl-r_deploy_01.pdf

Quoted 1 line

Think back to how this all works on Windows...

<snip>

Quoted 1 line

So if you had to manually convert to scancodes, that would not at all user friendly.

It definitely is not user-friendly.

Note when calling the Lenovo WMI functions you can specify in which encoding (ascii or scancodes) you are providing the data and all Lenovo's examples use the ascii encoding. But there also is a bitfield with supported encodings and I guess some older firmware may only support the scancodes variant?

It is all somewhat not nice, which is why I prefixed the scancodes encoding with lenovo- to make it clear that it is non-standard.

But lets say all Lenovo models support the ascii encoding and we never expose the scancodes bit to userspace. Even then there still is the unicode (utf8 in sysfs, utf16 at the WMI level for Dell) vs ascii issue and it would be nice if a UI for this could give an error when the user tries to use non ascii chars in a password for a vendor implementation...

Quoted 3 lines

I would much prefer that this attribute only be added if it's actually deemed necessary. Or to my point that all attributes can be considered optional, Dell's implementation would just not offer it.

I guess that would work (Dell not offering it). Which makes me realize that we should specify somewhere in the doc that all sysfs files which contain a string value, the encoding is UTF8 unless explicitly specified otherwise. (for that specific sysfs-attribute).

Regards,

Hans

#7 lore raw
Quoted 6 lines

I really prefer min_value and max_value here, those have 2 advantages:

1. min/max is used almost everywhere in the kernel/sysfs for things like this, upper-/lower-bound feels a bit like archaic Enlish to me.

Quoted 6 lines

2. The _value postfix makes it immediately clear that they are the bounds for the current_value attribute.

Also in case of the password sysfs inteface min/max_lenght is used, not e.g. password_length_lower_bound. So again using min/max seems more consistent.

OK.

Quoted 5 lines

Sure I would be happy to have it documented that all firmware-attributes sysfs-files
are optional *except for type and current_value*. If you prefer that go for it.

OK.

Quoted 26 lines
Quoted 26 lines

+

Quoted 22 lines

Documentation/ABI/testing/sysfs-class-firmware-attributes line 142

Quoted 2 lines
Documentation/ABI/testing/sysfs-class-firmware-attributes new file +2 -0
+		Drivers may emit a CHANGE uevent when a password is set or unset
+		userspace may check it again.

First of all some generic remarks:

Currently the "Admin" and "System" names come directly from the Dell WMI interface. I have 2 concerns with this:

1) What if we do get multiple authentication mechanisms for a single user, e.g. both a type == "pasword" and type == "hotp" authentication. The way I have
been thinking about that sofar, is that we then get 2 admin dirs under the /sys/class/firmware-attributes/*/authentication dir, with a type attribute per dir, following how we do the attributes. So we would get e.g. these 2 dirs:

/sys/class/firmware-attributes/dell/authentication/admin-password /sys/class/firmware-attributes/dell/authentication/admin-hotp

For the admin user. If want to do it like this in the future we should add some indirection between the WMI username and the dir which is created now and create the Admin dir as admin-password starting now.

Quoted 5 lines
Quoted 1 line

Yeah I think if HOTP is added to some vendor some day that's how it would

work.

Quoted 1 line

The indirection can be added at that time. One way to do this is to add

It seems you never finished your sentence here?

Whoops - yeah I was jumping around in my response and forgot to finish my thought.

I was going to suggest that if necessary a compatible way to add these would be symlinks. So if the directory right now was Admin and later was had split to something like AdminHotp/AdminPassword
but wanted to discriminate between the old Admin it could be Admin->AdminPassword or vice versa.

Quoted 39 lines
Quoted 8 lines
Quoted 8 lines

2) The "Admin" name is clear enough, but the "System" name is somewhat ambiguous and other vendors may call this differently, I think I have at least seen it called the "User" password in some cases and Lenovo seems to call it a power-on-password. I think that just calling it the "boot" password makes sense. My main concern is that "System" is a bit too vague. So then for now we would get:

Quoted 8 lines
Quoted 2 lines

/sys/class/firmware-attributes/dell/authentication/admin-password /sys/class/firmware-attributes/dell/authentication/boot-password

I want to be cognizant that vendors are going to call things differently in their attributes and we want the specifications and/or whitepapers that vendors use to refer to this to make sense to the system's administrator.

Dell uses the nomenclature "System" in all of it's documentation. If the

Linux

Quoted 11 lines

implementation calls it "boot password" or "power on password" it will be confusing to decode when someone see it.

Dell also has other terms used such as Master password and HDD password. They're not exposed in this interface but these all might have a different connotation across vendors.

So instead I would propose that within the folder the "type" attribute correspond to something decodable. So the name the vendor uses is the folder and the type of password is within a sysfs file "type".

Quoted 5 lines

Proposed types:
* "bios-admin"
* "power-on"

Those two types can then be hardcoded by the implementation.

If re-using the WMI names is important for you, then having a sysfs-attribute with some standardized value to say what is what inside the authentication- sub-dir
is fine with me.

Quoted 4 lines

Except that I would not call it type, when thinking about authentication-types I think about things like password / totp / hotp. Can we call the sysfs- attribute
for this "role" instead ?

That sounds good to me.

Quoted 13 lines
Quoted 3 lines

So a user would see the different authentication mechanisms available by looking At the contents of /sys/class/firmware-

attributes/*/authentication

Quoted 1 line

and if they don't understand it's purpose they look at the type sysfs file.

But one role can still have multiple mechanisms, so for Dell in the future we could have say:

/sys/class/firmware-attributes/dell/authentication/Admin-password /sys/class/firmware-attributes/dell/authentication/Admin-hotp /sys/class/firmware-attributes/dell/authentication/System-password

Quoted 5 lines

So although I'm fine with taking the role_name directly from WMI (combined with a roll attribute with standardized values) I think we still need to postfix a -password to it now, to allow room for adding say a -hotp mechanism for the same role_name in the future ?

Could this be captured in the role attribute instead perhaps? So the role attributes values could hypothetically be:
bios-admin-password
power-on-password

And if HOTP is added some day these could be added:
bios-admin-hotp
power-on-hotp

Quoted 11 lines

(I guess this also ties into your unanswered question from above.

Quoted 8 lines
Quoted 8 lines

The spec. should also specify that the part before the first '-' is the username, and the part after it is the authentication type. E.g. the docs for this could look something like this:

Directories under /sys/class/firmware-attributes/*/authentication/ use the following directory-name pattern:
<username>-<authentication_method>

Quoted 9 lines
Quoted 4 lines
Quoted 1 line

Where username must be one of: "admin" or "boot":

Username is inappropriate in this context, especially since firmware doesn't have a concept of multi-user. It's a configurable permissions scheme to

what

Quoted 1 line

you are allowed to do in firmware.

Ack, so as I asked above, what do you think of using "role" here instead?

+1

Quoted 85 lines
Quoted 28 lines
Quoted 28 lines

admin If any authentication_method is enabled for the admin user, then
authentication as the admin user is required to modify BIOS
settings.
boot If any authentication_method is enabled for the admin user, then
authentication as the boot user is required to boot the machine.

And where authentication_method must be "password". Note in the future both more usernames and more authentication_method-s may be added.

All authentication_methods must have the following sysfs-attributes:

is_enabled: This reads "1" if the authentication_method is enabled,
and "0" if its disabled

Any changes to authentication_methods will generate a change uevent, upon receiving this event applications should recheck the authentication settings such as the is_enabled flag.

Password authentication_method specific sysfs-attributes:

max_password_length: ... (continue with the old text)

Note:

1) This is a proposal to make the authentication bits a bit more generic / future proof. This is very much open for discussion.

Quoted 8 lines
Quoted 8 lines

2) The new generic is_enabled sysfs-attribute replaces the is_authentication_set flag

###

So as with the actual firmware-attributes I have also been comparing the authentication
bits for the Dell case with the community thinkpad_wmi code. And again

things

Quoted 5 lines
Quoted 5 lines

are a pretty
good match already, including being able to query a minimum and maximin password length.

The only thing which is different, which I think would be good to add now,

is

Quoted 5 lines
Quoted 5 lines

a password_encoding sysfs-attribute. The Lenovo password interface supports 2 encodings, "ascii" and "scancodes". Although I wonder if scancodes still works on modern UEFI based platforms.

Since the Dell password code uses UTF8 to UTF16 translation routines, I

guess

Quoted 11 lines
Quoted 11 lines

the encoding for the Dell password is UTF8 (at the sysfs level). So I would like to propose
an extra password-authentication attribute like:

password_encoding: A file that can be read to obtain the encoding used
by
the current_password and new_password attributes. The value returned should be one of: "utf8", "ascii". In some cases this may return a vendor-specific encoding like, e.g. "lenovo-scancodes".

Quoted 3 lines
Quoted 1 line

And for the Dell driver this would just be hardcoded to utf8.

I don't really believe that another vendor's implementation would be likely

to

Quoted 1 line

use scan codes for the input into the WMI method.

I did not make that example up, Lenovo really as a scan-codes encoding for their password authentication mechanism, see:

https://download.lenovo.com/pccbbs/mobiles_pdf/kbl-r_deploy_01.pdf

Quoted 1 line

Think back to how this all works on Windows...

<snip>

Quoted 1 line

So if you had to manually convert to scancodes, that would not at all user

friendly.

It definitely is not user-friendly.

Note when calling the Lenovo WMI functions you can specify in which encoding (ascii or scancodes) you are providing the data and all Lenovo's examples use the ascii encoding. But there also is a bitfield with supported encodings and I guess some older firmware may only support the scancodes variant?

Quoted 5 lines

It is all somewhat not nice, which is why I prefixed the scancodes encoding with lenovo- to make it clear that it is non-standard.

But lets say all Lenovo models support the ascii encoding and we never expose the scancodes bit to userspace.

The documentation you linked doesn't seem to indicate when to use scancodes or ASCII to me, so I can't draw any conclusions if certain models support one or the other.

I would suggest yes please don't support scancodes from the sysfs perspective for another vendor's implementation. We should probably keep sysfs as utf8 and let any conversions be hidden in the kernel driver if necessary.

Quoted 4 lines

Even then there still is the unicode (utf8
in sysfs, utf16 at the WMI level for Dell) vs ascii issue and it would be nice if a UI for this could give an error when the user tries to use non ascii chars in a password for a vendor implementation...

I think that the kernel driver can certainly parse and provide -EINVAL in this context.

Quoted 11 lines
Quoted 2 lines

I would much prefer that this attribute only be added if it's actually

deemed

Quoted 1 line

necessary. Or to my point that all attributes can be considered optional,

Dell's

Quoted 1 line

implementation would just not offer it.

I guess that would work (Dell not offering it). Which makes me realize that we should specify somewhere in the doc that all sysfs files which contain a string value, the encoding is UTF8 unless explicitly specified otherwise. (for that specific sysfs-attribute).

Yeah. I guess the very top where we will modify to mention that all attributes are optional we can also mention that the encoding is UTF8 unless otherwise specified.

Andy -

BTW - with the maintainer change in platform-x86 should Divya stop CC you and Darren?

#8 lore raw

Hi,

On 9/25/20 8:37 PM, Limonciello, Mario wrote:

<snip>

Quoted 18 lines
Quoted 12 lines
Quoted 2 lines

So a user would see the different authentication mechanisms available by looking At the contents of /sys/class/firmware-

attributes/*/authentication

Quoted 1 line

and if they don't understand it's purpose they look at the type sysfs file.

But one role can still have multiple mechanisms, so for Dell in the future we could have say:

/sys/class/firmware-attributes/dell/authentication/Admin-password /sys/class/firmware-attributes/dell/authentication/Admin-hotp /sys/class/firmware-attributes/dell/authentication/System-password

Quoted 5 lines

So although I'm fine with taking the role_name directly from WMI (combined with a roll attribute with standardized values) I think we still need to postfix a -password to it now, to allow room for adding say a -hotp mechanism for the same role_name in the future ?

Quoted 8 lines

Could this be captured in the role attribute instead perhaps? So the role attributes values could hypothetically be:
bios-admin-password
power-on-password

And if HOTP is added some day these could be added:
bios-admin-hotp
power-on-hotp

I would rather have the auth-mechanism-type in a separate mechanism sysfs-file which could then contain e.g. "password" or "hotp".

But that does not solve the bit which I'm worried about, what I'm worried about is a future scenario where there are multiple auth mechanisms for the Admin role, and assuming we use one dir per auth-mechanism then we would need 2 Admin sub-dirs which is not allowed of course.

I assume that that is what the symlink suggestion you did:

Quoted 5 lines

I was going to suggest that if necessary a compatible way to add these would be symlinks. So if the directory right now was Admin and later was had split to something like AdminHotp/AdminPassword
but wanted to discriminate between the old Admin it could be Admin->AdminPassword or vice versa.

Is meant to address. So for now we go with just Admin and then if the 2 auth-mechanisms for Admin at the same time scenario happens add the "-<mechanism>" suffix to the directory name at that point. Or I guess we could even add a ".%d" suffix for duplicates, since the mechanism info would already be in the separate mechanism sysfs file. Then we can also avoid the symlink since we can just leave out the .%d suffix when the integer for %d is 0, there is precedence for that.

So TL;DR: yes we could put the mechanism in a sysfs file too, in that case I would prefer to go with a separate file though, rather then concatenating it to the role and storing it in the role sysfs file.

If we have both the role and mechanism (hardcoded to "password" for now) as sysfs-files in say a:

/sys/class/firmware-attributes/dell/authentication/Admin

Dir then indeed we will not need the "-password" suffix. And if we get more then one auth-mechanism for say the "Admin" role then we can just name the second subdir Admin.1, etc.

So compared to the current sysfs API from the v4 patch that would mean adding the role ("admin", or "power-on") and mechanism (always "password" for now) sysfs files and otherwise no changes.

Oh and can we rename the "is_authentication_set" sysfs file to "is_enabled" please? Being set is well defined for a password, but not so much for possible other authentication-mechanisms.

<snip>

Quoted 40 lines
Quoted 40 lines
Quoted 5 lines
Quoted 5 lines

###

So as with the actual firmware-attributes I have also been comparing the authentication
bits for the Dell case with the community thinkpad_wmi code. And again

things

Quoted 5 lines
Quoted 5 lines

are a pretty
good match already, including being able to query a minimum and maximin password length.

The only thing which is different, which I think would be good to add now,

is

Quoted 5 lines
Quoted 5 lines

a password_encoding sysfs-attribute. The Lenovo password interface supports 2 encodings, "ascii" and "scancodes". Although I wonder if scancodes still works on modern UEFI based platforms.

Since the Dell password code uses UTF8 to UTF16 translation routines, I

guess

Quoted 11 lines
Quoted 11 lines

the encoding for the Dell password is UTF8 (at the sysfs level). So I would like to propose
an extra password-authentication attribute like:

password_encoding: A file that can be read to obtain the encoding used
by
the current_password and new_password attributes. The value returned should be one of: "utf8", "ascii". In some cases this may return a vendor-specific encoding like, e.g. "lenovo-scancodes".

Quoted 3 lines
Quoted 1 line

And for the Dell driver this would just be hardcoded to utf8.

I don't really believe that another vendor's implementation would be likely

to

Quoted 1 line

use scan codes for the input into the WMI method.

I did not make that example up, Lenovo really as a scan-codes encoding for their password authentication mechanism, see:

https://download.lenovo.com/pccbbs/mobiles_pdf/kbl-r_deploy_01.pdf

<snip>

Quoted 7 lines

The documentation you linked doesn't seem to indicate when to use scancodes or ASCII to me, so I can't draw any conclusions if certain models support one or the other.

I would suggest yes please don't support scancodes from the sysfs perspective for another vendor's implementation. We should probably keep sysfs as utf8 and let any conversions be hidden in the kernel driver if necessary.

Doing the conversions in kernel is not really ideal, the kernels i18n support is very limited. But yes for utf8->ascii and utf8->utf16 we can do the conversion in kernel.

Quoted 7 lines
Quoted 4 lines

Even then there still is the unicode (utf8
in sysfs, utf16 at the WMI level for Dell) vs ascii issue and it would be nice if a UI for this could give an error when the user tries to use non ascii chars in a password for a vendor implementation...

I think that the kernel driver can certainly parse and provide -EINVAL in this context.

True, but the advantage of having userspace know it needs to be ascii is that it can provide a much more sensible error message to the user when the user tries to use non ascii in the password.

So I think that in the non utf8 case it would still be good to have a password_encoding file. With that said, as discussed this sysfs-file will be optional too, so for the "Systems Management Driver over WMI for Dell Systems" we can just leave it out and then revisit when we merge a driver which does not support utf8 for passwords.

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

I would much prefer that this attribute only be added if it's actually

deemed

Quoted 1 line

necessary. Or to my point that all attributes can be considered optional,

Dell's

Quoted 1 line

implementation would just not offer it.

Quoted 8 lines
Quoted 4 lines

I guess that would work (Dell not offering it). Which makes me realize that we should specify somewhere in the doc that all sysfs files which contain a string value, the encoding is UTF8 unless explicitly specified otherwise. (for that specific sysfs-attribute).

Yeah. I guess the very top where we will modify to mention that all attributes are optional we can also mention that the encoding is UTF8 unless otherwise specified.

Ack.

Regards,

Hans