Bug#978011: udev: uaccess is set before ID_SMARTCARD_READER

Vincent Pelletier plr.vincent at gmail.com
Thu Dec 24 11:04:26 GMT 2020


Package: systemd
Version: 247.2-2
Severity: normal

Dear Maintainer,

I have a smartcard reader which exposes the CCID class (0x0b) on its function.
I see there are udev rules to grant uaccess based on this:

  $ rgrep SMARTCARD /lib/udev/rules.d
  70-uaccess.rules:ENV{ID_SMARTCARD_READER}=="?*", TAG+="uaccess"
  99-systemd.rules:SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0b????:*", ENV{ID_SMARTCARD_READER}="1"
  99-systemd.rules:ENV{ID_SMARTCARD_READER}=="?*", TAG+="systemd", ENV{SYSTEMD_WANTS}+="smartcard.target", ENV{SYSTEMD_USER_WANTS}+="smartcard.target"

Which make me think that there is an intent to grant uaccess to these devices.

but while the ones in 99-systemd.rules have an effect (see below for
"udevadm info", note ID_SMARTCARD_READER=1 and
SYSTEMD_*WANTS=smartcard.target being present), the TAG+="uaccess" does not.

I suspect this is because of the file ordering: 70-uaccess vs. 99-systemd .

Wouldn't it make more sense to apply the uaccess rules after setting the
ID_SMARTCARD_READER flag ?

I have no special knowledge of these files, and I suspect it is not as easy as
reordering them. I guess a fix would rather be to set these flags much earlier,
then setting the uaccess rules in 60-uaccess.rules, and finally setting the
SYSTEMD_*WANTS in 99-sustemd.rules.

Such change would avoid having to write a custom rule for such device, and
would be greatly appreciated.

$ udevadm info --query=all /sys/bus/usb/devices/1-9.3
P: /devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9.3
N: bus/usb/001/051
L: 0
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9.3
E: DEVNAME=/dev/bus/usb/001/051
E: DEVTYPE=usb_device
E: DRIVER=usb
E: PRODUCT=1d6b/104/509
E: TYPE=0/0/0
E: BUSNUM=001
E: DEVNUM=051
E: MAJOR=189
E: MINOR=50
E: SUBSYSTEM=usb
E: USEC_INITIALIZED=308446022565
E: ID_VENDOR=Vincent_Pelletier
E: ID_VENDOR_ENC=Vincent\x20Pelletier
E: ID_VENDOR_ID=1d6b
E: ID_MODEL=python-smartcard-app-openpgp
E: ID_MODEL_ENC=python-smartcard-app-openpgp
E: ID_MODEL_ID=0104
E: ID_REVISION=0509
E: ID_SERIAL=Vincent_Pelletier_python-smartcard-app-openpgp_00000000e8246167
E: ID_SERIAL_SHORT=00000000e8246167
E: ID_BUS=usb
E: ID_USB_INTERFACES=:0b0000:
E: ID_VENDOR_FROM_DATABASE=Linux Foundation
E: ID_MODEL_FROM_DATABASE=Multifunction Composite Gadget
E: ID_PATH=pci-0000:00:14.0-usb-0:9.3
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_9_3
E: ID_FOR_SEAT=usb-pci-0000_00_14_0-usb-0_9_3
E: ID_SMARTCARD_READER=1
E: SYSTEMD_WANTS=smartcard.target
E: SYSTEMD_USER_WANTS=smartcard.target
E: TAGS=:seat:systemd:
E: CURRENT_TAGS=:seat:systemd:

Regards,
Vincent Pelletier

-- Package-specific info:

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf

Kernel: Linux 5.9.0-4-amd64 (SMP w/8 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_FIRMWARE_WORKAROUND, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE=fr:en_GB
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages systemd depends on:
ii  adduser                 3.118
ii  libacl1                 2.2.53-8
ii  libapparmor1            2.13.5-1+b2
ii  libaudit1               1:3.0-1
ii  libblkid1               2.36.1-3
ii  libc6                   2.31-6
ii  libcap2                 1:2.44-1
ii  libcrypt1               1:4.4.17-1
ii  libcryptsetup12         2:2.3.4-1
ii  libgcrypt20             1.8.7-2
ii  libgnutls30             3.7.0-3
ii  libgpg-error0           1.38-2
ii  libip4tc2               1.8.6-1
ii  libkmod2                27+20200310-2
ii  liblz4-1                1.9.3-1
ii  liblzma5                5.2.4-1+b1
ii  libmount1               2.36.1-3
ii  libpam0g                1.3.1-5
ii  libseccomp2             2.5.1-1
ii  libselinux1             3.1-2+b2
ii  libsystemd0             247.2-2
ii  libzstd1                1.4.5+dfsg-4
ii  mount                   2.36.1-3
ii  openntpd [time-daemon]  1:6.2p3-4.1
ii  util-linux              2.36.1-3

Versions of packages systemd recommends:
ii  dbus  1.12.20-1

Versions of packages systemd suggests:
ii  policykit-1        0.105-29
pn  systemd-container  <none>

Versions of packages systemd is related to:
pn  dracut           <none>
ii  initramfs-tools  0.139
pn  libnss-systemd   <none>
ii  libpam-systemd   247.2-2
ii  udev             247.2-2

-- no debconf information



More information about the Pkg-systemd-maintainers mailing list