<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/riscv/kernel, branch linux-5.18.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.18.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.18.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-08-17T12:42:08Z</updated>
<entry>
<title>riscv: spinwait: Fix hartid variable type</title>
<updated>2022-08-17T12:42:08Z</updated>
<author>
<name>Sunil V L</name>
</author>
<published>2022-05-27T05:17:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d8516953ced8221c411deb8a8f0525927affcafd'/>
<id>urn:sha1:d8516953ced8221c411deb8a8f0525927affcafd</id>
<content type='text'>
[ Upstream commit c029e487e7c00e5594a4ae946952605db34e359b ]

The hartid variable is of type int but compared with
ULONG_MAX(INVALID_HARTID). This issue is fixed by changing
the hartid variable type to unsigned long.

Fixes: c78f94f35cf6 ("RISC-V: Use __cpu_up_stack/task_pointer only for spinwait method")

Signed-off-by: Sunil V L &lt;sunilvl@ventanamicro.com&gt;
Reviewed-by: Atish Patra &lt;atishp@rivosinc.com&gt;
Link: https://lore.kernel.org/r/20220527051743.2829940-3-sunilvl@ventanamicro.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>RISC-V: Fixup schedule out issue in machine_crash_shutdown()</title>
<updated>2022-08-17T12:40:10Z</updated>
<author>
<name>Xianting Tian</name>
</author>
<published>2022-08-11T07:41:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2bd2089313e1aa88835e64038d93c77973948ce2'/>
<id>urn:sha1:2bd2089313e1aa88835e64038d93c77973948ce2</id>
<content type='text'>
commit ad943893d5f1d0aeea892bf7b781cf8062b36d58 upstream.

Current task of executing crash kexec will be schedule out when panic is
triggered by RCU Stall, as it needs to wait rcu completion. It lead to
inability to enter the crash system.

The implementation of machine_crash_shutdown() is non-standard for RISC-V
according to other Arch's implementation(eg, x86, arm64), we need to send
IPI to stop secondary harts.

[224521.877268] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
[224521.883471] rcu: 	0-...0: (3 GPs behind) idle=cfa/0/0x1 softirq=3968793/3968793 fqs=2495
[224521.891742] 	(detected by 2, t=5255 jiffies, g=60855593, q=328)
[224521.897754] Task dump for CPU 0:
[224521.901074] task:swapper/0     state:R  running task   stack:  0 pid:  0 ppid:   0 flags:0x00000008
[224521.911090] Call Trace:
[224521.913638] [&lt;ffffffe000c432de&gt;] __schedule+0x208/0x5ea
[224521.918957] Kernel panic - not syncing: RCU Stall
[224521.923773] bad: scheduling from the idle thread!
[224521.928571] CPU: 2 PID: 0 Comm: swapper/2 Kdump: loaded Tainted: G   O  5.10.113-yocto-standard #1
[224521.938658] Call Trace:
[224521.941200] [&lt;ffffffe00020395c&gt;] walk_stackframe+0x0/0xaa
[224521.946689] [&lt;ffffffe000c34f8e&gt;] show_stack+0x32/0x3e
[224521.951830] [&lt;ffffffe000c39020&gt;] dump_stack_lvl+0x7e/0xa2
[224521.957317] [&lt;ffffffe000c39058&gt;] dump_stack+0x14/0x1c
[224521.962459] [&lt;ffffffe000243884&gt;] dequeue_task_idle+0x2c/0x40
[224521.968207] [&lt;ffffffe000c434f4&gt;] __schedule+0x41e/0x5ea
[224521.973520] [&lt;ffffffe000c43826&gt;] schedule+0x34/0xe4
[224521.978487] [&lt;ffffffe000c46cae&gt;] schedule_timeout+0xc6/0x170
[224521.984234] [&lt;ffffffe000c4491e&gt;] wait_for_completion+0x98/0xf2
[224521.990157] [&lt;ffffffe00026d9e2&gt;] __wait_rcu_gp+0x148/0x14a
[224521.995733] [&lt;ffffffe0002761c4&gt;] synchronize_rcu+0x5c/0x66
[224522.001307] [&lt;ffffffe00026f1a6&gt;] rcu_sync_enter+0x54/0xe6
[224522.006795] [&lt;ffffffe00025a436&gt;] percpu_down_write+0x32/0x11c
[224522.012629] [&lt;ffffffe000c4266a&gt;] _cpu_down+0x92/0x21a
[224522.017771] [&lt;ffffffe000219a0a&gt;] smp_shutdown_nonboot_cpus+0x90/0x118
[224522.024299] [&lt;ffffffe00020701e&gt;] machine_crash_shutdown+0x30/0x4a
[224522.030483] [&lt;ffffffe00029a3f8&gt;] __crash_kexec+0x62/0xa6
[224522.035884] [&lt;ffffffe000c3515e&gt;] panic+0xfa/0x2b6
[224522.040678] [&lt;ffffffe0002772be&gt;] rcu_sched_clock_irq+0xc26/0xcb8
[224522.046774] [&lt;ffffffe00027fc7a&gt;] update_process_times+0x62/0x8a
[224522.052785] [&lt;ffffffe00028d522&gt;] tick_sched_timer+0x9e/0x102
[224522.058533] [&lt;ffffffe000280c3a&gt;] __hrtimer_run_queues+0x16a/0x318
[224522.064716] [&lt;ffffffe0002812ec&gt;] hrtimer_interrupt+0xd4/0x228
[224522.070551] [&lt;ffffffe0009a69b6&gt;] riscv_timer_interrupt+0x3c/0x48
[224522.076646] [&lt;ffffffe000268f8c&gt;] handle_percpu_devid_irq+0xb0/0x24c
[224522.083004] [&lt;ffffffe00026428e&gt;] __handle_domain_irq+0xa8/0x122
[224522.089014] [&lt;ffffffe00062f954&gt;] riscv_intc_irq+0x38/0x60
[224522.094501] [&lt;ffffffe000201bd4&gt;] ret_from_exception+0x0/0xc
[224522.100161] [&lt;ffffffe000c42146&gt;] rcu_eqs_enter.constprop.0+0x8c/0xb8

