From 78004e9a87f240df03e2f73120d291763c32e0a7 Mon Sep 17 00:00:00 2001 From: Ali Ahmet Memis Date: Fri, 21 Aug 2026 01:45:27 +0000 Subject: openrisc: fix arbitrary kernel memory access via or1k_atomic syscall sys_or1k_atomic() (syscall 244 in the "or1k" ABI) takes two user pointers, v1 and v2, and swaps the words they point to in hand-written assembly. l.lwz r29,0(r4) l.lwz r27,0(r5) l.sw 0(r4),r27 l.sw 0(r5),r29 The pointers are not checked with access_ok(). The four memory accesses also have no exception table entries. A caller passes a kernel address as either pointer, and the syscall reads from and writes to it directly. This gives an unprivileged process a kernel read/write primitive. It overwrites kernel data such as the sys_call_table, gaining code execution in kernel context. Check both pointers before entering the critical section. Add fixups for the four memory accesses so faults on valid but unmapped user addresses return -EFAULT. [shorne@gmail.com: fix comment style] Fixes: 9d02a4283e9c ("OpenRISC: Boot code") Cc: stable@vger.kernel.org Signed-off-by: Ali Ahmet Memis Signed-off-by: Stafford Horne --- .../time/arch-tick-broadcast/arch-support.txt | 30 ++++++++++++++++++++++ .../features/time/clockevents/arch-support.txt | 30 ++++++++++++++++++++++ .../time/context-tracking/arch-support.txt | 30 ++++++++++++++++++++++ .../features/time/irq-time-acct/arch-support.txt | 30 ++++++++++++++++++++++ .../features/time/virt-cpuacct/arch-support.txt | 30 ++++++++++++++++++++++ 5 files changed, 150 insertions(+) create mode 100644 Documentation/features/time/arch-tick-broadcast/arch-support.txt create mode 100644 Documentation/features/time/clockevents/arch-support.txt create mode 100644 Documentation/features/time/context-tracking/arch-support.txt create mode 100644 Documentation/features/time/irq-time-acct/arch-support.txt create mode 100644 Documentation/features/time/virt-cpuacct/arch-support.txt (limited to 'Documentation/features/time') diff --git a/Documentation/features/time/arch-tick-broadcast/arch-support.txt b/Documentation/features/time/arch-tick-broadcast/arch-support.txt new file mode 100644 index 000000000..ccba965e8 --- /dev/null +++ b/Documentation/features/time/arch-tick-broadcast/arch-support.txt @@ -0,0 +1,30 @@ +# +# Feature name: arch-tick-broadcast +# Kconfig: ARCH_HAS_TICK_BROADCAST +# description: arch provides tick_broadcast() +# + ----------------------- + | arch |status| + ----------------------- + | alpha: | TODO | + | arc: | TODO | + | arm: | ok | + | arm64: | ok | + | csky: | TODO | + | hexagon: | TODO | + | loongarch: | ok | + | m68k: | TODO | + | microblaze: | TODO | + | mips: | ok | + | nios2: | TODO | + | openrisc: | TODO | + | parisc: | TODO | + | powerpc: | ok | + | riscv: | ok | + | s390: | TODO | + | sh: | ok | + | sparc: | TODO | + | um: | TODO | + | x86: | TODO | + | xtensa: | TODO | + ----------------------- diff --git a/Documentation/features/time/clockevents/arch-support.txt b/Documentation/features/time/clockevents/arch-support.txt new file mode 100644 index 000000000..d6100b226 --- /dev/null +++ b/Documentation/features/time/clockevents/arch-support.txt @@ -0,0 +1,30 @@ +# +# Feature name: clockevents +# Kconfig: !LEGACY_TIMER_TICK +# description: arch support generic clock events +# + ----------------------- + | arch |status| + ----------------------- + | alpha: | ok | + | arc: | ok | + | arm: | TODO | + | arm64: | ok | + | csky: | ok | + | hexagon: | ok | + | loongarch: | ok | + | m68k: | TODO | + | microblaze: | ok | + | mips: | ok | + | nios2: | ok | + | openrisc: | ok | + | parisc: | ok | + | powerpc: | ok | + | riscv: | ok | + | s390: | ok | + | sh: | ok | + | sparc: | ok | + | um: | ok | + | x86: | ok | + | xtensa: | ok | + ----------------------- diff --git a/Documentation/features/time/context-tracking/arch-support.txt b/Documentation/features/time/context-tracking/arch-support.txt new file mode 100644 index 000000000..891be9f61 --- /dev/null +++ b/Documentation/features/time/context-tracking/arch-support.txt @@ -0,0 +1,30 @@ +# +# Feature name: user-context-tracking +# Kconfig: HAVE_CONTEXT_TRACKING_USER +# description: arch supports user context tracking for NO_HZ_FULL +# + ----------------------- + | arch |status| + ----------------------- + | alpha: | TODO | + | arc: | TODO | + | arm: | ok | + | arm64: | ok | + | csky: | ok | + | hexagon: | TODO | + | loongarch: | ok | + | m68k: | TODO | + | microblaze: | TODO | + | mips: | ok | + | nios2: | TODO | + | openrisc: | TODO | + | parisc: | TODO | + | powerpc: | ok | + | riscv: | ok | + | s390: | TODO | + | sh: | TODO | + | sparc: | ok | + | um: | TODO | + | x86: | ok | + | xtensa: | ok | + ----------------------- diff --git a/Documentation/features/time/irq-time-acct/arch-support.txt b/Documentation/features/time/irq-time-acct/arch-support.txt new file mode 100644 index 000000000..3d10075a8 --- /dev/null +++ b/Documentation/features/time/irq-time-acct/arch-support.txt @@ -0,0 +1,30 @@ +# +# Feature name: irq-time-acct +# Kconfig: HAVE_IRQ_TIME_ACCOUNTING +# description: arch supports precise IRQ time accounting +# + ----------------------- + | arch |status| + ----------------------- + | alpha: | .. | + | arc: | TODO | + | arm: | ok | + | arm64: | ok | + | csky: | TODO | + | hexagon: | TODO | + | loongarch: | ok | + | m68k: | TODO | + | microblaze: | TODO | + | mips: | ok | + | nios2: | TODO | + | openrisc: | TODO | + | parisc: | .. | + | powerpc: | ok | + | riscv: | ok | + | s390: | .. | + | sh: | TODO | + | sparc: | .. | + | um: | TODO | + | x86: | ok | + | xtensa: | ok | + ----------------------- diff --git a/Documentation/features/time/virt-cpuacct/arch-support.txt b/Documentation/features/time/virt-cpuacct/arch-support.txt new file mode 100644 index 000000000..21f11d47e --- /dev/null +++ b/Documentation/features/time/virt-cpuacct/arch-support.txt @@ -0,0 +1,30 @@ +# +# Feature name: virt-cpuacct +# Kconfig: HAVE_VIRT_CPU_ACCOUNTING +# description: arch supports precise virtual CPU time accounting +# + ----------------------- + | arch |status| + ----------------------- + | alpha: | ok | + | arc: | TODO | + | arm: | ok | + | arm64: | ok | + | csky: | ok | + | hexagon: | TODO | + | loongarch: | ok | + | m68k: | TODO | + | microblaze: | TODO | + | mips: | ok | + | nios2: | TODO | + | openrisc: | TODO | + | parisc: | ok | + | powerpc: | ok | + | riscv: | TODO | + | s390: | ok | + | sh: | TODO | + | sparc: | ok | + | um: | TODO | + | x86: | ok | + | xtensa: | ok | + ----------------------- -- cgit v1.3.1