** Description changed:

  SRU Justification
  
  [ Impact ]
  
  tp-smapi cannot be compiled against Kernels 7.2+ as strncpy has been
  replaced by strscpy.
  
  Both upstream https://github.com/linux-
  thinkpad/tp_smapi/pull/81/changes/0483993a64f6d922d71dddd8f7f353d8bc22d1bf
  and debian unstable (# 1146537) already contain the fix.
  
  Fixing Resolute as well in anticipation of HWE Kernels.
  
  [ Fix ]
  
  Merge debian unstable fix
  
  [ Test Case ]
  
  Follow the following steps:
  
  - Install the correct series package from
  https://launchpad.net/~alessiofaina/+archive/ubuntu/20261123-dkms-fixes/
  
  - Check the new package correctly installs in the system
  
  - Verify the compiled tp-smapi module file exists and inspect its module 
metadata (verifies successful build and vermagic match without requiring 
hardware):
     $ MOD=$(ls /lib/modules/$(uname -r)/updates/dkms/thinkpad_ec.ko* | head 
-n1)
     $ modinfo "$MOD"
     $ MOD=$(ls /lib/modules/$(uname -r)/updates/dkms/tp_smapi.ko* | head -n1)
     $ modinfo "$MOD"
     $ MOD=$(ls /lib/modules/$(uname -r)/updates/dkms/hdaps.ko* | head -n1)
     $ modinfo "$MOD"
     Expected result: modinfo outputs valid module metadata with vermagic 
matching $(uname -r) and no errors.
  
- [ Regression potential ]
+ [ What could go wrong ]
  
- Changing from strncpy to strscpy force the string to be NULL terminated.
- This doesn't change much as buf[maxlen] = 0; forces the NUL termination
- anyway so no real regression can be expected.
+ Resolute ships the 7.0 GA kernel and will later get HWE kernels up to 7.3.
+ Kernels from 7.2 onwards no longer provide strncpy(), so tp-smapi fails to 
build there. Without this fix, users of the 7.2+ HWE kernels would hit a DKMS 
build failure when the HWE kernel is installed and would lose the thinkpad_ec, 
tp_smapi and hdaps modules (battery charge thresholds, battery info and HDD 
active protection) after the upgrade.
+ 
+ The change is not version-conditional: strncpy() is replaced by strscpy() for 
all kernels. strscpy() has been available since Linux 4.3, so the package still 
builds and behaves the same way on the 7.0 GA kernel and on the 7.3 HWE kernel.
+ A build failure on either one would show up as a DKMS error on installation 
or kernel upgrade, and the test case covers that.
+ 
+ There is one small change in behaviour. strncpy(buf, src, maxlen) copied up 
to maxlen characters, but strscpy(buf, src, maxlen) copies at most maxlen-1 
characters and then adds the NUL terminator. A battery string from the EC that 
fills its whole field will lose its last character in sysfs. This affects 
/sys/devices/platform/smapi/BAT*/manufacturer, model and barcoding (maxlen  
TP_CONTROLLER_ROW_LEN-2) and chemistry (maxlen 5), so a 5-character chemistry  
value would show as 4 characters. Nothing else changes: the explicit 
buf[maxlen] = 0 is kept, the output is still NUL-terminated, and there is no 
risk of overflow.
+ Only tools that read these sysfs strings for display could notice. Charge 
control, the numeric battery values and hdaps are not touched by this change.
  
  [ Discussion ]
  
  This cannot be a sync as Ubuntu has a different Architecture field in
  d/control, removing i386 from it.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2173763

Title:
  tp-smapi DKMS cannot build against Kernel 7.2+

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/tp-smapi/+bug/2173763/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to