With the patch, it can enter crash system when RCU Stall occur.

Fixes: e53d28180d4d ("RISC-V: Add kdump support")
Signed-off-by: Xianting Tian &lt;xianting.tian@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/20220811074150.3020189-4-xianting.tian@linux.alibaba.com
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>RISC-V: Fixup get incorrect user mode PC for kernel mode regs</title>
<updated>2022-08-17T12:40:10Z</updated>
<author>
<name>Xianting Tian</name>
</author>
<published>2022-08-11T07:41:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=221f8cb76ebce9f32fd1a0f310072c6efd0a9583'/>
<id>urn:sha1:221f8cb76ebce9f32fd1a0f310072c6efd0a9583</id>
<content type='text'>
commit 59c026c359c30f116fef6ee958e24d04983efbb0 upstream.

When use 'echo c &gt; /proc/sysrq-trigger' to trigger kdump, riscv_crash_save_regs()
will be called to save regs for vmcore, we found "epc" value 00ffffffa5537400
is not a valid kernel virtual address, but is a user virtual address. Other
regs(eg, ra, sp, gp...) are correct kernel virtual address.
Actually 0x00ffffffb0dd9400 is the user mode PC of 'PID: 113 Comm: sh', which
is saved in the task's stack.

[   21.201701] CPU: 0 PID: 113 Comm: sh Kdump: loaded Not tainted 5.18.9 #45
[   21.201979] Hardware name: riscv-virtio,qemu (DT)
[   21.202160] epc : 00ffffffa5537400 ra : ffffffff80088640 sp : ff20000010333b90
[   21.202435]  gp : ffffffff810dde38 tp : ff6000000226c200 t0 : ffffffff8032be7c
[   21.202707]  t1 : 0720072007200720 t2 : 30203a7375746174 s0 : ff20000010333cf0
[   21.202973]  s1 : 0000000000000000 a0 : ff20000010333b98 a1 : 0000000000000001
[   21.203243]  a2 : 0000000000000010 a3 : 0000000000000000 a4 : 28c8f0aeffea4e00
[   21.203519]  a5 : 28c8f0aeffea4e00 a6 : 0000000000000009 a7 : ffffffff8035c9b8
[   21.203794]  s2 : ffffffff810df0a8 s3 : ffffffff810df718 s4 : ff20000010333b98
[   21.204062]  s5 : 0000000000000000 s6 : 0000000000000007 s7 : ffffffff80c4a468
[   21.204331]  s8 : 00ffffffef451410 s9 : 0000000000000007 s10: 00aaaaaac0510700
[   21.204606]  s11: 0000000000000001 t3 : ff60000001218f00 t4 : ff60000001218f00
[   21.204876]  t5 : ff60000001218000 t6 : ff200000103338b8
[   21.205079] status: 0000000200000020 badaddr: 0000000000000000 cause: 0000000000000008

