<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/arch/csky/kernel, branch v5.4.262</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.4.262</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.4.262'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2023-02-06T06:52:49Z</updated>
<entry>
<title>csky: Fix function name in csky_alignment() and die()</title>
<updated>2023-02-06T06:52:49Z</updated>
<author>
<name>Nathan Chancellor</name>
<email>nathan@kernel.org</email>
</author>
<published>2023-02-02T04:42:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=86926761ca80772218841ce820b3f53168ae1783'/>
<id>urn:sha1:86926761ca80772218841ce820b3f53168ae1783</id>
<content type='text'>
commit 751971af2e3615dc5bd12674080bc795505fefeb upstream.

When building ARCH=csky defconfig:

arch/csky/kernel/traps.c: In function 'die':
arch/csky/kernel/traps.c:112:17: error: implicit declaration of function
'make_dead_task' [-Werror=implicit-function-declaration]
  112 |                 make_dead_task(SIGSEGV);
      |                 ^~~~~~~~~~~~~~

The function's name is make_task_dead(), change it so there is no more
build error.

Fixes: 0e25498f8cd4 ("exit: Add and use make_task_dead.")
Signed-off-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Reviewed-by: Guo Ren &lt;guoren@kernel.org&gt;
Link: https://lkml.kernel.org/r/20211227184851.2297759-4-nathan@kernel.org
Signed-off-by: Eric W. Biederman &lt;ebiederm@xmission.com&gt;
Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>exit: Add and use make_task_dead.</title>
<updated>2023-02-06T06:52:49Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2023-02-02T04:42:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=9a18c9c8336fff473a2b72707bd14a52298417b8'/>
<id>urn:sha1:9a18c9c8336fff473a2b72707bd14a52298417b8</id>
<content type='text'>
commit 0e25498f8cd43c1b5aa327f373dd094e9a006da7 upstream.

There are two big uses of do_exit.  The first is it's design use to be
the guts of the exit(2) system call.  The second use is to terminate
a task after something catastrophic has happened like a NULL pointer
in kernel code.

Add a function make_task_dead that is initialy exactly the same as
do_exit to cover the cases where do_exit is called to handle
catastrophic failure.  In time this can probably be reduced to just a
light wrapper around do_task_dead. For now keep it exactly the same so
that there will be no behavioral differences introducing this new
concept.

Replace all of the uses of do_exit that use it for catastraphic
task cleanup with make_task_dead to make it clear what the code
is doing.

As part of this rename rewind_stack_do_exit
rewind_stack_and_make_dead.

Signed-off-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf: Protect perf_guest_cbs with RCU</title>
<updated>2022-01-20T08:19:18Z</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2021-11-11T02:07:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=9b45f2007ea32b6511b98491bd224ae3dae1c5a3'/>
<id>urn:sha1:9b45f2007ea32b6511b98491bd224ae3dae1c5a3</id>
<content type='text'>
commit ff083a2d972f56bebfd82409ca62e5dfce950961 upstream.

Protect perf_guest_cbs with RCU to fix multiple possible errors.  Luckily,
all paths that read perf_guest_cbs already require RCU protection, e.g. to
protect the callback chains, so only the direct perf_guest_cbs touchpoints
need to be modified.

Bug #1 is a simple lack of WRITE_ONCE/READ_ONCE behavior to ensure
perf_guest_cbs isn't reloaded between a !NULL check and a dereference.
Fixed via the READ_ONCE() in rcu_dereference().

Bug #2 is that on weakly-ordered architectures, updates to the callbacks
themselves are not guaranteed to be visible before the pointer is made
visible to readers.  Fixed by the smp_store_release() in
rcu_assign_pointer() when the new pointer is non-NULL.

Bug #3 is that, because the callbacks are global, it's possible for
readers to run in parallel with an unregisters, and thus a module
implementing the callbacks can be unloaded while readers are in flight,
resulting in a use-after-free.  Fixed by a synchronize_rcu() call when
unregistering callbacks.

