board: make usb subsystem a built-in

Use kernel cmdline option 'usbcore.authorized_default=2' to lock all
external/user-visible USB ports by default.

The kernel distinguishes internal vs external USB ports using ACPI
methods (_UPC and _PLD) on x86/x86_64 systems.  On ACPI systems, ports
marked as non-visible but connectable are considered internal (e.g.,
hard-wired USB-to-Ethernet adapters) and are automatically authorized,
while user-visible external ports require manual authorization.

However, on device tree systems the kernel lacks a standard mechanism
for identifying internal ports. The 'authorized_default=2' setting falls
back to requiring authorization for all devices on these platforms,

We list user-accessible USB ports in the device tree ('usb-ports' and
'usb-port-names'), with unlisted ports being implicitly internal and
managed separately.

Fixes #1065

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2025-10-31 13:25:59 +01:00
parent b2a41e4868
commit 937d4c38c7
6 changed files with 7 additions and 10 deletions
+1 -1
View File
@@ -433,7 +433,7 @@ CONFIG_REGULATOR_S2MPS11=y
# CONFIG_HID_MICROSOFT is not set
# CONFIG_HID_MONTEREY is not set
CONFIG_USB_ULPI_BUS=y
CONFIG_USB=m
CONFIG_USB=y
CONFIG_USB_OTG=y
CONFIG_USB_XHCI_HCD=m
CONFIG_USB_XHCI_MVEBU=m
@@ -1,4 +1,4 @@
label Infix (aarch64)
kernel /boot/Image
fdtdir /boot
append ${bootargs_root} ${bootargs_log} -- ${bootargs_user}
append ${bootargs_root} ${bootargs_log} usbcore.authorized_default=2 -- ${bootargs_user}
@@ -1,3 +0,0 @@
# Do not authorize usb ports before they have been checked in in the device-tree
options usbcore authorized_default=0
@@ -1,4 +1,4 @@
label Infix (riscv64)
kernel /boot/Image
fdtdir /boot
append ${bootargs_root} ${bootargs_log} -- ${bootargs_user}
append ${bootargs_root} ${bootargs_log} usbcore.authorized_default=2 -- ${bootargs_user}
+3 -3
View File
@@ -42,14 +42,14 @@ export secondary
submenu "primary" "$log" {
set slot="$1"
set append="console=ttyS0 console=hvc0 root=PARTLABEL=$slot $2"
set append="console=ttyS0 console=hvc0 usbcore.authorized_default=2 root=PARTLABEL=$slot $2"
set root="($primary)"
source /boot/grub/grub.cfg
}
submenu "secondary" "$log" {
set slot="$1"
set append="console=ttyS0 console=hvc0 root=PARTLABEL=$slot $2"
set append="console=ttyS0 console=hvc0 usbcore.authorized_default=2 root=PARTLABEL=$slot $2"
set root="($secondary)"
source /boot/grub/grub.cfg
}
@@ -63,7 +63,7 @@ submenu "net" "$log" {
set root=(initrd)
set slot="$1"
set append="console=ttyS0 console=hvc0 qroot=/dev/ram0 ramdisk_size=65536 $2"
set append="console=ttyS0 console=hvc0 usbcore.authorized_default=2 qroot=/dev/ram0 ramdisk_size=65536 $2"
source /boot/grub/grub.cfg
else
if [ -z "$net_efinet0_dhcp_next_server" ]; then
+1 -1
View File
@@ -219,7 +219,7 @@ CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_SYSFS=y
CONFIG_SOFT_WATCHDOG=y
CONFIG_I6300ESB_WDT=y
CONFIG_USB=m
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=m
CONFIG_USB_EHCI_HCD=m
CONFIG_USB_UHCI_HCD=m