With the incorrect PC, the backtrace showed by crash tool as below, the first
stack frame is abnormal,

crash&gt; bt
PID: 113      TASK: ff60000002269600  CPU: 0    COMMAND: "sh"
 #0 [ff2000001039bb90] __efistub_.Ldebug_info0 at 00ffffffa5537400 &lt;-- Abnormal
 #1 [ff2000001039bcf0] panic at ffffffff806578ba
 #2 [ff2000001039bd50] sysrq_reset_seq_param_set at ffffffff8038c030
 #3 [ff2000001039bda0] __handle_sysrq at ffffffff8038c5f8
 #4 [ff2000001039be00] write_sysrq_trigger at ffffffff8038cad8
 #5 [ff2000001039be20] proc_reg_write at ffffffff801b7edc
 #6 [ff2000001039be40] vfs_write at ffffffff80152ba6
 #7 [ff2000001039be80] ksys_write at ffffffff80152ece
 #8 [ff2000001039bed0] sys_write at ffffffff80152f46

With the patch, we can get current kernel mode PC, the output as below,

[   17.607658] CPU: 0 PID: 113 Comm: sh Kdump: loaded Not tainted 5.18.9 #42
[   17.607937] Hardware name: riscv-virtio,qemu (DT)
[   17.608150] epc : ffffffff800078f8 ra : ffffffff8008862c sp : ff20000010333b90
[   17.608441]  gp : ffffffff810dde38 tp : ff6000000226c200 t0 : ffffffff8032be68
[   17.608741]  t1 : 0720072007200720 t2 : 666666666666663c s0 : ff20000010333cf0
[   17.609025]  s1 : 0000000000000000 a0 : ff20000010333b98 a1 : 0000000000000001
[   17.609320]  a2 : 0000000000000010 a3 : 0000000000000000 a4 : 0000000000000000
[   17.609601]  a5 : ff60000001c78000 a6 : 000000000000003c a7 : ffffffff8035c9a4
[   17.609894]  s2 : ffffffff810df0a8 s3 : ffffffff810df718 s4 : ff20000010333b98
[   17.610186]  s5 : 0000000000000000 s6 : 0000000000000007 s7 : ffffffff80c4a468
[   17.610469]  s8 : 00ffffffca281410 s9 : 0000000000000007 s10: 00aaaaaab5bb6700
[   17.610755]  s11: 0000000000000001 t3 : ff60000001218f00 t4 : ff60000001218f00
[   17.611041]  t5 : ff60000001218000 t6 : ff20000010333988
[   17.611255] status: 0000000200000020 badaddr: 0000000000000000 cause: 0000000000000008

With the correct PC, the backtrace showed by crash tool as below,

crash&gt; bt
PID: 113      TASK: ff6000000226c200  CPU: 0    COMMAND: "sh"
 #0 [ff20000010333b90] riscv_crash_save_regs at ffffffff800078f8 &lt;--- Normal
 #1 [ff20000010333cf0] panic at ffffffff806578c6
 #2 [ff20000010333d50] sysrq_reset_seq_param_set at ffffffff8038c03c
 #3 [ff20000010333da0] __handle_sysrq at ffffffff8038c604
 #4 [ff20000010333e00] write_sysrq_trigger at ffffffff8038cae4
 #5 [ff20000010333e20] proc_reg_write at ffffffff801b7ee8
 #6 [ff20000010333e40] vfs_write at ffffffff80152bb2
 #7 [ff20000010333e80] ksys_write at ffffffff80152eda
 #8 [ff20000010333ed0] sys_write at ffffffff80152f52

Fixes: e53d28180d4d ("RISC-V: Add kdump support")
Co-developed-by: Guo Ren &lt;guoren@kernel.org&gt;
Signed-off-by: Xianting Tian &lt;xianting.tian@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/20220811074150.3020189-3-xianting.tian@linux.alibaba.com
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>RISC-V: kexec: Fixup use of smp_processor_id() in preemptible context</title>
<updated>2022-08-17T12:40:10Z</updated>
<author>
<name>Xianting Tian</name>
</author>
<published>2022-08-11T07:41:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ce0dbe9fc56245d6e85bf56f86be432c777d7993'/>
<id>urn:sha1:ce0dbe9fc56245d6e85bf56f86be432c777d7993</id>
<content type='text'>
commit 357628e68f5c08ad578a718dc62a0031e06dbe91 upstream.

