Skip to content

Commit 867b998

Browse files
committed
Merge tag 'riscv-for-linus-5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull RISC-V Fixes for 5.16-rc4 - .rodata is no longer linkd into PT_DYNAMIC. It was not supposed to be there in the first place and resulted in invalid (but unused) entries. This manifests as at least warnings in llvm-readelf - A fix for runtime constants with all-0 upper 32-bits. This should only manifest on MMU=n kernels - A fix for context save/restore on systems using the T-Head vector extensions - A fix for a conflicting "+r"/"r" register constraint in the VDSO getrandom syscall wrapper, which is undefined behavior in clang - A fix for a missing register clobber in the RVV raid6 implementation. This manifests as a NULL pointer reference on some compilers, but could trigger in other ways - Misaligned accesses from userspace at faulting addresses are now handled correctly - A fix for an incorrect optimization that allowed access_ok() to mark invalid addresses as accessible, which can result in userspace triggering BUG()s - A few fixes for build warnings, and an update to Drew's email address * tag 'riscv-for-linus-5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: riscv: export boot_cpu_hartid Revert "riscv: Define TASK_SIZE_MAX for __access_ok()" riscv: Fix sparse warning in vendor_extensions/sifive.c Revert "riscv: misaligned: fix sleeping function called during misaligned access handling" MAINTAINERS: Update Drew Fustini's email address RISC-V: uaccess: Wrap the get_user_8 uaccess macro raid6: riscv: Fix NULL pointer dereference caused by a missing clobber RISC-V: vDSO: Correct inline assembly constraints in the getrandom syscall wrapper riscv: vector: Fix context save/restore with xtheadvector riscv: fix runtime constant support for nommu kernels riscv: vdso: Exclude .rodata from the PT_DYNAMIC segment
2 parents fa33adc + c5136ad commit 867b998

File tree

12 files changed

+45
-35
lines changed

12 files changed

+45
-35
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ Dmitry Safonov <[email protected]> <[email protected]>
223223
224224
Domen Puncer <[email protected]>
225225
Douglas Gilbert <[email protected]>
226+
226227
Ed L. Cashin <[email protected]>
227228
228229
Enric Balletbo i Serra <[email protected]> <[email protected]>

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21388,7 +21388,7 @@ N: spacemit
2138821388
K: spacemit
2138921389

2139021390
RISC-V THEAD SoC SUPPORT
21391-
M: Drew Fustini <[email protected]>
21391+
M: Drew Fustini <[email protected]>
2139221392
M: Guo Ren <[email protected]>
2139321393
M: Fu Wei <[email protected]>
2139421394

arch/riscv/include/asm/pgtable.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,6 @@ static inline pte_t pte_swp_clear_exclusive(pte_t pte)
10751075
*/
10761076
#ifdef CONFIG_64BIT
10771077
#define TASK_SIZE_64 (PGDIR_SIZE * PTRS_PER_PGD / 2)
1078-
#define TASK_SIZE_MAX LONG_MAX
10791078

10801079
#ifdef CONFIG_COMPAT
10811080
#define TASK_SIZE_32 (_AC(0x80000000, UL) - PAGE_SIZE)

arch/riscv/include/asm/runtime-const.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static inline void __runtime_fixup_32(__le16 *lui_parcel, __le16 *addi_parcel, u
206206
addi_insn_mask &= 0x07fff;
207207
}
208208

