<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/riscv/kernel, branch linux-5.5.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.5.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.5.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-03-25T07:26:58Z</updated>
<entry>
<title>riscv: fix seccomp reject syscall code path</title>
<updated>2020-03-25T07:26:58Z</updated>
<author>
<name>Tycho Andersen</name>
</author>
<published>2020-02-08T15:18:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2b320bc2d596f3bd816d160860241c89041e171e'/>
<id>urn:sha1:2b320bc2d596f3bd816d160860241c89041e171e</id>
<content type='text'>
[ Upstream commit af33d2433b03d63ed31fcfda842f46676a5e1afc ]

If secure_computing() rejected a system call, we were previously setting
the system call number to -1, to indicate to later code that the syscall
failed. However, if something (e.g. a user notification) was sleeping, and
received a signal, we may set a0 to -ERESTARTSYS and re-try the system call
again.

In this case, seccomp "denies" the syscall (because of the signal), and we
would set a7 to -1, thus losing the value of the system call we want to
restart.

Instead, let's return -1 from do_syscall_trace_enter() to indicate that the
syscall was rejected, so we don't clobber the value in case of -ERESTARTSYS
or whatever.

This commit fixes the user_notification_signal seccomp selftest on riscv to
no longer hang. That test expects the system call to be re-issued after the
signal, and it wasn't due to the above bug. Now that it is, everything
works normally.

Note that in the ptrace (tracer) case, the tracer can set the register
values to whatever they want, so we still need to keep the code that
handles out-of-bounds syscalls. However, we can drop the comment.

We can also drop syscall_set_nr(), since it is no longer used anywhere, and
the code that re-loads the value in a7 because of it.

Reported in: https://lore.kernel.org/bpf/CAEn-LTp=ss0Dfv6J00=rCAy+N78U2AmhqJNjfqjr2FDpPYjxEQ@mail.gmail.com/

Reported-by: David Abdurachmanov &lt;david.abdurachmanov@gmail.com&gt;
Signed-off-by: Tycho Andersen &lt;tycho@tycho.ws&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>riscv: avoid the PIC offset of static percpu data in module beyond 2G limits</title>
<updated>2020-03-25T07:26:57Z</updated>
<author>
<name>Vincent Chen</name>
</author>
<published>2020-02-21T02:47:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a1a4ceb91d90f663fdc2e4a405fe8b577ad872e7'/>
<id>urn:sha1:a1a4ceb91d90f663fdc2e4a405fe8b577ad872e7</id>
<content type='text'>
[ Upstream commit 0cff8bff7af886af0923d5c91776cd51603e531f ]

The compiler uses the PIC-relative method to access static variables
instead of GOT when the code model is PIC. Therefore, the limitation of
the access range from the instruction to the symbol address is +-2GB.
Under this circumstance, the kernel cannot load a kernel module if this
module has static per-CPU symbols declared by DEFINE_PER_CPU(). The reason
is that kernel relocates the .data..percpu section of the kernel module to
the end of kernel's .data..percpu. Hence, the distance between the per-CPU
symbols and the instruction will exceed the 2GB limits. To solve this
problem, the kernel should place the loaded module in the memory area
[&amp;_end-2G, VMALLOC_END].

Signed-off-by: Vincent Chen &lt;vincent.chen@sifive.com&gt;
Suggested-by: Alexandre Ghiti &lt;alex@ghiti.fr&gt;
Suggested-by: Anup Patel &lt;anup@brainfault.org&gt;
Tested-by: Alexandre Ghiti &lt;alex@ghiti.fr&gt;
Tested-by: Carlos de Paula &lt;me@carlosedp.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>riscv: set pmp configuration if kernel is running in M-mode</title>
<updated>2020-03-21T07:15:41Z</updated>
<author>
<name>Greentime Hu</name>
</author>
<published>2020-01-09T03:17:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=518c7d6fc19293181cbb23579728d1c1ab1022ad'/>
<id>urn:sha1:518c7d6fc19293181cbb23579728d1c1ab1022ad</id>
<content type='text'>
[ Upstream commit c68a9032299e837b56d356de9250c93094f7e0e3 ]