Use __smp_processor_id() to avoid check the preemption context when
CONFIG_DEBUG_PREEMPT enabled, as we will enter crash kernel and no
return.

Without the patch,
[  103.781044] sysrq: Trigger a crash
[  103.784625] Kernel panic - not syncing: sysrq triggered crash
[  103.837634] CPU1: off
[  103.889668] CPU2: off
[  103.933479] CPU3: off
[  103.939424] Starting crashdump kernel...
[  103.943442] BUG: using smp_processor_id() in preemptible [00000000] code: sh/346
[  103.950884] caller is debug_smp_processor_id+0x1c/0x26
[  103.956051] CPU: 0 PID: 346 Comm: sh Kdump: loaded Not tainted 5.10.113-00002-gce03f03bf4ec-dirty #149
[  103.965355] Call Trace:
[  103.967805] [&lt;ffffffe00020372a&gt;] walk_stackframe+0x0/0xa2
[  103.973206] [&lt;ffffffe000bcf1f4&gt;] show_stack+0x32/0x3e
[  103.978258] [&lt;ffffffe000bd382a&gt;] dump_stack_lvl+0x72/0x8e
[  103.983655] [&lt;ffffffe000bd385a&gt;] dump_stack+0x14/0x1c
[  103.988705] [&lt;ffffffe000bdc8fe&gt;] check_preemption_disabled+0x9e/0xaa
[  103.995057] [&lt;ffffffe000bdc926&gt;] debug_smp_processor_id+0x1c/0x26
[  104.001150] [&lt;ffffffe000206c64&gt;] machine_kexec+0x22/0xd0
[  104.006463] [&lt;ffffffe000291a7e&gt;] __crash_kexec+0x6a/0xa4
[  104.011774] [&lt;ffffffe000bcf3fa&gt;] panic+0xfc/0x2b0
[  104.016480] [&lt;ffffffe000656ca4&gt;] sysrq_reset_seq_param_set+0x0/0x70
[  104.022745] [&lt;ffffffe000657310&gt;] __handle_sysrq+0x8c/0x154
[  104.028229] [&lt;ffffffe0006577e8&gt;] write_sysrq_trigger+0x5a/0x6a
[  104.034061] [&lt;ffffffe0003d90e0&gt;] proc_reg_write+0x58/0xd4
[  104.039459] [&lt;ffffffe00036cff4&gt;] vfs_write+0x7e/0x254
[  104.044509] [&lt;ffffffe00036d2f6&gt;] ksys_write+0x58/0xbe
[  104.049558] [&lt;ffffffe00036d36a&gt;] sys_write+0xe/0x16
[  104.054434] [&lt;ffffffe000201b9a&gt;] ret_from_syscall+0x0/0x2
[  104.067863] Will call new kernel at ecc00000 from hart id 0
[  104.074939] FDT image at fc5ee000
[  104.079523] Bye...

With the patch we can got clear output,
[   67.740553] sysrq: Trigger a crash
[   67.744166] Kernel panic - not syncing: sysrq triggered crash
[   67.809123] CPU1: off
[   67.865210] CPU2: off
[   67.909075] CPU3: off
[   67.919123] Starting crashdump kernel...
[   67.924900] Will call new kernel at ecc00000 from hart id 0
[   67.932045] FDT image at fc5ee000
[   67.935560] Bye...

Fixes: 0e105f1d0037 ("riscv: use hart id instead of cpu id on machine_kexec")
Reviewed-by: Guo Ren &lt;guoren@kernel.org&gt;
Reviewed-by: Heiko Stuebner &lt;heiko@sntech.de&gt;
Reviewed-by: Atish Patra &lt;atishp@rivosinc.com&gt;
Signed-off-by: Xianting Tian &lt;xianting.tian@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/20220811074150.3020189-2-xianting.tian@linux.alibaba.com
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>RISC-V: Declare cpu_ops_spinwait in &lt;asm/cpu_ops.h&gt;</title>
<updated>2022-08-17T12:40:10Z</updated>
<author>
<name>Ben Dooks</name>
</author>
<published>2022-07-14T07:18:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5b03e52f74475ccb17380df79abff60ff1e612dd'/>
<id>urn:sha1:5b03e52f74475ccb17380df79abff60ff1e612dd</id>
<content type='text'>
commit da6d2128e56a50a0d497c8e41ca1d33d88bcc0aa upstream.

