kernel_samsung_a53x/arch
Yu-Ting Tseng 8e9a3808d7 BACKPORT: FROMGIT: binder: frozen notification
Frozen processes present a significant challenge in binder transactions.
When a process is frozen, it cannot, by design, accept and/or respond to
binder transactions. As a result, the sender needs to adjust its
behavior, such as postponing transactions until the peer process
unfreezes. However, there is currently no way to subscribe to these
state change events, making it impossible to implement frozen-aware
behaviors efficiently.

Introduce a binder API for subscribing to frozen state change events.
This allows programs to react to changes in peer process state,
mitigating issues related to binder transactions sent to frozen
processes.

Implementation details:
For a given binder_ref, the state of frozen notification can be one of
the followings:
1. Userspace doesn't want a notification. binder_ref->freeze is null.
2. Userspace wants a notification but none is in flight.
   list_empty(&binder_ref->freeze->work.entry) = true
3. A notification is in flight and waiting to be read by userspace.
   binder_ref_freeze.sent is false.
4. A notification was read by userspace and kernel is waiting for an ack.
   binder_ref_freeze.sent is true.

When a notification is in flight, new state change events are coalesced into
the existing binder_ref_freeze struct. If userspace hasn't picked up the
notification yet, the driver simply rewrites the state. Otherwise, the
notification is flagged as requiring a resend, which will be performed
once userspace acks the original notification that's inflight.

See https://r.android.com/3070045 for how userspace is going to use this
feature.

Signed-off-by: Yu-Ting Tseng <yutingtseng@google.com>
Acked-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20240709070047.4055369-4-yutingtseng@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 363013421
(cherry picked from commit d579b04a52a183db47dfcb7a44304d7747d551e1
 git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
 char-misc-next)
Change-Id: I5dd32abba932ca7d03ae58660143e075ed778b81
[cmllamas: fix merge conflicts due to missing 0567461a7a6e]
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2025-01-19 14:57:12 +01:00
..
alpha
arc ARC: build: Try to guess GCC variant of cross compiler 2025-01-15 16:29:56 +01:00
arm Revert "clkdev: remove CONFIG_CLKDEV_LOOKUP" 2025-01-02 17:01:18 +01:00
arm64 BACKPORT: FROMGIT: binder: frozen notification 2025-01-19 14:57:12 +01:00
c6x
csky csky, hexagon: fix broken sys_sync_file_range 2024-11-19 14:19:34 +01:00
h8300
hexagon hexagon: fix fadvise64_64 calling conventions 2024-11-19 14:19:34 +01:00
ia64 efi: ia64: move IA64-only declarations to new asm/efi.h header 2024-11-19 14:19:45 +01:00
m68k m68k: coldfire/device.c: only build FEC when HW macros are defined 2024-12-17 13:24:12 +01:00
microblaze Revert "microblaze: don't treat zero reserved memory regions as error" 2024-11-24 00:23:33 +01:00
mips MIPS: cevt-r4k: Don't call get_c0_compare_int if timer irq is installed 2025-01-19 00:09:59 +01:00
nds32
nios2
openrisc openrisc: Call setup_memory() earlier in the init sequence 2024-11-23 23:20:47 +01:00
parisc Revert "parisc: Fix itlb miss handler for 64-bit programs" 2024-11-24 00:23:05 +01:00
powerpc powerpc/prom_init: Fixup missing powermac #size-cells 2024-12-17 13:24:32 +01:00
riscv Revert "riscv: Fix fp alignment bug in perf_callchain_user()" 2024-11-24 00:23:20 +01:00
s390 s390/vmlinux.lds.S: Move ro_after_init section behind rodata section 2025-01-19 00:09:59 +01:00
sh Revert "clkdev: remove CONFIG_CLKDEV_LOOKUP" 2025-01-02 17:01:18 +01:00
sparc sparc64: Fix incorrect function signature and add prototype for prom_cif_init 2024-11-23 23:20:10 +01:00
um um: line: always fill *error_out in setup_one_line() 2025-01-19 00:10:00 +01:00
x86 ANDROID: fix up change to pti_clone_pgtable() 2025-01-19 00:09:58 +01:00
xtensa
Kconfig cpu: Re-enable CPU mitigations by default for !X86 architectures 2024-11-19 11:32:38 +01:00