]> xenbits.xensource.com Git - xen.git/commit
xen/spinlock: Fix UBSAN "load of address with insufficient space" in lock_prof_init()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 29 Oct 2024 15:30:41 +0000 (16:30 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 29 Oct 2024 15:30:41 +0000 (16:30 +0100)
commita756c242ea32d3285d5582bc9aca030bafd24f31
treea5fe3832999407fe0014ee71ef1308513de465e5
parent05292f914f388868f54429f6feeab8c9b0a1b57d
xen/spinlock: Fix UBSAN "load of address with insufficient space" in lock_prof_init()

UBSAN complains:

  (XEN) ================================================================================
  (XEN) UBSAN: Undefined behaviour in common/spinlock.c:794:10
  (XEN) load of address ffff82d040ae24c8 with insufficient space
  (XEN) for an object of type 'struct lock_profile *'
  (XEN) ----[ Xen-4.20-unstable  x86_64  debug=y ubsan=y  Tainted:   C    ]----

This shows up with GCC-14, but not with GCC-12.  I have not bisected further.

Either way, the types for __lock_profile_{start,end} are incorrect.

They are an array of struct lock_profile pointers.  Correct the extern's
types, and adjust the loop to match.

No practical change.

Reported-by: Andreas Glashauser <ag@andreasglashauser.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
master commit: 542ac112fc68c66cfafc577e252404c21da4f75b
master date: 2024-10-14 16:14:26 +0100
xen/common/spinlock.c