mirror of
https://github.com/torvalds/linux.git
synced 2026-05-22 06:01:53 +02:00
1, Adjust build infrastructure for 32BIT/64BIT;
2, Add HIGHMEM (PKMAP and FIX_KMAP) support;
3, Show and handle CPU vulnerabilites correctly;
4, Batch the icache maintenance for jump_label;
5, Add more atomic instructions support for BPF JIT;
6, Add more features (e.g. fsession) support for BPF trampoline;
7, Some bug fixes and other small changes.
-----BEGIN PGP SIGNATURE-----
iQJKBAABCAA0FiEEzOlt8mkP+tbeiYy5AoYrw/LiJnoFAmnpwWgWHGNoZW5odWFj
YWlAa2VybmVsLm9yZwAKCRAChivD8uImeiAXD/0RSRhj2y8LYGhVSPStMgN4uwMl
1ylbkRg0biTvV0g8sD1R3MQ58/tKBZY5wTeLjwT50rl+JgOqVdrN6OMAxjwOKzJ6
7C0rgpxBG5/YHI93paFVIYszsiWhRQaB5qfZCUOr230ZDJzvnfF1aH6JLybeHoMp
HvERNURQsRbZo9yc69YxhrmHETEbum37u9hsrY5mJSEs5Fh+QxvTSYjE36z3Dtal
YFqopTCaBgAhVw6BldVAcyvGvVK+d6iQEA035jObNLKKReNkwsQixxgnJhDSkbbG
Z3md+hWp+YQQElGIP5q6+rj1rJZGrs/XL3HAnTQfXN+8bXIUO9AOf2/l5f9fZx7o
2Vtt8n2/vVdzsVnKiHXGtsZ5uXrw4/kLiMZSCrUMZCtEOxJV9mmrVskPeie0iq0/
nDG9uCgRldL8Xpg7d5NM9coECui3J+ztNkv06tL/JLm02bJPuqNwt3FeA1T/aH1c
l2Hpw3Xuzl7lYuAYoa5CMm4X6yD/RA6w44pW1NKnb6j6llIOk6V6NwcwggWUnqht
oB5VIqPKMOYjZ+fLurI2o9VWqWokJxDdzyrHhXyaG0JRK9Vak06C8UI5BQuosu88
9WBoxK77PyNa60m56C32OZ5tu4UoPT8PgZWXDQDwn82SWzuYKWRruS2ng5A/JF7r
H2Ez4iBjs2/P7vTQHA==
=FiFl
-----END PGP SIGNATURE-----
Merge tag 'loongarch-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
Pull LoongArch updates from Huacai Chen:
- Adjust build infrastructure for 32BIT/64BIT
- Add HIGHMEM (PKMAP and FIX_KMAP) support
- Show and handle CPU vulnerabilites correctly
- Batch the icache maintenance for jump_label
- Add more atomic instructions support for BPF JIT
- Add more features (e.g. fsession) support for BPF trampoline
- Some bug fixes and other small changes
* tag 'loongarch-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: (21 commits)
selftests/bpf: Enable CAN_USE_LOAD_ACQ_STORE_REL for LoongArch
LoongArch: BPF: Add fsession support for trampolines
LoongArch: BPF: Introduce emit_store_stack_imm64() helper
LoongArch: BPF: Support up to 12 function arguments for trampoline
LoongArch: BPF: Support small struct arguments for trampoline
LoongArch: BPF: Open code and remove invoke_bpf_mod_ret()
LoongArch: BPF: Support load-acquire and store-release instructions
LoongArch: BPF: Support 8 and 16 bit read-modify-write instructions
LoongArch: BPF: Add the default case in emit_atomic() and rename it
LoongArch: Define instruction formats for AM{SWAP/ADD}.{B/H} and DBAR
LoongArch: Batch the icache maintenance for jump_label
LoongArch: Add flush_icache_all()/local_flush_icache_all()
LoongArch: Add spectre boundry for syscall dispatch table
LoongArch: Show CPU vulnerabilites correctly
LoongArch: Make arch_irq_work_has_interrupt() true only if IPI HW exist
LoongArch: Use get_random_canary() for stack canary init
LoongArch: Improve the logging of disabling KASLR
LoongArch: Align FPU register state to 32 bytes
LoongArch: Handle CONFIG_32BIT in syscall_get_arch()
LoongArch: Add HIGHMEM (PKMAP and FIX_KMAP) support
...
85 lines
2.2 KiB
C
85 lines
2.2 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Author: Hanlu Li <lihanlu@loongson.cn>
|
|
* Huacai Chen <chenhuacai@loongson.cn>
|
|
*
|
|
* Copyright (C) 2020-2022 Loongson Technology Corporation Limited
|
|
*/
|
|
#include <linux/capability.h>
|
|
#include <linux/entry-common.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/linkage.h>
|
|
#include <linux/nospec.h>
|
|
#include <linux/objtool.h>
|
|
#include <linux/randomize_kstack.h>
|
|
#include <linux/syscalls.h>
|
|
#include <linux/unistd.h>
|
|
|
|
#include <asm/asm.h>
|
|
#include <asm/exception.h>
|
|
#include <asm/loongarch.h>
|
|
#include <asm/signal.h>
|
|
#include <asm/switch_to.h>
|
|
#include <asm-generic/syscalls.h>
|
|
|
|
#undef __SYSCALL
|
|
#define __SYSCALL(nr, call) [nr] = (call),
|
|
#define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native)
|
|
|
|
SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, unsigned long,
|
|
prot, unsigned long, flags, unsigned long, fd, unsigned long, offset)
|
|
{
|
|
if (offset & ~PAGE_MASK)
|
|
return -EINVAL;
|
|
|
|
return ksys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
|
|
}
|
|
|
|
SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, unsigned long,
|
|
prot, unsigned long, flags, unsigned long, fd, unsigned long, offset)
|
|
{
|
|
if (offset & (~PAGE_MASK >> 12))
|
|
return -EINVAL;
|
|
|
|
return ksys_mmap_pgoff(addr, len, prot, flags, fd, offset >> (PAGE_SHIFT - 12));
|
|
}
|
|
|
|
void *sys_call_table[__NR_syscalls] = {
|
|
[0 ... __NR_syscalls - 1] = sys_ni_syscall,
|
|
#ifdef CONFIG_32BIT
|
|
#include <asm/syscall_table_32.h>
|
|
#else
|
|
#include <asm/syscall_table_64.h>
|
|
#endif
|
|
};
|
|
|
|
typedef long (*sys_call_fn)(unsigned long, unsigned long,
|
|
unsigned long, unsigned long, unsigned long, unsigned long);
|
|
|
|
void noinstr __no_stack_protector do_syscall(struct pt_regs *regs)
|
|
{
|
|
unsigned long nr;
|
|
sys_call_fn syscall_fn;
|
|
|
|
nr = regs->regs[11];
|
|
/* Set for syscall restarting */
|
|
if (nr < NR_syscalls)
|
|
regs->regs[0] = nr + 1;
|
|
|
|
regs->csr_era += 4;
|
|
regs->orig_a0 = regs->regs[4];
|
|
regs->regs[4] = -ENOSYS;
|
|
|
|
nr = syscall_enter_from_user_mode(regs, nr);
|
|
|
|
add_random_kstack_offset();
|
|
|
|
if (nr < NR_syscalls) {
|
|
syscall_fn = sys_call_table[array_index_nospec(nr, NR_syscalls)];
|
|
regs->regs[4] = syscall_fn(regs->orig_a0, regs->regs[5], regs->regs[6],
|
|
regs->regs[7], regs->regs[8], regs->regs[9]);
|
|
}
|
|
|
|
syscall_exit_to_user_mode(regs);
|
|
}
|