209-
if (lower_immediate & 0x00000fff) {
209+
if (lower_immediate & 0x00000fff || lui_insn == RISCV_INSN_NOP4) {
210210
/* replace upper 12 bits of addi with lower 12 bits of val */
211211
addi_insn &= addi_insn_mask;
212212
addi_insn |= (lower_immediate & 0x00000fff) << 20;

arch/riscv/include/asm/uaccess.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ do { \
127127

128128
#ifdef CONFIG_CC_HAS_ASM_GOTO_OUTPUT
129129
#define __get_user_8(x, ptr, label) \
130+
do { \
130131
u32 __user *__ptr = (u32 __user *)(ptr); \
131132
u32 __lo, __hi; \
132133
asm_goto_output( \
@@ -141,7 +142,7 @@ do { \
141142
: : label); \
142143
(x) = (__typeof__(x))((__typeof__((x) - (x)))( \
143144
(((u64)__hi << 32) | __lo))); \
144-
145+
} while (0)
145146
#else /* !CONFIG_CC_HAS_ASM_GOTO_OUTPUT */
146147
#define __get_user_8(x, ptr, label) \
147148
do { \

arch/riscv/include/asm/vdso/getrandom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static __always_inline ssize_t getrandom_syscall(void *_buffer, size_t _len, uns
1818
register unsigned int flags asm("a2") = _flags;
1919

2020
asm volatile ("ecall\n"
21-
: "+r" (ret)
21+
: "=r" (ret)
2222
: "r" (nr), "r" (buffer), "r" (len), "r" (flags)
2323
: "memory");
2424

arch/riscv/include/asm/vector.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ static inline void __riscv_v_vstate_save(struct __riscv_v_ext_state *save_to,
205205
THEAD_VSETVLI_T4X0E8M8D1
206206
THEAD_VSB_V_V0T0
207207
"add t0, t0, t4\n\t"
208-
THEAD_VSB_V_V0T0
208+
THEAD_VSB_V_V8T0
209209
"add t0, t0, t4\n\t"
210-
THEAD_VSB_V_V0T0
210+
THEAD_VSB_V_V16T0
211211
"add t0, t0, t4\n\t"
212-
THEAD_VSB_V_V0T0
212+
THEAD_VSB_V_V24T0
213213
: : "r" (datap) : "memory", "t0", "t4");
214214
} else {
215215
asm volatile (
@@ -241,11 +241,11 @@ static inline void __riscv_v_vstate_restore(struct __riscv_v_ext_state *restore_
241241
THEAD_VSETVLI_T4X0E8M8D1
242242
THEAD_VLB_V_V0T0
243243
"add t0, t0, t4\n\t"
244-
THEAD_VLB_V_V0T0
244+
THEAD_VLB_V_V8T0
245245
"add t0, t0, t4\n\t"
246-
THEAD_VLB_V_V0T0
246+
THEAD_VLB_V_V16T0
247247
"add t0, t0, t4\n\t"
248-
THEAD_VLB_V_V0T0
248+
THEAD_VLB_V_V24T0
249249
: : "r" (datap) : "memory", "t0", "t4");
250250
} else {
251251
asm volatile (

arch/riscv/kernel/setup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ atomic_t hart_lottery __section(".sdata")
5050
#endif
5151
;
5252
unsigned long boot_cpu_hartid;
53+
EXPORT_SYMBOL_GPL(boot_cpu_hartid);
5354

5455
/*
5556
* Place kernel memory regions on the resource tree so that

arch/riscv/kernel/traps_misaligned.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ static int handle_scalar_misaligned_load(struct pt_regs *regs)
454454

455455
val.data_u64 = 0;
456456
if (user_mode(regs)) {
457-
if (copy_from_user_nofault(&val, (u8 __user *)addr, len))
457+
if (copy_from_user(&val, (u8 __user *)addr, len))
458458
return -1;
459459
} else {
460460
memcpy(&val, (u8 *)addr, len);
@@ -555,7 +555,7 @@ static int handle_scalar_misaligned_store(struct pt_regs *regs)
555555
return -EOPNOTSUPP;
556556

557557
if (user_mode(regs)) {
558-
if (copy_to_user_nofault((u8 __user *)addr, &val, len))
558+
if (copy_to_user((u8 __user *)addr, &val, len))
559559
return -1;
560560
} else {
561561
memcpy((u8 *)addr, &val, len);

arch/riscv/kernel/vdso/vdso.lds.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ SECTIONS
3030
*(.data .data.* .gnu.linkonce.d.*)
3131
*(.dynbss)
3232
*(.bss .bss.* .gnu.linkonce.b.*)
33-
}
33+
} :text
3434

3535
.note : { *(.note.*) } :text :note
3636

0 commit comments

Comments
 (0)