android_kernel_samsung_sm8650/drivers/misc
John Stultz f580df859b ANDROID: uid_sys_stats: Use llist for deferred work
A use-after-free bug was found in the previous custom lock-free list
implementation for the deferred work, so switch functionality to llist
implementation.

While the previous approach atomically handled the list head, it did not
assure the new node's next pointer was assigned before the head was
pointed to the node, allowing the consumer to traverse to an invalid
next pointer.

Additionally, in switching to llists, this patch pulls the entire list
off the list head once and processes it separately, reducing the number
of atomic operations compared with the custom lists's implementation
which pulled one node at a time atomically from the list head.

BUG: KASAN: use-after-free in process_notifier+0x270/0x2dc
Write of size 8 at addr d4ffff89545c3c58 by task Blocking Thread/3431
Pointer tag: [d4], memory tag: [fe]

call trace:
 dump_backtrace+0xf8/0x118
 show_stack+0x18/0x24
 dump_stack_lvl+0x60/0x78
 print_report+0x178/0x470
 kasan_report+0x8c/0xbc
 kasan_tag_mismatch+0x28/0x3c
 __hwasan_tag_mismatch+0x30/0x60
 process_notifier+0x270/0x2dc
 notifier_call_chain+0xb4/0x108
 blocking_notifier_call_chain+0x54/0x80
 profile_task_exit+0x20/0x2c
 do_exit+0xec/0x1114
 __arm64_sys_exit_group+0x0/0x24
 get_signal+0x93c/0xa78
 do_notify_resume+0x158/0x3fc
 el0_svc+0x54/0x78
 el0t_64_sync_handler+0x44/0xe4
 el0t_64_sync+0x190/0x194

Bug: 294468796
Bug: 295787403
Bug: 299197985
Fixes: 8e86825eec ("ANDROID: uid_sys_stats: Use a single work for deferred updates")
Change-Id: Id377348c239ec720a5237726bc3632544d737e3b
Signed-off-by: John Stultz <jstultz@google.com>
[nkapron: Squashed with other changes and rewrote the commit message]
Signed-off-by: Neill Kapron <nkapron@google.com>
(cherry picked from commit 87647c0c54)
2023-09-08 11:11:08 +00:00
..
altera-stapl
bcm-vk
c2port
cardreader
cb710
cxl UPSTREAM: mm: replace vma->vm_flags direct modifications with modifier calls 2023-06-07 14:24:57 +00:00
echo
eeprom eeprom: idt_89hpesx: Fix error handling in idt_init() 2023-03-10 09:33:32 +01:00
genwqe
habanalabs UPSTREAM: mm: replace vma->vm_flags direct modifications with modifier calls 2023-06-07 14:24:57 +00:00
ibmasm
lis3lv02d
lkdtm lkdtm: cfi: Make PAC test work with GCC 7 and 8 2022-12-31 13:33:07 +01:00
mchp_pci1xxxx
mei mei: bus-fixup:upon error print return values of send and receive 2023-03-11 13:55:35 +01:00
ocxl UPSTREAM: mm: replace vma->vm_flags direct modifications with modifier calls 2023-06-07 14:24:57 +00:00
pvpanic
sgi-gru UPSTREAM: mm: replace vma->vm_flags direct modifications with modifier calls 2023-06-07 14:24:57 +00:00
sgi-xp
ti-st
uacce UPSTREAM: mm: replace vma->vm_flags direct modifications with modifier calls 2023-06-07 14:24:57 +00:00
vmw_vmci VMCI: check context->notify_page after call to get_user_pages_fast() to avoid GPF 2023-03-10 09:33:33 +01:00
ad525x_dpot-i2c.c
ad525x_dpot-spi.c
ad525x_dpot.c
ad525x_dpot.h
apds990x.c
apds9802als.c
atmel-ssc.c
bh1770glc.c
cs5535-mfgpt.c
ds1682.c
dummy-irq.c
dw-xdata-pcie.c
enclosure.c
fastrpc.c BACKPORT: firmware: qcom_scm: Use fixed width src vm bitmap 2023-05-16 20:35:28 +00:00
gehc-achc.c
hi6421v600-irq.c
hisi_hikey_usb.c
hmc6352.c
hpilo.c
hpilo.h
ibmvmc.c
ibmvmc.h
ics932s401.c
isl29003.c
isl29020.c
Kconfig Revert "ANDROID: disble the UID_SYS_STATS driver" 2023-03-09 23:13:08 +00:00
kgdbts.c
lattice-ecp3-config.c
Makefile Merge a09476668e ("Merge tag 'char-misc-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc") into android-mainline 2022-10-12 09:34:26 +02:00
open-dice.c UPSTREAM: mm: replace vma->vm_flags direct modifications with modifier calls 2023-06-07 14:24:57 +00:00
pch_phub.c
pci_endpoint_test.c
phantom.c
qcom-coincell.c
sram-exec.c
sram.c
sram.h
tifm_7xx1.c misc: tifm: fix possible memory leak in tifm_7xx1_switch_media() 2022-12-31 13:32:40 +01:00
tifm_core.c
tsl2550.c
uid_sys_stats.c ANDROID: uid_sys_stats: Use llist for deferred work 2023-09-08 11:11:08 +00:00
vcpu_stall_detector.c
vmw_balloon.c misc: vmw_balloon: fix memory leak with using debugfs_lookup() 2023-03-11 13:55:39 +01:00
xilinx_sdfec.c