Skip to content
Snippets Groups Projects
  1. Feb 24, 2023
  2. Feb 17, 2023
  3. Feb 15, 2023
  4. Feb 14, 2023
    • Dave Marchevsky's avatar
      bpf: Add basic bpf_rb_{root,node} support · 9c395c1b
      Dave Marchevsky authored
      
      This patch adds special BPF_RB_{ROOT,NODE} btf_field_types similar to
      BPF_LIST_{HEAD,NODE}, adds the necessary plumbing to detect the new
      types, and adds bpf_rb_root_free function for freeing bpf_rb_root in
      map_values.
      
      structs bpf_rb_root and bpf_rb_node are opaque types meant to
      obscure structs rb_root_cached rb_node, respectively.
      
      btf_struct_access will prevent BPF programs from touching these special
      fields automatically now that they're recognized.
      
      btf_check_and_fixup_fields now groups list_head and rb_root together as
      "graph root" fields and {list,rb}_node as "graph node", and does same
      ownership cycle checking as before. Note that this function does _not_
      prevent ownership type mixups (e.g. rb_root owning list_node) - that's
      handled by btf_parse_graph_root.
      
      After this patch, a bpf program can have a struct bpf_rb_root in a
      map_value, but not add anything to nor do anything useful with it.
      
      Signed-off-by: default avatarDave Marchevsky <davemarchevsky@fb.com>
      Link: https://lore.kernel.org/r/20230214004017.2534011-2-davemarchevsky@fb.com
      
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      9c395c1b
  5. Feb 11, 2023
  6. Feb 04, 2023
  7. Feb 03, 2023
  8. Jan 23, 2023
    • Stanislav Fomichev's avatar
      bpf: Introduce device-bound XDP programs · 2b3486bc
      Stanislav Fomichev authored
      
      New flag BPF_F_XDP_DEV_BOUND_ONLY plus all the infra to have a way
      to associate a netdev with a BPF program at load time.
      
      netdevsim checks are dropped in favor of generic check in dev_xdp_attach.
      
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Martin KaFai Lau <martin.lau@linux.dev>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Willem de Bruijn <willemb@google.com>
      Cc: Jesper Dangaard Brouer <brouer@redhat.com>
      Cc: Anatoly Burakov <anatoly.burakov@intel.com>
      Cc: Alexander Lobakin <alexandr.lobakin@intel.com>
      Cc: Magnus Karlsson <magnus.karlsson@gmail.com>
      Cc: Maryam Tahhan <mtahhan@redhat.com>
      Cc: xdp-hints@xdp-project.net
      Cc: netdev@vger.kernel.org
      Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
      Link: https://lore.kernel.org/r/20230119221536.3349901-6-sdf@google.com
      
      
      Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
      2b3486bc
  9. Jan 18, 2023
  10. Jan 17, 2023
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync linux/kvm.h with the kernel sources · 8026a31d
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        b0305c1e ("KVM: x86/xen: Add KVM_XEN_INVALID_GPA and KVM_XEN_INVALID_GFN to uapi")
      
      That just rebuilds perf, as these patches don't add any new KVM ioctl to
      be harvested for the the 'perf trace' ioctl syscall argument
      beautifiers.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
        diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Woodhouse <dwmw@amazon.co.uk>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: http://lore.kernel.org/lkml/Y7Loj5slB908QSXf@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8026a31d
  11. Jan 15, 2023
  12. Jan 10, 2023
    • Ammar Faizi's avatar
      nolibc/sys: Implement `getpagesize(2)` function · 7efd762e
      Ammar Faizi authored
      
      This function returns the page size used by the running kernel. The
      page size value is taken from the auxiliary vector at 'AT_PAGESZ' key.
      
      'getpagesize(2)' is assumed as a syscall becuase the manpage placement
      of this function is in entry 2 ('man 2 getpagesize') despite there is
      no real 'getpagesize(2)' syscall in the Linux syscall table. Define
      this function in 'sys.h'.
      
      Signed-off-by: default avatarAmmar Faizi <ammarfaizi2@gnuweeb.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      7efd762e
    • Ammar Faizi's avatar
      nolibc/stdlib: Implement `getauxval(3)` function · c61a0780
      Ammar Faizi authored
      
      Previous commits save the address of the auxiliary vector into a global
      variable @_auxv. This commit creates a new function 'getauxval()' as a
      helper function to get the auxv value based on the given key.
      
      The behavior of this function is identic with the function documented
      in 'man 3 getauxval'. This function is also needed to implement
      'getpagesize()' function that we will wire up in the next patches.
      
      Signed-off-by: default avatarAmmar Faizi <ammarfaizi2@gnuweeb.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      c61a0780
    • Sven Schnelle's avatar
      tools/nolibc: add auxiliary vector retrieval for s390 · 241c4b4e
      Sven Schnelle authored
      
      In the _start block we now iterate over envp to find the auxiliary
      vector after the NULL. The pointer is saved into an _auxv variable
      that is marked as weak so that it's accessible from multiple units.
      
      Signed-off-by: default avatarSven Schnelle <svens@linux.ibm.com>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      241c4b4e
    • Willy Tarreau's avatar
      tools/nolibc: add auxiliary vector retrieval for mips · d01869cf
      Willy Tarreau authored
      
      In the _start block we now iterate over envp to find the auxiliary
      vector after the NULL. The pointer is saved into an _auxv variable
      that is marked as weak so that it's accessible from multiple units.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      d01869cf
    • Willy Tarreau's avatar
      tools/nolibc: add auxiliary vector retrieval for riscv · 041fa97c
      Willy Tarreau authored
      
      In the _start block we now iterate over envp to find the auxiliary
      vector after the NULL. The pointer is saved into an _auxv variable
      that is marked as weak so that it's accessible from multiple units.
      It was tested on riscv64 only.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      041fa97c
    • Willy Tarreau's avatar
      tools/nolibc: add auxiliary vector retrieval for arm · 59ea1876
      Willy Tarreau authored
      
      In the _start block we now iterate over envp to find the auxiliary
      vector after the NULL. The pointer is saved into an _auxv variable
      that is marked as weak so that it's accessible from multiple units.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      
      It was tested in arm, thumb1 and thumb2 modes.
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      59ea1876
    • Willy Tarreau's avatar
      tools/nolibc: add auxiliary vector retrieval for arm64 · 2a39a532
      Willy Tarreau authored
      
      In the _start block we now iterate over envp to find the auxiliary
      vector after the NULL. The pointer is saved into an _auxv variable
      that is marked as weak so that it's accessible from multiple units.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      2a39a532
    • Willy Tarreau's avatar
      tools/nolibc: add auxiliary vector retrieval for x86_64 · 1cce162a
      Willy Tarreau authored
      
      In the _start block we now iterate over envp to find the auxiliary
      vector after the NULL. The pointer is saved into an _auxv variable
      that is marked as weak so that it's accessible from multiple units.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      1cce162a
    • Willy Tarreau's avatar
      tools/nolibc: add auxiliary vector retrieval for i386 · 2ab4aa48
      Willy Tarreau authored
      
      In the _start block we now iterate over envp to find the auxiliary
      vector after the NULL. The pointer is saved into an _auxv variable
      that is marked as weak so that it's accessible from multiple units.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      2ab4aa48
    • Sven Schnelle's avatar
      tools/nolibc: export environ as a weak symbol on s390 · 9e5bdc61
      Sven Schnelle authored
      
      The environ is retrieved from the _start code and is easy to store at
      this moment. Let's declare the variable weak and store the value into
      it. By not being static it will be visible to all units. By being weak,
      if some programs already declared it, they will continue to be able to
      use it. This was tested on s390 both with environ inherited from
      _start and extracted from envp.
      
      Signed-off-by: default avatarSven Schnelle <svens@linux.ibm.com>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      9e5bdc61
    • Willy Tarreau's avatar
      tools/nolibc: export environ as a weak symbol on riscv · 758f3337
      Willy Tarreau authored
      
      The environ is retrieved from the _start code and is easy to store at
      this moment. Let's declare the variable weak and store the value into
      it. By not being static it will be visible to all units. By being weak,
      if some programs already declared it, they will continue to be able to
      use it. This was tested on riscv64 both with environ inherited from
      _start and extracted from envp.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      758f3337
    • Willy Tarreau's avatar
      tools/nolibc: export environ as a weak symbol on mips · 8f7fafeb
      Willy Tarreau authored
      
      The environ is retrieved from the _start code and is easy to store at
      this moment. Let's declare the variable weak and store the value into
      it. By not being static it will be visible to all units. By being weak,
      if some programs already declared it, they will continue to be able to
      use it. This was tested with mips24kc (BE) both with environ inherited
      from _start and extracted from envp.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      8f7fafeb
    • Willy Tarreau's avatar
      tools/nolibc: export environ as a weak symbol on arm · a6f29a2c
      Willy Tarreau authored
      
      The environ is retrieved from the _start code and is easy to store at
      this moment. Let's declare the variable weak and store the value into
      it. By not being static it will be visible to all units. By being weak,
      if some programs already declared it, they will continue to be able to
      use it. This was tested in arm and thumb1 and thumb2 modes, and for each
      mode, both with environ inherited from _start and extracted from envp.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      a6f29a2c
    • Willy Tarreau's avatar
      tools/nolibc: export environ as a weak symbol on arm64 · 9b8688c6
      Willy Tarreau authored
      
      The environ is retrieved from the _start code and is easy to store at
      this moment. Let's declare the variable weak and store the value into
      it. By not being static it will be visible to all units. By being weak,
      if some programs already declared it, they will continue to be able to
      use it. This was tested both with environ inherited from _start and
      extracted from envp.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      9b8688c6
    • Willy Tarreau's avatar
      tools/nolibc: export environ as a weak symbol on i386 · 52e423f5
      Willy Tarreau authored
      
      The environ is retrieved from the _start code and is easy to store at
      this moment. Let's declare the variable weak and store the value into
      it. By not being static it will be visible to all units. By being weak,
      if some programs already declared it, they will continue to be able to
      use it. This was tested both with environ inherited from _start and
      extracted from envp.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      52e423f5
    • Willy Tarreau's avatar
      tools/nolibc: export environ as a weak symbol on x86_64 · 89dc5092
      Willy Tarreau authored
      
      The environ is retrieved from the _start code and is easy to store at
      this moment. Let's declare the variable weak and store the value into
      it. By not being static it will be visible to all units. By being weak,
      if some programs already declared it, they will continue to be able to
      use it. This was tested both with environ inherited from _start and
      extracted from envp.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      89dc5092
    • Willy Tarreau's avatar
      tools/nolibc: make errno a weak symbol instead of a static one · 1caa1154
      Willy Tarreau authored
      
      Till now errno was declared static so that it could be eliminated if
      unused. While the goal is commendable for tiny executables as it allows
      to eliminate any data and bss segments when not used, this comes with
      some limitations, one of which being that the errno symbol seen in
      different units are not the same. Even though this has never been a
      real issue given the nature of the programs involved till now, it
      happens that referencing the same symbol from multiple units can also
      be achieved using weak symbols, with a difference being that only one
      of them will be used for all of them. Compared to weak symbols, static
      basically have no benefit for regular programs since there are always
      at least a few variables in most of these, so the bss segment cannot
      be eliminated. E.g:
      
        $ size nolibc-test-static-errno
           text    data     bss     dec     hex filename
          11531       0      48   11579    2d3b nolibc-test-static-errno
      
      Furthermore, the weak symbol doesn't use bss storage at all, resulting
      in a slightly section:
      
        $ size nolibc-test-weak-errno
           text    data     bss     dec     hex filename
          11531       0      40   11571    2d33 nolibc-test-weak-errno
      
      This patch thus converts errno from static to weak.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      1caa1154
    • Willy Tarreau's avatar
      tools/nolibc: remove local definitions of O_* flags for open/fcntl · d5b48f95
      Willy Tarreau authored
      
      The historic nolibc code did not include asm/fcntl.h and had to define
      the various O_RDWR etc macros in each arch-specific file (since such
      values differ between certain archs). This was found at least once to
      induce bugs due to wrong definitions. Let's get rid of all of them and
      include asm/nolibc.h from sys.h instead. This was verified to work
      properly on all supported architectures.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      d5b48f95
    • Willy Tarreau's avatar
      tools/nolibc: support thumb mode with frame pointers on ARM · 5a51b6de
      Willy Tarreau authored
      
      In Thumb mode, register r7 is normally used to store the frame pointer.
      By default when optimizing at -Os there's no frame pointer so this works
      fine. But if no optimization is set, then build errors occur, indicating
      that r7 cannot not be used. It's difficult to cheat because it's the
      compiler that is complaining, not the assembler, so it's not even possible
      to report that the register was clobbered. The solution consists in saving
      and restoring r7 around the syscall, but this slightly inflates the code.
      The syscall number is passed via r6 which is never used by syscalls.
      
      The current patch adds a few macroes which do that only in Thumb mode,
      and which continue to directly assign the syscall number to register r7
      in ARM mode. Now this always builds and works for all modes (tested on
      Arm, Thumbv1, Thumbv2 modes, at -Os, -O0, -O0 -fomit-frame-pointer).
      The code is very slightly inflated in thumb-mode without frame-pointers
      compared to previously (e.g. 7928 vs 7864 bytes for nolibc-test) but at
      least it's always operational. And it's possible to disable this mechanism
      by setting NOLIBC_OMIT_FRAME_POINTER.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      5a51b6de
    • Willy Tarreau's avatar
      tools/nolibc: enable support for thumb1 mode for ARM · 20470dfd
      Willy Tarreau authored
      
      Passing -mthumb to the kernel.org arm toolchain failed to build because it
      defaults to armv5 hence thumb1, which has a fairly limited instruction set
      compared to thumb2 enabled with armv7 that is much more complete. It's not
      very difficult to adjust the instructions to also build on thumb1, it only
      adds a total of 3 instructions, so it's worth doing it at least to ease use
      by casual testers. It was verified that the adjusted code now builds and
      works fine for armv5, thumb1, armv7 and thumb2, as long as frame pointers
      are not used.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      20470dfd
    • Willy Tarreau's avatar
      tools/nolibc: make compiler and assembler agree on the section around _start · 7f854858
      Willy Tarreau authored
      
      The out-of-block asm() statement carrying _start does not allow the
      compiler to know what section the assembly code is being emitted to,
      and there's no easy way to push/pop the current section and restore
      it. It sometimes causes issues depending on the include files ordering
      and compiler optimizations. For example if a variable is declared
      immediately before the asm() block and another one after, the compiler
      assumes that the current section is still .bss and doesn't re-emit it,
      making the second variable appear inside the .text section instead.
      Forcing .bss at the end of the _start block doesn't work either because
      at certain optimizations the compiler may reorder blocks and will make
      some real code appear just after this block.
      
      A significant number of solutions were attempted, but many of them were
      still sensitive to section reordering. In the end, the best way to make
      sure the compiler and assembler agree on the current section is to place
      this code inside a function. Here the function is directly called _start
      and configured not to emit a frame-pointer, hence to have no prologue.
      If some future architectures would still emit some prologue, another
      working approach consists in naming the function differently and placing
      the _start label inside the asm statement. But the current solution is
      simpler.
      
      It was tested with nolibc-test at -O,-O0,-O2,-O3,-Os for arm,arm64,i386,
      mips,riscv,s390 and x86_64.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      7f854858
  13. Jan 09, 2023
    • Willy Tarreau's avatar
      tools/nolibc: fix the O_* fcntl/open macro definitions for riscv · 00b18da4
      Willy Tarreau authored
      
      When RISCV port was imported in 5.2, the O_* macros were taken with
      their octal value and written as-is in hex, resulting in the getdents64()
      to fail in nolibc-test.
      
      Fixes: 582e84f7 ("tool headers nolibc: add RISCV support") #5.2
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      00b18da4
    • Sven Schnelle's avatar
      nolibc: add support for s390 · 18a5a09d
      Sven Schnelle authored
      
      Use arch-x86_64 as a template. Not really different, but
      we have our own mmap syscall which takes a structure instead
      of discrete arguments.
      
      Signed-off-by: default avatarSven Schnelle <svens@linux.ibm.com>
      Acked-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      18a5a09d
    • Willy Tarreau's avatar
      tools/nolibc: prevent gcc from making memset() loop over itself · 1bfbe1f3
      Willy Tarreau authored
      
      When building on ARM in thumb mode with gcc-11.3 at -O2 or -O3,
      nolibc-test segfaults during the select() tests. It turns out that at
      this level, gcc recognizes an opportunity for using memset() to zero
      the fd_set, but it miscompiles it because it also recognizes a memset
      pattern as well, and decides to call memset() from the memset() code:
      
        000122bc <memset>:
           122bc:       b510            push    {r4, lr}
           122be:       0004            movs    r4, r0
           122c0:       2a00            cmp     r2, #0
           122c2:       d003            beq.n   122cc <memset+0x10>
           122c4:       23ff            movs    r3, #255        ; 0xff
           122c6:       4019            ands    r1, r3
           122c8:       f7ff fff8       bl      122bc <memset>
           122cc:       0020            movs    r0, r4
           122ce:       bd10            pop     {r4, pc}
      
      Simply placing an empty asm() statement inside the loop suffices to
      avoid this.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      1bfbe1f3
    • Willy Tarreau's avatar
      tools/nolibc: fix missing includes causing build issues at -O0 · 55abdd1f
      Willy Tarreau authored
      
      After the nolibc includes were split to facilitate portability from
      standard libcs, programs that include only what they need may miss
      some symbols which are needed by libgcc. This is the case for raise()
      which is needed by the divide by zero code in some architectures for
      example.
      
      Regardless, being able to include only the apparently needed files is
      convenient.
      
      Instead of trying to move all exported definitions to a single file,
      since this can change over time, this patch takes another approach
      consisting in including the nolibc header at the end of all standard
      include files. This way their types and functions are already known
      at the moment of inclusion, and including any single one of them is
      sufficient to bring all the required ones.
      
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      55abdd1f
    • Willy Tarreau's avatar
      tools/nolibc: restore mips branch ordering in the _start block · 184177c3
      Willy Tarreau authored
      
      Depending on the compiler used and the optimization options, the sbrk()
      test was crashing, both on real hardware (mips-24kc) and in qemu. One
      such example is kernel.org toolchain in version 11.3 optimizing at -Os.
      
      Inspecting the sys_brk() call shows the following code:
      
        0040047c <sys_brk>:
          40047c:       24020fcd        li      v0,4045
          400480:       27bdffe0        addiu   sp,sp,-32
          400484:       0000000c        syscall
          400488:       27bd0020        addiu   sp,sp,32
          40048c:       10e00001        beqz    a3,400494 <sys_brk+0x18>
          400490:       00021023        negu    v0,v0
          400494:       03e00008        jr      ra
      
      It is obviously wrong, the "negu" instruction is placed in beqz's
      delayed slot, and worse, there's no nop nor instruction after the
      return, so the next function's first instruction (addiu sip,sip,-32)
      will also be executed as part of the delayed slot that follows the
      return.
      
      This is caused by the ".set noreorder" directive in the _start block,
      that applies to the whole program. The compiler emits code without the
      delayed slots and relies on the compiler to swap instructions when this
      option is not set. Removing the option would require to change the
      startup code in a way that wouldn't make it look like the resulting
      code, which would not be easy to debug. Instead let's just save the
      default ordering before changing it, and restore it at the end of the
      _start block. Now the code is correct:
      
        0040047c <sys_brk>:
          40047c:       24020fcd        li      v0,4045
          400480:       27bdffe0        addiu   sp,sp,-32
          400484:       0000000c        syscall
          400488:       10e00002        beqz    a3,400494 <sys_brk+0x18>
          40048c:       27bd0020        addiu   sp,sp,32
          400490:       00021023        negu    v0,v0
          400494:       03e00008        jr      ra
          400498:       00000000        nop
      
      Fixes: 66b6f755 ("rcutorture: Import a copy of nolibc") #5.0
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      184177c3
    • Warner Losh's avatar
      tools/nolibc: Fix S_ISxxx macros · 16f5cea7
      Warner Losh authored
      
      The mode field has the type encoded as an value in a field, not as a bit
      mask. Mask the mode with S_IFMT instead of each type to test. Otherwise,
      false positives are possible: eg S_ISDIR will return true for block
      devices because S_IFDIR = 0040000 and S_IFBLK = 0060000 since mode is
      masked with S_IFDIR instead of S_IFMT. These macros now match the
      similar definitions in tools/include/uapi/linux/stat.h.
      
      Signed-off-by: default avatarWarner Losh <imp@bsdimp.com>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      16f5cea7
    • Sven Schnelle's avatar
      nolibc: fix fd_set type · feaf7565
      Sven Schnelle authored
      
      The kernel uses unsigned long for the fd_set bitmap,
      but nolibc use u32. This works fine on little endian
      machines, but fails on big endian. Convert to unsigned
      long to fix this.
      
      Signed-off-by: default avatarSven Schnelle <svens@linux.ibm.com>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      feaf7565
Loading