linux/include
Marco Elver 2b58c94ea7 list: Permit context-unguarded access with list_empty_careful()
With Context Analysis (viz. Clang's Thread Safety Analysis), list_heads
that are __guarded_by(..) require holding the appropriate context lock
when accessing and manipulating them via the list API. Because Clang's
warning diagnostics do not perform inter-procedural analysis, this is
enforced by Clang with -Wthread-safety-pointer in the caller at the call
boundary; a warning is produced when passing a pointer to a guarded
variable without holding the appropriate context locks:

  warning: passing pointer to variable 'list' requires holding [...] [-Wthread-safety-pointer]
           if (list_empty(&ctrl->list))

An exception is list_empty_careful(), which is like list_empty(), except
that it is permitted to use without holding any context lock (carefully).

Mark list_empty_careful() __context_unsafe, which disables context
analysis within list_empty_careful(), but also suppresses warnings
generated in callers related to its pointer arguments.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
2026-07-28 10:36:47 -07:00
..
acpi Driver core changes for 7.2-rc1 2026-06-15 12:41:17 +05:30
asm-generic Locking updates for v7.2: 2026-06-15 14:21:14 +05:30
clocksource
crypto This update includes the following changes: 2026-06-16 09:01:23 +05:30
cxl
drm Short summary of fixes pull: 2026-06-13 07:52:40 +10:00
dt-bindings dt-bindings: gpio: meson-axg: Fix whitespace issue 2026-05-26 10:02:53 +02:00
hyperv hyperv: Clean up and fix the guest ID comment in hvgdk.h 2026-05-27 15:05:26 -07:00
keys
kunit linux_kselftest-kunit-7.2-rc1 2026-06-16 16:33:57 +05:30
kvm
linux list: Permit context-unguarded access with list_empty_careful() 2026-07-28 10:36:47 -07:00
math-emu
media
memory
misc
net netfilter pull request 26-06-10 2026-06-11 12:30:00 +02:00
pcmcia
ras
rdma RDMA: During rereg_mr ensure that REREG_ACCESS is compatible 2026-06-08 13:39:20 -03:00
rv rv: Prevent task migration while handling per-CPU events 2026-06-03 12:33:25 +02:00
scsi
soc soc: bcm2835: raspberrypi-firmware: Add voltage domain IDs 2026-06-09 08:23:00 -07:00
sound ASoC: Fixes for v7.1 2026-04-23 09:34:28 +02:00
target
trace for-7.2/block-20260615 2026-06-16 13:02:47 +05:30
uapi for-7.2/block-20260615 2026-06-16 13:02:47 +05:30
ufs scsi: ufs: core: Fix bRefClkFreq write failure in HS-LSS mode 2026-04-21 20:58:06 -04:00
vdso futex: Provide infrastructure to plug the non contended robust futex unlock race 2026-06-03 11:38:52 +02:00
video fbdev: udlfb: add vm_ops to dlfb_ops_mmap to prevent use-after-free 2026-05-04 10:35:55 +02:00
xen xen: constify xsd_errors array 2026-06-08 09:00:06 +02:00
Kbuild