When the kernel is running in S-mode, the expectation is that the
bootloader or SBI layer will configure the PMP to allow the kernel to
access physical memory.  But, when the kernel is running in M-mode and is
started with the ELF "loader", there's probably no bootloader or SBI layer
involved to configure the PMP.  Thus, we need to configure the PMP
ourselves to enable the kernel to access all regions.

Signed-off-by: Greentime Hu &lt;greentime.hu@sifive.com&gt;
Reviewed-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>RISC-V: Don't enable all interrupts in trap_init()</title>
<updated>2020-03-05T15:45:18Z</updated>
<author>
<name>Anup Patel</name>
</author>
<published>2020-02-02T11:02:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b41d6924d34d6003e9e2f040f6f80c3ee0e1b155'/>
<id>urn:sha1:b41d6924d34d6003e9e2f040f6f80c3ee0e1b155</id>
<content type='text'>
commit 6a1ce99dc4bde564e4a072936f9d41f4a439140e upstream.

Historically, we have been enabling all interrupts for each
HART in trap_init(). Ideally, we should only enable M-mode
interrupts for M-mode kernel and S-mode interrupts for S-mode
kernel in trap_init().

Currently, we get suprious S-mode interrupts on Kendryte K210
board running M-mode NO-MMU kernel because we are enabling all
interrupts in trap_init(). To fix this, we only enable software
and external interrupt in trap_init(). In future, trap_init()
will only enable software interrupt and PLIC driver will enable
external interrupt using CPU notifiers.

Fixes: a4c3733d32a7 ("riscv: abstract out CSR names for supervisor vs machine mode")
Signed-off-by: Anup Patel &lt;anup.patel@wdc.com&gt;
Reviewed-by: Atish Patra &lt;atish.patra@wdc.com&gt;
Tested-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt; [QMEU virt machine with SMP]
[Palmer: Move the Fixes up to a newer commit]
Reviewed-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>riscv: delete temporary files</title>
<updated>2020-01-18T21:22:13Z</updated>
<author>
<name>Ilie Halip</name>
</author>
<published>2020-01-15T11:32:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=95f4d9cced96afa9c69b3da8e79e96102c84fc60'/>
<id>urn:sha1:95f4d9cced96afa9c69b3da8e79e96102c84fc60</id>
<content type='text'>
Temporary files used in the VDSO build process linger on even after make
mrproper: vdso-dummy.o.tmp, vdso.so.dbg.tmp.

Delete them once they're no longer needed.

Signed-off-by: Ilie Halip &lt;ilie.halip@gmail.com&gt;
Signed-off-by: Paul Walmsley &lt;paul.walmsley@sifive.com&gt;</content>
</entry>
<entry>
<title>riscv: make sure the cores stay looping in .Lsecondary_park</title>
<updated>2020-01-16T02:07:54Z</updated>
<author>
<name>Greentime Hu</name>
</author>
<published>2020-01-15T06:54:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=20d2292754e72e445abe62b7ac453eb945fc626c'/>
<id>urn:sha1:20d2292754e72e445abe62b7ac453eb945fc626c</id>
<content type='text'>
The code in secondary_park is currently placed in the .init section. The
kernel reclaims and clears this code when it finishes booting. That
causes the cores parked in it to go to somewhere unpredictable, so we
move this function out of init to make sure the cores stay looping there.

The instruction bgeu a0, t0, .Lsecondary_park may have "a relocation
truncated to fit" issue during linking time. It is because that sections
are too far to jump. Let's use tail to jump to the .Lsecondary_park.