The cpu_ops_spinwait is used in a couple of places in arch/riscv
and is causing a sparse warning due to no declaration. Add this
to &lt;asm/cpu_ops.h&gt; with the others to fix the following:

arch/riscv/kernel/cpu_ops_spinwait.c:16:29: warning: symbol 'cpu_ops_spinwait' was not declared. Should it be static?

Signed-off-by: Ben Dooks &lt;ben.dooks@sifive.com&gt;
Link: https://lore.kernel.org/r/20220714071811.187491-1-ben.dooks@sifive.com
[Palmer: Drop the extern from cpu_ops.c]
Fixes: 2ffc48fc7071 ("RISC-V: Move spinwait booting method to its own config")
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>RISC-V: cpu_ops_spinwait.c should include head.h</title>
<updated>2022-08-17T12:40:10Z</updated>
<author>
<name>Ben Dooks</name>
</author>
<published>2022-07-13T21:53:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=027a537d1434f5932e49363684c41d138fa8a585'/>
<id>urn:sha1:027a537d1434f5932e49363684c41d138fa8a585</id>
<content type='text'>
commit e4aa991c05aedc3ead92d1352af86db74090dc3c upstream.

Running sparse shows cpu_ops_spinwait.c is missing two definitions
found in head.h, so include it to stop the following warnings:

arch/riscv/kernel/cpu_ops_spinwait.c:15:6: warning: symbol '__cpu_spinwait_stack_pointer' was not declared. Should it be static?
arch/riscv/kernel/cpu_ops_spinwait.c:16:6: warning: symbol '__cpu_spinwait_task_pointer' was not declared. Should it be static?

Signed-off-by: Ben Dooks &lt;ben.dooks@sifive.com&gt;
Link: https://lore.kernel.org/r/20220713215306.94675-1-ben.dooks@sifive.com
Fixes: c78f94f35cf6 ("RISC-V: Use __cpu_up_stack/task_pointer only for spinwait method")
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>riscv:uprobe fix SR_SPIE set/clear handling</title>
<updated>2022-08-17T12:40:09Z</updated>
<author>
<name>Yipeng Zou</name>
</author>
<published>2022-07-21T06:58:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3811d51778900064d27d8c9a98f73410fb3b471d'/>
<id>urn:sha1:3811d51778900064d27d8c9a98f73410fb3b471d</id>
<content type='text'>
commit 3dbe5829408bc1586f75b4667ef60e5aab0209c7 upstream.

In riscv the process of uprobe going to clear spie before exec
the origin insn,and set spie after that.But When access the page
which origin insn has been placed a page fault may happen and
irq was disabled in arch_uprobe_pre_xol function,It cause a WARN
as follows.
There is no need to clear/set spie in arch_uprobe_pre/post/abort_xol.
We can just remove it.

[   31.684157] BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1488
[   31.684677] in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 76, name: work
[   31.684929] preempt_count: 0, expected: 0
[   31.685969] CPU: 2 PID: 76 Comm: work Tainted: G
[   31.686542] Hardware name: riscv-virtio,qemu (DT)
[   31.686797] Call Trace:
[   31.687053] [&lt;ffffffff80006442&gt;] dump_backtrace+0x30/0x38
[   31.687699] [&lt;ffffffff80812118&gt;] show_stack+0x40/0x4c
[   31.688141] [&lt;ffffffff8081817a&gt;] dump_stack_lvl+0x44/0x5c
[   31.688396] [&lt;ffffffff808181aa&gt;] dump_stack+0x18/0x20
[   31.688653] [&lt;ffffffff8003e454&gt;] __might_resched+0x114/0x122
[   31.688948] [&lt;ffffffff8003e4b2&gt;] __might_sleep+0x50/0x7a
[   31.689435] [&lt;ffffffff80822676&gt;] down_read+0x30/0x130
[   31.689728] [&lt;ffffffff8000b650&gt;] do_page_fault+0x166/x446
[   31.689997] [&lt;ffffffff80003c0c&gt;] ret_from_exception+0x0/0xc