Bug #1 escaped notice because it's extremely unlikely a compiler will
reload perf_guest_cbs in this sequence.  perf_guest_cbs does get reloaded
for future derefs, e.g. for -&gt;is_user_mode(), but the -&gt;is_in_guest()
guard all but guarantees the consumer will win the race, e.g. to nullify
perf_guest_cbs, KVM has to completely exit the guest and teardown down
all VMs before KVM start its module unload / unregister sequence.  This
also makes it all but impossible to encounter bug #3.

Bug #2 has not been a problem because all architectures that register
callbacks are strongly ordered and/or have a static set of callbacks.

But with help, unloading kvm_intel can trigger bug #1 e.g. wrapping
perf_guest_cbs with READ_ONCE in perf_misc_flags() while spamming
kvm_intel module load/unload leads to:

  BUG: kernel NULL pointer dereference, address: 0000000000000000
  #PF: supervisor read access in kernel mode
  #PF: error_code(0x0000) - not-present page
  PGD 0 P4D 0
  Oops: 0000 [#1] PREEMPT SMP
  CPU: 6 PID: 1825 Comm: stress Not tainted 5.14.0-rc2+ #459
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
  RIP: 0010:perf_misc_flags+0x1c/0x70
  Call Trace:
   perf_prepare_sample+0x53/0x6b0
   perf_event_output_forward+0x67/0x160
   __perf_event_overflow+0x52/0xf0
   handle_pmi_common+0x207/0x300
   intel_pmu_handle_irq+0xcf/0x410
   perf_event_nmi_handler+0x28/0x50
   nmi_handle+0xc7/0x260
   default_do_nmi+0x6b/0x170
   exc_nmi+0x103/0x130
   asm_exc_nmi+0x76/0xbf

Fixes: 39447b386c84 ("perf: Enhance perf to allow for guest statistic collection from host")
Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20211111020738.2512932-2-seanjc@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>csky: Fixup regs.sr broken in ptrace</title>
<updated>2021-10-20T09:40:12Z</updated>
<author>
<name>Guo Ren</name>
<email>guoren@linux.alibaba.com</email>
</author>
<published>2021-09-24T07:33:38Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e9f457f056c55aaa3ef15f4ad0fbbf6ef99c0520'/>
<id>urn:sha1:e9f457f056c55aaa3ef15f4ad0fbbf6ef99c0520</id>
<content type='text'>
commit af89ebaa64de726ca0a39bbb0bf0c81a1f43ad50 upstream.

gpr_get() return the entire pt_regs (include sr) to userspace, if we
don't restore the C bit in gpr_set, it may break the ALU result in
that context. So the C flag bit is part of gpr context, that's why
riscv totally remove the C bit in the ISA. That makes sr reg clear
from userspace to supervisor privilege.

Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>csky: don't let sigreturn play with priveleged bits of status register</title>
<updated>2021-10-20T09:40:12Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2021-09-24T00:35:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a6f4ea748aa803565ed37d1f5ed8dea422fd027b'/>
<id>urn:sha1:a6f4ea748aa803565ed37d1f5ed8dea422fd027b</id>
<content type='text'>
commit fbd63c08cdcca5fb1315aca3172b3c9c272cfb4f upstream.

csky restore_sigcontext() blindly overwrites regs-&gt;sr with the value
it finds in sigcontext.  Attacker can store whatever they want in there,
which includes things like S-bit.  Userland shouldn't be able to set
that, or anything other than C flag (bit 0).

Do the same thing other architectures with protected bits in flags
register do - preserve everything that shouldn't be settable in
user mode, picking the rest from the value saved is sigcontext.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Guo Ren &lt;guoren@kernel.org&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>csky: Fixup abiv2 syscall_trace break a4 &amp; a5</title>
<updated>2020-06-17T14:40:21Z</updated>
<author>
<name>Guo Ren</name>
<email>guoren@linux.alibaba.com</email>
</author>
<published>2020-05-24T10:44:38Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=108681048cf728a8570e036c34ebd7daa43133b4'/>
<id>urn:sha1:108681048cf728a8570e036c34ebd7daa43133b4</id>
<content type='text'>
[ Upstream commit e0bbb53843b5fdfe464b099217e3b9d97e8a75d7 ]

Current implementation could destory a4 &amp; a5 when strace, so we need to get them
from pt_regs by SAVE_ALL.

Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>csky: Fixup remove duplicate irq_disable</title>
<updated>2020-06-03T06:21:14Z</updated>
<author>
<name>Liu Yibin</name>
<email>jiulong@linux.alibaba.com</email>
</author>
<published>2020-05-13T07:54:15Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=68d72327999af2c7d9955ded4c0e9033fd3f477f'/>
<id>urn:sha1:68d72327999af2c7d9955ded4c0e9033fd3f477f</id>
<content type='text'>
[ Upstream commit 6633a5aa8eb6bda70eb3a9837efd28a67ccc6e0a ]

Interrupt has been disabled in __schedule() with local_irq_disable()
and enabled in finish_task_switch-&gt;finish_lock_switch() with
local_irq_enabled(), So needn't to disable irq here.

Signed-off-by: Liu Yibin &lt;jiulong@linux.alibaba.com&gt;
Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>csky: Fixup perf callchain unwind</title>
<updated>2020-06-03T06:21:14Z</updated>
<author>
<name>Mao Han</name>
<email>han_mao@linux.alibaba.com</email>
</author>
<published>2020-04-20T04:55:23Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=99bd434f88930e8212b61827f8b591017835d94b'/>
<id>urn:sha1:99bd434f88930e8212b61827f8b591017835d94b</id>
<content type='text'>
[ Upstream commit 229a0ddee1108a3f82a873e6cbbe35c92c540444 ]

 [ 5221.974084] Unable to handle kernel paging request at virtual address 0xfffff000, pc: 0x8002c18e
 [ 5221.985929] Oops: 00000000
 [ 5221.989488]
 [ 5221.989488] CURRENT PROCESS:
 [ 5221.989488]
 [ 5221.992877] COMM=callchain_test PID=11962
 [ 5221.995213] TEXT=00008000-000087e0 DATA=00009f1c-0000a018 BSS=0000a018-0000b000
 [ 5221.999037] USER-STACK=7fc18e20  KERNEL-STACK=be204680
 [ 5221.999037]
 [ 5222.003292] PC: 0x8002c18e (perf_callchain_kernel+0x3e/0xd4)
 [ 5222.007957] LR: 0x8002c198 (perf_callchain_kernel+0x48/0xd4)
 [ 5222.074873] Call Trace:
 [ 5222.074873] [&lt;800a248e&gt;] get_perf_callchain+0x20a/0x29c
 [ 5222.074873] [&lt;8009d964&gt;] perf_callchain+0x64/0x80
 [ 5222.074873] [&lt;8009dc1c&gt;] perf_prepare_sample+0x29c/0x4b8
 [ 5222.074873] [&lt;8009de6e&gt;] perf_event_output_forward+0x36/0x98
 [ 5222.074873] [&lt;800497e0&gt;] search_exception_tables+0x20/0x44
 [ 5222.074873] [&lt;8002cbb6&gt;] do_page_fault+0x92/0x378
 [ 5222.074873] [&lt;80098608&gt;] __perf_event_overflow+0x54/0xdc
 [ 5222.074873] [&lt;80098778&gt;] perf_swevent_hrtimer+0xe8/0x164
 [ 5222.074873] [&lt;8002ddd0&gt;] update_mmu_cache+0x0/0xd8
 [ 5222.074873] [&lt;8002c014&gt;] user_backtrace+0x58/0xc4
 [ 5222.074873] [&lt;8002c0b4&gt;] perf_callchain_user+0x34/0xd0
 [ 5222.074873] [&lt;800a2442&gt;] get_perf_callchain+0x1be/0x29c
 [ 5222.074873] [&lt;8009d964&gt;] perf_callchain+0x64/0x80
 [ 5222.074873] [&lt;8009d834&gt;] perf_output_sample+0x78c/0x858
 [ 5222.074873] [&lt;8009dc1c&gt;] perf_prepare_sample+0x29c/0x4b8
 [ 5222.074873] [&lt;8009de94&gt;] perf_event_output_forward+0x5c/0x98
 [ 5222.097846]
 [ 5222.097846] [&lt;800a0300&gt;] perf_event_exit_task+0x58/0x43c
 [ 5222.097846] [&lt;8006c874&gt;] hrtimer_interrupt+0x104/0x2ec
 [ 5222.097846] [&lt;800a0300&gt;] perf_event_exit_task+0x58/0x43c
 [ 5222.097846] [&lt;80437bb6&gt;] dw_apb_clockevent_irq+0x2a/0x4c
 [ 5222.097846] [&lt;8006c770&gt;] hrtimer_interrupt+0x0/0x2ec
 [ 5222.097846] [&lt;8005f2e4&gt;] __handle_irq_event_percpu+0xac/0x19c
 [ 5222.097846] [&lt;80437bb6&gt;] dw_apb_clockevent_irq+0x2a/0x4c
 [ 5222.097846] [&lt;8005f408&gt;] handle_irq_event_percpu+0x34/0x88
 [ 5222.097846] [&lt;8005f480&gt;] handle_irq_event+0x24/0x64
 [ 5222.097846] [&lt;8006218c&gt;] handle_level_irq+0x68/0xdc
 [ 5222.097846] [&lt;8005ec76&gt;] __handle_domain_irq+0x56/0xa8
 [ 5222.097846] [&lt;80450e90&gt;] ck_irq_handler+0xac/0xe4
 [ 5222.097846] [&lt;80029012&gt;] csky_do_IRQ+0x12/0x24
 [ 5222.097846] [&lt;8002a3a0&gt;] csky_irq+0x70/0x80
 [ 5222.097846] [&lt;800ca612&gt;] alloc_set_pte+0xd2/0x238
 [ 5222.097846] [&lt;8002ddd0&gt;] update_mmu_cache+0x0/0xd8
 [ 5222.097846] [&lt;800a0340&gt;] perf_event_exit_task+0x98/0x43c

The original fp check doesn't base on the real kernal stack region.
Invalid fp address may cause kernel panic.

Signed-off-by: Mao Han &lt;han_mao@linux.alibaba.com&gt;
Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>csky: Fixup init_fpu compile warning with __init</title>
<updated>2020-04-23T08:36:41Z</updated>
<author>
<name>Guo Ren</name>
<email>guoren@linux.alibaba.com</email>
</author>
<published>2020-02-26T02:23:26Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=760eecac993b7734d37aa3f0766cea7220f0a048'/>
<id>urn:sha1:760eecac993b7734d37aa3f0766cea7220f0a048</id>
<content type='text'>
[ Upstream commit 12879bda3c2a974b7e4fe199a9c21f0c5f6bca04 ]

WARNING: vmlinux.o(.text+0x2366): Section mismatch in reference from the
function csky_start_secondary() to the function .init.text:init_fpu()

The function csky_start_secondary() references
the function __init init_fpu().
This is often because csky_start_secondary lacks a __init
annotation or the annotation of init_fpu is wrong.

Reported-by: Lu Chongzhi &lt;chongzhi.lcz@alibaba-inc.com&gt;
Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>csky: Fixup get wrong psr value from phyical reg</title>
<updated>2020-04-23T08:36:38Z</updated>
<author>
<name>Guo Ren</name>
<email>guoren@linux.alibaba.com</email>
</author>
<published>2020-03-31T15:45:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=57615a8561f0b9fef57f18c2c51cb08f679307c8'/>
<id>urn:sha1:57615a8561f0b9fef57f18c2c51cb08f679307c8</id>
<content type='text'>
[ Upstream commit 9c0e343d7654a329d1f9b53d253cbf7fb6eff85d ]

We should get psr value from regs-&gt;psr in stack, not directly get
it from phyiscal register then save the vector number in
tsk-&gt;trap_no.

Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
</feed>