Signed-off-by: Greentime Hu &lt;greentime.hu@sifive.com&gt;
Reviewed-by: Anup Patel &lt;anup.patel@sifive.com&gt;
Cc: Andreas Schwab &lt;schwab@suse.de&gt;
Cc: stable@vger.kernel.org
Fixes: 76d2a0493a17d ("RISC-V: Init and Halt Code")
Signed-off-by: Paul Walmsley &lt;paul.walmsley@sifive.com&gt;</content>
</entry>
<entry>
<title>Merge tag 'riscv/for-v5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux</title>
<updated>2020-01-13T00:48:39Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2020-01-13T00:48:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=373adb7313b233d64e21f3f6329fb41a5e6ae180'/>
<id>urn:sha1:373adb7313b233d64e21f3f6329fb41a5e6ae180</id>
<content type='text'>
Pull RISC-V fixes from Paul Walmsley:
 "Two fixes for RISC-V:

   - Clear FP registers during boot when FP support is present, rather
     than when they aren't present

   - Move the header files associated with the SiFive L2 cache
     controller to drivers/soc (where the code was recently moved)"

* tag 'riscv/for-v5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
  riscv: Fixup obvious bug for fp-regs reset
  riscv: move sifive_l2_cache.h to include/soc
</content>
</entry>
<entry>
<title>riscv: Fixup obvious bug for fp-regs reset</title>
<updated>2020-01-12T18:12:44Z</updated>
<author>
<name>Guo Ren</name>
</author>
<published>2020-01-05T02:52:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=dc6fcba72f0435b7884f2e92fd634bb9f78a2c60'/>
<id>urn:sha1:dc6fcba72f0435b7884f2e92fd634bb9f78a2c60</id>
<content type='text'>
CSR_MISA is defined in Privileged Architectures' spec: 3.1.1 Machine
ISA Register misa. Every bit:1 indicate a feature, so we should beqz
reset_done when there is no F/D bit in csr_misa register.

Signed-off-by: Guo Ren &lt;ren_guo@c-sky.com&gt;
[paul.walmsley@sifive.com: fix typo in commit message]
Fixes: 9e80635619b51 ("riscv: clear the instruction cache and all registers when booting")
Signed-off-by: Paul Walmsley &lt;paul.walmsley@sifive.com&gt;</content>
</entry>
<entry>
<title>riscv: Implement copy_thread_tls</title>
<updated>2020-01-07T12:31:23Z</updated>
<author>
<name>Amanieu d'Antras</name>
</author>
<published>2020-01-02T17:24:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=20bda4ed62f507ed72e30e817b43c65fdba60be7'/>
<id>urn:sha1:20bda4ed62f507ed72e30e817b43c65fdba60be7</id>
<content type='text'>
This is required for clone3 which passes the TLS value through a
struct rather than a register.

Signed-off-by: Amanieu d'Antras &lt;amanieu@gmail.com&gt;
Cc: linux-riscv@lists.infradead.org
Cc: &lt;stable@vger.kernel.org&gt; # 5.3.x
Link: https://lore.kernel.org/r/20200102172413.654385-6-amanieu@gmail.com
Signed-off-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
</content>
</entry>
<entry>
<title>riscv: prefix IRQ_ macro names with an RV_ namespace</title>
<updated>2020-01-05T05:48:59Z</updated>
<author>
<name>Paul Walmsley</name>
</author>
<published>2019-12-20T11:09:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2f3035da4019780250658d1ffe486bc324e04805'/>
<id>urn:sha1:2f3035da4019780250658d1ffe486bc324e04805</id>
<content type='text'>
"IRQ_TIMER", used in the arch/riscv CSR header file, is a sufficiently
generic macro name that it's used by several source files across the
Linux code base.  Some of these other files ultimately include the
arch/riscv CSR include file, causing collisions.  Fix by prefixing the
RISC-V csr.h IRQ_ macro names with an RV_ prefix.

Fixes: a4c3733d32a72 ("riscv: abstract out CSR names for supervisor vs machine mode")
Reported-by: Olof Johansson &lt;olof@lixom.net&gt;
Acked-by: Olof Johansson &lt;olof@lixom.net&gt;
Signed-off-by: Paul Walmsley &lt;paul.walmsley@sifive.com&gt;</content>
</entry>
</feed>