Fixes: 74784081aac8 ("riscv: Add uprobes supported")
Signed-off-by: Yipeng Zou &lt;zouyipeng@huawei.com&gt;
Reviewed-by: Guo Ren &lt;guoren@kernel.org&gt;
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20220721065820.245755-1-zouyipeng@huawei.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>vmcore: convert copy_oldmem_page() to take an iov_iter</title>
<updated>2022-06-29T07:04:36Z</updated>
<author>
<name>Matthew Wilcox (Oracle)</name>
</author>
<published>2022-04-29T21:37:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3161f3000c4d6d763faf1b34a1818a3b3218b690'/>
<id>urn:sha1:3161f3000c4d6d763faf1b34a1818a3b3218b690</id>
<content type='text'>
[ Upstream commit 5d8de293c224896a4da99763fce4f9794308caf4 ]

Patch series "Convert vmcore to use an iov_iter", v5.

For some reason several people have been sending bad patches to fix
compiler warnings in vmcore recently.  Here's how it should be done.
Compile-tested only on x86.  As noted in the first patch, s390 should take
this conversion a bit further, but I'm not inclined to do that work
myself.

This patch (of 3):

Instead of passing in a 'buf' and 'userbuf' argument, pass in an iov_iter.
s390 needs more work to pass the iov_iter down further, or refactor, but
I'd be more comfortable if someone who can test on s390 did that work.

It's more convenient to convert the whole of read_from_oldmem() to take an
iov_iter at the same time, so rename it to read_from_oldmem_iter() and add
a temporary read_from_oldmem() wrapper that creates an iov_iter.

Link: https://lkml.kernel.org/r/20220408090636.560886-1-bhe@redhat.com
Link: https://lkml.kernel.org/r/20220408090636.560886-2-bhe@redhat.com
Signed-off-by: Matthew Wilcox (Oracle) &lt;willy@infradead.org&gt;
Signed-off-by: Baoquan He &lt;bhe@redhat.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Heiko Carstens &lt;hca@linux.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>RISC-V: use memcpy for kexec_file mode</title>
<updated>2022-06-14T16:45:03Z</updated>
<author>
<name>Liao Chang</name>
</author>
<published>2022-04-08T10:09:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3ba83e46b591381e718007f55c9f831fd0cd7ee8'/>
<id>urn:sha1:3ba83e46b591381e718007f55c9f831fd0cd7ee8</id>
<content type='text'>
[ Upstream commit b7fb4d78a6ade6026d9e5cf438c2a46ab962e032 ]

The pointer to buffer loading kernel binaries is in kernel space for
kexec_fil mode, When copy_from_user copies data from pointer to a block
of memory, it checkes that the pointer is in the user space range, on
RISCV-V that is:

static inline bool __access_ok(unsigned long addr, unsigned long size)
{
	return size &lt;= TASK_SIZE &amp;&amp; addr &lt;= TASK_SIZE - size;
}

and TASK_SIZE is 0x4000000000 for 64-bits, which now causes
copy_from_user to reject the access of the field 'buf' of struct
kexec_segment that is in range [CONFIG_PAGE_OFFSET - VMALLOC_SIZE,
CONFIG_PAGE_OFFSET), is invalid user space pointer.

This patch fixes this issue by skipping access_ok(), use mempcy() instead.

Signed-off-by: Liao Chang &lt;liaochang1@huawei.com&gt;
Link: https://lore.kernel.org/r/20220408100914.150110-3-lizhengyu3@huawei.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>riscv: read-only pages should not be writable</title>
<updated>2022-06-14T16:44:56Z</updated>
<author>
<name>Heinrich Schuchardt</name>
</author>
<published>2022-05-28T01:41:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d610e2c4ffc1de63c3b14d021d2710ada2784a7a'/>
<id>urn:sha1:d610e2c4ffc1de63c3b14d021d2710ada2784a7a</id>
<content type='text'>
[ Upstream commit 630f972d76d6460235e84e1aa034ee06f9c8c3a9 ]

If EFI pages are marked as read-only,
we should remove the _PAGE_WRITE flag.

The current code overwrites an unused value.

Fixes: b91540d52a08b ("RISC-V: Add EFI runtime services")
Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
Link: https://lore.kernel.org/r/20220528014132.91052-1-heinrich.schuchardt@canonical.com
Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
</feed>
