1. 05 3月, 2020 1 次提交
    • L
      riscv, bpf: Add RV32G eBPF JIT · 5f316b65
      Luke Nelson 提交于
      This is an eBPF JIT for RV32G, adapted from the JIT for RV64G and
      the 32-bit ARM JIT.
      
      There are two main changes required for this to work compared to
      the RV64 JIT.
      
      First, eBPF registers are 64-bit, while RV32G registers are 32-bit.
      BPF registers either map directly to 2 RISC-V registers, or reside
      in stack scratch space and are saved and restored when used.
      
      Second, many 64-bit ALU operations do not trivially map to 32-bit
      operations. Operations that move bits between high and low words,
      such as ADD, LSH, MUL, and others must emulate the 64-bit behavior
      in terms of 32-bit instructions.
      
      This patch also makes related changes to bpf_jit.h, such
      as adding RISC-V instructions required by the RV32 JIT.
      
      Supported features:
      
      The RV32 JIT supports the same features and instructions as the
      RV64 JIT, with the following exceptions:
      
      - ALU64 DIV/MOD: Requires loops to implement on 32-bit hardware.
      
      - BPF_XADD | BPF_DW: There's no 8-byte atomic instruction in RV32.
      
      These features are also unsupported on other BPF JITs for 32-bit
      architectures.
      
      Testing:
      
      - lib/test_bpf.c
      test_bpf: Summary: 378 PASSED, 0 FAILED, [349/366 JIT'ed]
      test_bpf: test_skb_segment: Summary: 2 PASSED, 0 FAILED
      
      The tests that are not JITed are all due to use of 64-bit div/mod
      or 64-bit xadd.
      
      - tools/testing/selftests/bpf/test_verifier.c
      Summary: 1415 PASSED, 122 SKIPPED, 43 FAILED
      
      Tested both with and without BPF JIT hardening.
      
      This is the same set of tests that pass using the BPF interpreter
      with the JIT disabled.
      
      Verification and synthesis:
      
      We developed the RV32 JIT using our automated verification tool,
      Serval. We have used Serval in the past to verify patches to the
      RV64 JIT. We also used Serval to superoptimize the resulting code
      through program synthesis.
      
      You can find the tool and a guide to the approach and results here:
      https://github.com/uw-unsat/serval-bpf/tree/rv32-jit-v5Co-developed-by: NXi Wang <xi.wang@gmail.com>
      Signed-off-by: NXi Wang <xi.wang@gmail.com>
      Signed-off-by: NLuke Nelson <luke.r.nels@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Reviewed-by: NBjörn Töpel <bjorn.topel@gmail.com>
      Acked-by: NBjörn Töpel <bjorn.topel@gmail.com>
      Link: https://lore.kernel.org/bpf/20200305050207.4159-3-luke.r.nels@gmail.com
      5f316b65
  2. 24 1月, 2020 1 次提交
    • Z
      riscv: mm: add support for CONFIG_DEBUG_VIRTUAL · 6435f773
      Zong Li 提交于
      This patch implements CONFIG_DEBUG_VIRTUAL to do additional checks on
      virt_to_phys and __pa_symbol calls. virt_to_phys used for linear mapping
      check, and __pa_symbol used for kernel symbol check. In current RISC-V,
      kernel image maps to linear mapping area. If CONFIG_DEBUG_VIRTUAL is
      disable, these two functions calculate the offset on the address feded
      directly without any checks.
      
      The result of test_debug_virtual as follows:
      
      [    0.358456] ------------[ cut here ]------------
      [    0.358738] virt_to_phys used for non-linear address: (____ptrval____) (0xffffffd000000000)
      [    0.359174] WARNING: CPU: 0 PID: 1 at arch/riscv/mm/physaddr.c:16 __virt_to_phys+0x3c/0x50
      [    0.359409] Modules linked in:
      [    0.359630] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.5.0-rc3-00002-g5133c5c0ca13 #57
      [    0.359861] epc: ffffffe000253d1a ra : ffffffe000253d1a sp : ffffffe03aa87da0
      [    0.360019]  gp : ffffffe000ae03b0 tp : ffffffe03aa88000 t0 : ffffffe000af2660
      [    0.360175]  t1 : 0000000000000064 t2 : 00000000000000b7 s0 : ffffffe03aa87dc0
      [    0.360330]  s1 : ffffffd000000000 a0 : 000000000000004f a1 : 0000000000000000
      [    0.360492]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : ffffffe000a84358
      [    0.360672]  a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000000000000
      [    0.360876]  s2 : ffffffe000ae0600 s3 : ffffffe00000fc7c s4 : ffffffe0000224b0
      [    0.361067]  s5 : ffffffe000030890 s6 : ffffffe000022470 s7 : 0000000000000008
      [    0.361267]  s8 : ffffffe0000002c4 s9 : ffffffe000ae0640 s10: ffffffe000ae0630
      [    0.361453]  s11: 0000000000000000 t3 : 0000000000000000 t4 : 000000000001e6d0
      [    0.361636]  t5 : ffffffe000ae0a18 t6 : ffffffe000aee54e
      [    0.361806] status: 0000000000000120 badaddr: 0000000000000000 cause: 0000000000000003
      [    0.362056] ---[ end trace aec0bf78d4978122 ]---
      [    0.362404] PA: 0xfffffff080200000 for VA: 0xffffffd000000000
      [    0.362607] PA: 0x00000000baddd2d0 for VA: 0xffffffe03abdd2d0
      Signed-off-by: NZong Li <zong.li@sifive.com>
      Reviewed-by: NPaul Walmsley <paul.walmsley@sifive.com>
      Tested-by: NPaul Walmsley <paul.walmsley@sifive.com>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      6435f773
  3. 23 1月, 2020 2 次提交
    • O
      riscv: keep 32-bit kernel to 32-bit phys_addr_t · fc76324f
      Olof Johansson 提交于
      While rv32 technically has 34-bit physical addresses, no current platforms
      use it and it's likely to shake out driver bugs.
      
      Let's keep 64-bit phys_addr_t off on 32-bit builds until one shows up,
      since other work will be needed to make such a system useful anyway.
      
      PHYS_ADDR_T_64BIT is def_bool 64BIT, so just remove the select.
      Signed-off-by: NOlof Johansson <olof@lixom.net>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      fc76324f
    • N
      riscv: Add KASAN support · 8ad8b727
      Nick Hu 提交于
      This patch ports the feature Kernel Address SANitizer (KASAN).
      
      Note: The start address of shadow memory is at the beginning of kernel
      space, which is 2^64 - (2^39 / 2) in SV39. The size of the kernel space is
      2^38 bytes so the size of shadow memory should be 2^38 / 8. Thus, the
      shadow memory would not overlap with the fixmap area.
      
      There are currently two limitations in this port,
      
      1. RV64 only: KASAN need large address space for extra shadow memory
      region.
      
      2. KASAN can't debug the modules since the modules are allocated in VMALLOC
      area. We mapped the shadow memory, which corresponding to VMALLOC area, to
      the kasan_early_shadow_page because we don't have enough physical space for
      all the shadow memory corresponding to VMALLOC area.
      Signed-off-by: NNick Hu <nickhu@andestech.com>
      Reported-by: NGreentime Hu <green.hu@gmail.com>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      8ad8b727
  4. 07 1月, 2020 1 次提交
  5. 03 1月, 2020 1 次提交
  6. 20 12月, 2019 1 次提交
  7. 18 11月, 2019 1 次提交
    • C
      riscv: add nommu support · 6bd33e1e
      Christoph Hellwig 提交于
      The kernel runs in M-mode without using page tables, and thus can't run
      bare metal without help from additional firmware.
      
      Most of the patch is just stubbing out code not needed without page
      tables, but there is an interesting detail in the signals implementation:
      
       - The normal RISC-V syscall ABI only implements rt_sigreturn as VDSO
         entry point, but the ELF VDSO is not supported for nommu Linux.
         We instead copy the code to call the syscall onto the stack.
      
      In addition to enabling the nommu code a new defconfig for a small
      kernel image that can run in nommu mode on qemu is also provided, to run
      a kernel in qemu you can use the following command line:
      
      qemu-system-riscv64 -smp 2 -m 64 -machine virt -nographic \
      	-kernel arch/riscv/boot/loader \
      	-drive file=rootfs.ext2,format=raw,id=hd0 \
      	-device virtio-blk-device,drive=hd0
      
      Contains contributions from Damien Le Moal <Damien.LeMoal@wdc.com>.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NAnup Patel <anup@brainfault.org>
      [paul.walmsley@sifive.com: updated to apply; add CONFIG_MMU guards
       around PCI_IOBASE definition to fix build issues; fixed checkpatch
       issues; move the PCI_IO_* and VMEMMAP address space macros along
       with the others; resolve sparse warning]
      Signed-off-by: NPaul Walmsley <paul.walmsley@sifive.com>
      6bd33e1e
  8. 17 11月, 2019 1 次提交
    • A
      int128: move __uint128_t compiler test to Kconfig · c12d3362
      Ard Biesheuvel 提交于
      In order to use 128-bit integer arithmetic in C code, the architecture
      needs to have declared support for it by setting ARCH_SUPPORTS_INT128,
      and it requires a version of the toolchain that supports this at build
      time. This is why all existing tests for ARCH_SUPPORTS_INT128 also test
      whether __SIZEOF_INT128__ is defined, since this is only the case for
      compilers that can support 128-bit integers.
      
      Let's fold this additional test into the Kconfig declaration of
      ARCH_SUPPORTS_INT128 so that we can also use the symbol in Makefiles,
      e.g., to decide whether a certain object needs to be included in the
      first place.
      
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      c12d3362
  9. 14 11月, 2019 1 次提交
  10. 12 11月, 2019 1 次提交
  11. 06 11月, 2019 1 次提交
    • C
      riscv: abstract out CSR names for supervisor vs machine mode · a4c3733d
      Christoph Hellwig 提交于
      Many of the privileged CSRs exist in a supervisor and machine version
      that are used very similarly.  Provide versions of the CSR names and
      fields that map to either the S-mode or M-mode variant depending on
      a new CONFIG_RISCV_M_MODE kconfig symbol.
      
      Contains contributions from Damien Le Moal <Damien.LeMoal@wdc.com>
      and Paul Walmsley <paul.walmsley@sifive.com>.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Acked-by: Thomas Gleixner <tglx@linutronix.de> # for drivers/clocksource, drivers/irqchip
      [paul.walmsley@sifive.com: updated to apply]
      Signed-off-by: NPaul Walmsley <paul.walmsley@sifive.com>
      a4c3733d
  12. 30 10月, 2019 1 次提交
  13. 25 9月, 2019 1 次提交
    • A
      riscv: make mmap allocation top-down by default · 54c95a11
      Alexandre Ghiti 提交于
      In order to avoid wasting user address space by using bottom-up mmap
      allocation scheme, prefer top-down scheme when possible.
      
      Before:
      root@qemuriscv64:~# cat /proc/self/maps
      00010000-00016000 r-xp 00000000 fe:00 6389       /bin/cat.coreutils
      00016000-00017000 r--p 00005000 fe:00 6389       /bin/cat.coreutils
      00017000-00018000 rw-p 00006000 fe:00 6389       /bin/cat.coreutils
      00018000-00039000 rw-p 00000000 00:00 0          [heap]
      1555556000-155556d000 r-xp 00000000 fe:00 7193   /lib/ld-2.28.so
      155556d000-155556e000 r--p 00016000 fe:00 7193   /lib/ld-2.28.so
      155556e000-155556f000 rw-p 00017000 fe:00 7193   /lib/ld-2.28.so
      155556f000-1555570000 rw-p 00000000 00:00 0
      1555570000-1555572000 r-xp 00000000 00:00 0      [vdso]
      1555574000-1555576000 rw-p 00000000 00:00 0
      1555576000-1555674000 r-xp 00000000 fe:00 7187   /lib/libc-2.28.so
      1555674000-1555678000 r--p 000fd000 fe:00 7187   /lib/libc-2.28.so
      1555678000-155567a000 rw-p 00101000 fe:00 7187   /lib/libc-2.28.so
      155567a000-15556a0000 rw-p 00000000 00:00 0
      3fffb90000-3fffbb1000 rw-p 00000000 00:00 0      [stack]
      
      After:
      root@qemuriscv64:~# cat /proc/self/maps
      00010000-00016000 r-xp 00000000 fe:00 6389       /bin/cat.coreutils
      00016000-00017000 r--p 00005000 fe:00 6389       /bin/cat.coreutils
      00017000-00018000 rw-p 00006000 fe:00 6389       /bin/cat.coreutils
      2de81000-2dea2000 rw-p 00000000 00:00 0          [heap]
      3ff7eb6000-3ff7ed8000 rw-p 00000000 00:00 0
      3ff7ed8000-3ff7fd6000 r-xp 00000000 fe:00 7187   /lib/libc-2.28.so
      3ff7fd6000-3ff7fda000 r--p 000fd000 fe:00 7187   /lib/libc-2.28.so
      3ff7fda000-3ff7fdc000 rw-p 00101000 fe:00 7187   /lib/libc-2.28.so
      3ff7fdc000-3ff7fe2000 rw-p 00000000 00:00 0
      3ff7fe4000-3ff7fe6000 r-xp 00000000 00:00 0      [vdso]
      3ff7fe6000-3ff7ffd000 r-xp 00000000 fe:00 7193   /lib/ld-2.28.so
      3ff7ffd000-3ff7ffe000 r--p 00016000 fe:00 7193   /lib/ld-2.28.so
      3ff7ffe000-3ff7fff000 rw-p 00017000 fe:00 7193   /lib/ld-2.28.so
      3ff7fff000-3ff8000000 rw-p 00000000 00:00 0
      3fff888000-3fff8a9000 rw-p 00000000 00:00 0      [stack]
      
      [alex@ghiti.fr: v6]
        Link: http://lkml.kernel.org/r/20190808061756.19712-15-alex@ghiti.fr
      Link: http://lkml.kernel.org/r/20190730055113.23635-15-alex@ghiti.frSigned-off-by: NAlexandre Ghiti <alex@ghiti.fr>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Reviewed-by: NLuis Chamberlain <mcgrof@kernel.org>
      Acked-by: Paul Walmsley <paul.walmsley@sifive.com>	[arch/riscv]
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      54c95a11
  14. 05 9月, 2019 1 次提交
    • M
      riscv: Add support for perf registers sampling · 98a93b0b
      Mao Han 提交于
      This patch implements the perf registers sampling and validation API
      for the riscv arch. The valid registers and their register ID are
      defined in perf_regs.h. Perf tool can backtrace in userspace with
      unwind library and the registers/user stack dump support.
      Signed-off-by: NMao Han <han_mao@c-sky.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: linux-riscv <linux-riscv@lists.infradead.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Guo Ren <guoren@kernel.org>
      Tested-by: NGreentime Hu <greentime.hu@sifive.com>
      [paul.walmsley@sifive.com: minor patch description fix]
      Signed-off-by: NPaul Walmsley <paul.walmsley@sifive.com>
      98a93b0b
  15. 31 8月, 2019 1 次提交
    • L
      RISC-V: Implement sparsemem · d95f1a54
      Logan Gunthorpe 提交于
      Implement sparsemem support for Risc-v which helps pave the
      way for memory hotplug and eventually P2P support.
      
      Introduce Kconfig options for virtual and physical address bits which
      are used to calculate the size of the vmemmap and set the
      MAX_PHYSMEM_BITS.
      
      The vmemmap is located directly before the VMALLOC region and sized
      such that we can allocate enough pages to populate all the virtual
      address space in the system (similar to the way it's done in arm64).
      
      During initialization, call memblocks_present() and sparse_init(),
      and provide a stub for vmemmap_populate() (all of which is similar to
      arm64).
      
      [greentime.hu@sifive.com: fixed pfn_valid, FIXADDR_TOP and fixed a bug
       rebasing onto v5.3]
      Signed-off-by: NGreentime Hu <greentime.hu@sifive.com>
      Signed-off-by: NLogan Gunthorpe <logang@deltatee.com>
      Reviewed-by: NPalmer Dabbelt <palmer@sifive.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Andrew Waterman <andrew@sifive.com>
      Cc: Olof Johansson <olof@lixom.net>
      Cc: Michael Clark <michaeljclark@mac.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Zong Li <zong@andestech.com>
      Reviewed-by: NMike Rapoport <rppt@linux.ibm.com>
      [paul.walmsley@sifive.com: updated to apply; minor commit message
       reformat]
      Signed-off-by: NPaul Walmsley <paul.walmsley@sifive.com>
      d95f1a54
  16. 22 8月, 2019 1 次提交
  17. 23 7月, 2019 1 次提交
  18. 04 7月, 2019 1 次提交
  19. 02 7月, 2019 1 次提交
  20. 24 6月, 2019 1 次提交
  21. 21 6月, 2019 1 次提交
    • Y
      EDAC/sifive: Add EDAC platform driver for SiFive SoCs · 91abaeaa
      Yash Shah 提交于
      Add an EDAC driver for SiFive SoCs. The initial version supports ECC
      event monitoring and reporting through the EDAC framework for the SiFive
      L2 cache controller. It registers for notifier events from the L2 cache
      controller driver (arch/riscv/mm/sifive_l2_cache.c) for L2 ECC events.
      
       [ bp: Massage commit message. ]
      Signed-off-by: NYash Shah <yash.shah@sifive.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Reviewed-by: NJames Morse <james.morse@arm.com>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: linux-edac <linux-edac@vger.kernel.org>
      Cc: linux-riscv@lists.infradead.org
      Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
      Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: "Paul E. McKenney" <paulmck@linux.ibm.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: sachin.ghadi@sifive.com
      Link: https://lkml.kernel.org/r/1557142026-15949-2-git-send-email-yash.shah@sifive.com
      91abaeaa
  22. 15 6月, 2019 1 次提交
    • M
      docs: kbuild: convert docs to ReST and rename to *.rst · cd238eff
      Mauro Carvalho Chehab 提交于
      The kbuild documentation clearly shows that the documents
      there are written at different times: some use markdown,
      some use their own peculiar logic to split sections.
      
      Convert everything to ReST without affecting too much
      the author's style and avoiding adding uneeded markups.
      
      The conversion is actually:
        - add blank lines and identation in order to identify paragraphs;
        - fix tables markups;
        - add some lists markups;
        - mark literal blocks;
        - adjust title markups.
      
      At its new index.rst, let's add a :orphan: while this is not linked to
      the main index.rst file, in order to avoid build warnings.
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: NJonathan Corbet <corbet@lwn.net>
      cd238eff
  23. 21 5月, 2019 1 次提交
  24. 26 4月, 2019 1 次提交
  25. 08 4月, 2019 1 次提交
  26. 03 4月, 2019 1 次提交
    • W
      locking/rwsem: Remove rwsem-spinlock.c & use rwsem-xadd.c for all archs · 390a0c62
      Waiman Long 提交于
      Currently, we have two different implementation of rwsem:
      
       1) CONFIG_RWSEM_GENERIC_SPINLOCK (rwsem-spinlock.c)
       2) CONFIG_RWSEM_XCHGADD_ALGORITHM (rwsem-xadd.c)
      
      As we are going to use a single generic implementation for rwsem-xadd.c
      and no architecture-specific code will be needed, there is no point
      in keeping two different implementations of rwsem. In most cases, the
      performance of rwsem-spinlock.c will be worse. It also doesn't get all
      the performance tuning and optimizations that had been implemented in
      rwsem-xadd.c over the years.
      
      For simplication, we are going to remove rwsem-spinlock.c and make all
      architectures use a single implementation of rwsem - rwsem-xadd.c.
      
      All references to RWSEM_GENERIC_SPINLOCK and RWSEM_XCHGADD_ALGORITHM
      in the code are removed.
      Suggested-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NWaiman Long <longman@redhat.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-c6x-dev@linux-c6x.org
      Cc: linux-m68k@lists.linux-m68k.org
      Cc: linux-riscv@lists.infradead.org
      Cc: linux-um@lists.infradead.org
      Cc: linux-xtensa@linux-xtensa.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: nios2-dev@lists.rocketboards.org
      Cc: openrisc@lists.librecores.org
      Cc: uclinux-h8-devel@lists.sourceforge.jp
      Link: https://lkml.kernel.org/r/20190322143008.21313-3-longman@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      390a0c62
  27. 26 2月, 2019 1 次提交
  28. 21 2月, 2019 1 次提交
  29. 20 2月, 2019 2 次提交
  30. 19 2月, 2019 1 次提交
    • Y
      32-bit userspace ABI: introduce ARCH_32BIT_OFF_T config option · 942fa985
      Yury Norov 提交于
      All new 32-bit architectures should have 64-bit userspace off_t type, but
      existing architectures has 32-bit ones.
      
      To enforce the rule, new config option is added to arch/Kconfig that defaults
      ARCH_32BIT_OFF_T to be disabled for new 32-bit architectures. All existing
      32-bit architectures enable it explicitly.
      
      New option affects force_o_largefile() behaviour. Namely, if userspace
      off_t is 64-bits long, we have no reason to reject user to open big files.
      
      Note that even if architectures has only 64-bit off_t in the kernel
      (arc, c6x, h8300, hexagon, nios2, openrisc, and unicore32),
      a libc may use 32-bit off_t, and therefore want to limit the file size
      to 4GB unless specified differently in the open flags.
      Signed-off-by: NYury Norov <ynorov@caviumnetworks.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NYury Norov <ynorov@marvell.com>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      942fa985
  31. 05 2月, 2019 1 次提交
    • B
      bpf, riscv: add BPF JIT for RV64G · 2353ecc6
      Björn Töpel 提交于
      This commit adds a BPF JIT for RV64G.
      
      The JIT is a two-pass JIT, and has a dynamic prolog/epilogue (similar
      to the MIPS64 BPF JIT) instead of static ones (e.g. x86_64).
      
      At the moment the RISC-V Linux port does not support
      CONFIG_HAVE_KPROBES, which means that CONFIG_BPF_EVENTS is not
      supported. Thus, no tests involving BPF_PROG_TYPE_TRACEPOINT,
      BPF_PROG_TYPE_PERF_EVENT, BPF_PROG_TYPE_KPROBE and
      BPF_PROG_TYPE_RAW_TRACEPOINT passes.
      
      The implementation does not support "far branching" (>4KiB).
      
      Test results:
        # modprobe test_bpf
        test_bpf: Summary: 378 PASSED, 0 FAILED, [366/366 JIT'ed]
      
        # echo 1 > /proc/sys/kernel/unprivileged_bpf_disabled
        # ./test_verifier
        ...
        Summary: 761 PASSED, 507 SKIPPED, 2 FAILED
      
      Note that "test_verifier" was run with one build with
      CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y and one without, otherwise
      many of the the tests that require unaligned access were skipped.
      
      CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y:
        # echo 1 > /proc/sys/kernel/unprivileged_bpf_disabled
        # ./test_verifier | grep -c 'NOTE.*unknown align'
        0
      
      No CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS:
        # echo 1 > /proc/sys/kernel/unprivileged_bpf_disabled
        # ./test_verifier | grep -c 'NOTE.*unknown align'
        59
      
      The two failing test_verifier tests are:
        "ld_abs: vlan + abs, test 1"
        "ld_abs: jump around ld_abs"
      
      This is due to that "far branching" involved in those tests.
      
      All tests where done on QEMU (QEMU emulator version 3.1.50
      (v3.1.0-688-g8ae951fbc106)).
      Signed-off-by: NBjörn Töpel <bjorn.topel@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      2353ecc6
  32. 24 1月, 2019 1 次提交
  33. 08 1月, 2019 3 次提交
    • D
      riscv: add HAVE_SYSCALL_TRACEPOINTS to Kconfig · 5aeb1b36
      David Abdurachmanov 提交于
      I looked into Documentation/trace/ftrace-design.rst and, I think,
      we check all the boxes needed for HAVE_SYSCALL_TRACEPOINTS.
      Signed-off-by: NDavid Abdurachmanov <david.abdurachmanov@gmail.com>
      Signed-off-by: NPalmer Dabbelt <palmer@sifive.com>
      5aeb1b36
    • D
      riscv: add audit support · efe75c49
      David Abdurachmanov 提交于
      On RISC-V (riscv) audit is supported through generic lib/audit.c.
      The patch adds required arch specific definitions.
      Signed-off-by: NDavid Abdurachmanov <david.abdurachmanov@gmail.com>
      Signed-off-by: NPalmer Dabbelt <palmer@sifive.com>
      efe75c49
    • Z
      RISC-V: Support MODULE_SECTIONS mechanism on RV32 · 2cffc956
      Zong Li 提交于
      This patch supports dynamic generate got and plt sections mechanism on
      rv32. It contains the modification as follows:
       - Always enable MODULE_SECTIONS (both rv64 and rv32)
       - Change the fixed size type.
      
      This patch had been tested by following modules:
      
      btrfs 6795991 0 - Live 0xa544b000
      test_static_keys 17304 0 - Live 0xa28be000
      zstd_compress 1198986 1 btrfs, Live 0xa2a25000
      zstd_decompress 608112 1 btrfs, Live 0xa24e7000
      lzo 8787 0 - Live 0xa2049000
      xor 27461 1 btrfs, Live 0xa2041000
      zram 78849 0 - Live 0xa2276000
      netdevsim 55909 0 - Live 0xa202d000
      tun 211534 0 - Live 0xa21b5000
      fuse 566049 0 - Live 0xa25fb000
      nfs_layout_flexfiles 192597 0 - Live 0xa229b000
      ramoops 74895 0 - Live 0xa2019000
      xfs 3973221 0 - Live 0xa507f000
      libcrc32c 3053 2 btrfs,xfs, Live 0xa34af000
      lzo_compress 17302 2 btrfs,lzo, Live 0xa347d000
      lzo_decompress 7178 2 btrfs,lzo, Live 0xa3451000
      raid6_pq 142086 1 btrfs, Live 0xa33a4000
      reed_solomon 31022 1 ramoops, Live 0xa31eb000
      test_bitmap 3734 0 - Live 0xa31af000
      test_bpf 1588736 0 - Live 0xa2c11000
      test_kmod 41161 0 - Live 0xa29f8000
      test_module 1356 0 - Live 0xa299e000
      test_printf 6024 0 [permanent], Live 0xa2971000
      test_static_key_base 5797 1 test_static_keys, Live 0xa2931000
      test_user_copy 4382 0 - Live 0xa28c9000
      xxhash 70501 2 zstd_compress,zstd_decompress, Live 0xa2055000
      Signed-off-by: NZong Li <zong@andestech.com>
      Signed-off-by: NPalmer Dabbelt <palmer@sifive.com>
      2cffc956
  34. 22 12月, 2018 2 次提交
  35. 21 12月, 2018 1 次提交