1. 19 Oct, 2021 1 commit
    • Tamas Petz's avatar
      Introduce LIBSHIM_ZERO_DDC configuration option · 6ac7fd46
      Tamas Petz authored
      When LIBSHIM_ZERO_DDC is enabled and targeting pure capability ABI,
      do_raw_args_marshalling() saves the original value of DDC and then
      clears it. This is meant to prevent deriving tagged capabilities
      from that point onwards using the original DDC value outside
      This change also removes 'rootcap' usages from libshim.
      Built and tested on FVP.
      Change-Id: I4cae99095f96999f5052ba83e43469168f7495cb
  2. 18 Oct, 2021 1 commit
  3. 13 Oct, 2021 1 commit
    • Tamas Petz's avatar
      Split static and dynamic libc support · e996a08a
      Tamas Petz authored
      Static libc should contain all the symbols necessary to run
      an application. Dynamic libc, however, should only contain
      symbols which are not "duplicated" in the dynamic linker.
      So far both the dynamic linker and the shared libc had all
      the libshim symbols. This proved to be working correctly,
      however, having a fully singleton libshim is desirable.
      From now on only symbols which are mandatory for libc are
      provided, all the other libshim-internal symbols are weak.
      Because the dynamic linker has the strong alternatives of
      these symbols, linker will resolve these weak symbols so
      that they come from the linker. This allows implementation
      of a singleton pattern for libshim.
      Built and tested on FVP.
      Change-Id: I071ca7e23488293425990ead2c9261497c96786c
  4. 12 Oct, 2021 1 commit
  5. 01 Oct, 2021 1 commit
  6. 29 Sep, 2021 1 commit
    • Tamas Petz's avatar
      [NFC] Clarify failed and best-effort calls · 5ee0ab05
      Tamas Petz authored
      To ease debugging, this change adds support to make a difference
      between system calls that are called best-effort and calls which
      actually failed when the related message gets printed.
      Change-Id: I05fd769ed2fcc391e8ce2ce823b0bcdf86a21e9e
  7. 23 Sep, 2021 1 commit
  8. 06 Sep, 2021 1 commit
    • yoan picchi's avatar
      Fix mmap and mremap to return page-aligned bounds · 230fd422
      yoan picchi authored
      They allocate memory with a page granule. Yet they used to set the bounds
      to the requested value instead. Some algorithms (like musl's malloc) make
      use of the end of the page. This patch aligns the return bounds to the
      closest fitting page size.
      Change-Id: I53e934a6e165e5f85687aff6339e3dc5923e3e81
  9. 26 Aug, 2021 1 commit
  10. 17 Aug, 2021 1 commit
  11. 13 Jul, 2021 1 commit
    • Tamas Petz's avatar
      Change dependency on "asm/unistd.h" · 2a0579db
      Tamas Petz authored
      This change removes pollution of many translation units with
      contents of "asm/unistd.h". From now on it is only included in
      the generated "libshim-syscalls.S" file. Moreover, this file is
      only generated when targeting Bionic/Arm64.
      Built and tested on the FVP.
      Change-Id: Id8079d1c1817500edcf38d8d5f8c9b95526d6984
  12. 07 Jul, 2021 7 commits
  13. 29 Jun, 2021 1 commit
    • Tamas Petz's avatar
      Introduce LIBSHIM_PRETTY_PRINT config option · b7ce0d46
      Tamas Petz authored
      It is now possible to turn-off pretty-printing. This may be
      useful when porting libc. If pretty-printing is turned-off
      only the format strings will be printed.
      Change-Id: I6f55e68187fd25ebc6818214d5c66a541ee63fb4
  14. 21 Jun, 2021 1 commit
    • Ruben's avatar
      Symlink arm64 -> morello json files · 44654b74
      Ruben authored
      The json files for arm64 (Hybrid-cap ABI) and morello (Pure-cap ABI)
      are effectively same.
      Change-Id: Iffdba5c0b22115a4a6ec56631fc6e311d6894348
  15. 18 Jun, 2021 1 commit
  16. 17 Jun, 2021 2 commits
    • Tamas Petz's avatar
      Change mmap shim · d0f89f48
      Tamas Petz authored
      There are some new rules regarding how mmap() should be handled:
      1. If MAP_FIXED is set
        1.1 and hint is a tagged capability, then bounds must be properly set.
        1.2 and hint is an untagged capability, then MAP_FIXED should be
            replaced with MAP_FIXED_NOREPLACE.
      2. If MAP_FIXED is not set then capability metadata should be ignored.
      The change tries to support kernels which don't recognize
      MAP_FIXED_NOREPLACE. Should the returned pointer be different from the
      expected one, the code will try to unmap the newly allocated region
      and will return -1 (EEXIST).
      Built and tested on the FVP.
      Change-Id: I28cbe334b940fd15baf61acadb6faaa868a1a017
    • Yury Khrustalev's avatar
      Fix how kernel headers are looked up for Musl libc · fea1b574
      Yury Khrustalev authored
      This patch adds support for finding kernel headers on Debian based systems
      Change-Id: Id004b1fb6042fb6d296f728ff1bbc18663e30607
  17. 02 Jun, 2021 1 commit
    • Tamas Petz's avatar
      Introduce 'is_zero_init' · 144f4e59
      Tamas Petz authored
      This new trait helps decide if a type is safe to construct
      from cleared memory.
      Change-Id: Ia2de9e8fa0ee8dbcab645b00fd8e6601dccd2a3b
  18. 01 Jun, 2021 1 commit
    • Tamas Petz's avatar
      Fix pipe2: arg1 is int[2] · bdfe2a6b
      Tamas Petz authored
      This patch adds further support to similar cases, if need be.
      Change-Id: I64ada12495e214e8c784cc2dd2b495014d6c6aa0
  19. 21 May, 2021 1 commit
    • Tamas Petz's avatar
      Refine wording · 76002068
      Tamas Petz authored
      Change-Id: I2e675d1df707b73eb487fbcc49eeca616223f7d9
  20. 20 May, 2021 1 commit
    • Brett Warren's avatar
      make: fix archs-specific sources · 2848293f
      Brett Warren authored
      Previously morello-specific sources weren't being
      compiled because the substitution reference intended to
      add their respective objects was incorrect.
      Change-Id: I733379647adeb50789d44917a9995c2268cb7fa2
  21. 19 May, 2021 13 commits
    • Tamas Petz's avatar
      [rt_sigaction] Reimplement SigActionHandlerRegistry · 70b28aca
      Tamas Petz authored
      For details, please see the comments in rt_sigaction.cpp.
      Change-Id: Ide976adac5ad62e36e5b9ab5bdf227b1698653b7
    • Brett Warren's avatar
      make: include kernel headers for musl · e3f8f000
      Brett Warren authored
      Unlike glibc and bionic, musl doesn't have its own
      "linux" kernel headers, so we include this subsystem instead from
      /usr/include, alongside its dependencies, asm and asm-generic.
      We don't want to include anything else from the standard system
      libraries to avoid potentially including unexpected C library code
      into libshim and therefore into musl.
      These files are symlinked into a local directory in the specified
      build folder. All of these changes are conditional on LIBC equaling
      Change-Id: I809caa8cb8b3f6352a247751a8d309b0c6fe33d7
    • Brett Warren's avatar
      make: add generic LIBC_PATH · 6222bf65
      Brett Warren authored
      LIBC is also now derived from LIBC_PATH.
      Change-Id: I7fa73134b6441620d15dab3a6c682b72cee9fa1b
    • Tamas Petz's avatar
      Develop svc() for x86_64 · 3ea1c90f
      Tamas Petz authored
      Change-Id: I7331d6bda9ff9306458c8a887cf9a9991f578676
    • Tamas Petz's avatar
      Add Makefile · 81b8cebc
      Tamas Petz authored
      Co-authored-by: Szabolcs Nagy's avatarSzabolcs Nagy <szabolcs.nagy@arm.com>
      Change-Id: I6178e2ff8676b808f5c6900681e3451bae25cb54
    • Ruben's avatar
      Add .gitignore · b2a3ee41
      Ruben authored
      Change-Id: I3760411c31fbe1549a783418de2efe5919a4f174
    • Tamas Petz's avatar
      [NFC] Apply some cosmetics to svc() · be36d5d1
      Tamas Petz authored
      This is a non-functional change.
      Change-Id: I2c7d288ee3374d9974da17099291ce29f9552883
    • Tamas Petz's avatar
      [shims.cpp] Undefine macros of symbols · 2199bf68
      Tamas Petz authored
      In some libc implementations, such as musl, it is not rare that
      some symbols are aliasing others.
      This is most often done like this:
      \#define getdents64 getdents
      This behaviour could be circumvented by undefining macros, such as
      _GNU_SOURCE, but then we would have to define all the types we check
      or translate.
      This changes solves this in a way so that the generated 'shims.cpp'
      will look like this:
      // int getdents64 (unsigned int, struct dirent*, unsigned int)
      // ...
      \#undef getdents64
      LIBSHIM_FN(getdents64) {
      These "undef"-s only affect the current translation unit and should
      not cause any side-effects.
      Built and tested with FVP.
      Change-Id: Ic8e989918bc64869f0dd23131cc5760bc30a3cb9
    • Tamas Petz's avatar
      Add json files for other systems · 5a4819f0
      Tamas Petz authored
      This change adds json files for
        - glibc @ arm64
        - glibc @ x86_64
        - musl @ arm64
        - musl @ x86_64
      Change-Id: Ic423c1feb303e0649f80428a1ca31de5ab774da6
    • Tamas Petz's avatar
      Define local_sigaction_t in libshim · 41e53441
      Tamas Petz authored
      Because of differences in sizeof(sigset_t), we can't rely on
      libc's "view" of sigset_t. Libshim has to define the type the
      kernel ABI expects.
      Co-authored-by: Szabolcs Nagy's avatarSzabolcs Nagy <szabolcs.nagy@arm.com>
      Change-Id: I0b6409c1ca43e75210e0a368f6dac6a5d3c41968
    • Tamas Petz's avatar
      [rt_sigaction] Move SigActionHandlerRegistry · bef22285
      Tamas Petz authored
      This change moves SigActionHandlerRegistry from local static to
      global static scope. This way this registry is placed into .bss
      and so there is no need for C++ runtime, such as __cxa_guard*.
      Built and tested with FVP.
      Change-Id: I2989bf6cce03c13c07f927d92b7e98f5fd5f66de
    • Tamas Petz's avatar
      [generator] Only generate asm for bionic · 9a757458
      Tamas Petz authored
      Syscalls implemented in assembly are not needed for other libcs.
      Built and tested with FVP.
      Change-Id: I7fec7ad03a88b51e65e77bf98a398e02c9a26a1a
    • Tamas Petz's avatar
      Use system calls from the global namespace · 553c6f53
      Tamas Petz authored
      Without the scope resolution operator (SRO), mmap64 would not be
      found in case of musl libc. Be explicit that we want to call the
      libc's implementation, which is in the global scope,  so that
      compiler doesn't complain about mismatched parameter count.
      Without SRO, morello::shim::mmap() would be the candidate in case of
      musl. For bionic this works fine because it has a generated system
      call with the same name.
      Note that recursion into libshim is not possible in case of
      mmap and munmap libc calls.
      Built and tested with FVP.
      Change-Id: Ia4332e442a21186548aa751a8126605c2d1cc5b8