util: Add missing gettimeofday to syscall sandbox #23299

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:2110-timeSys changing 1 files +19 −18
  1. MarcoFalke commented at 9:14 am on October 18, 2021: member

    Fixes:

    02021-10-18T09:12:31Z [init] [httpserver.cpp:181] [InitHTTPAllowList] Allowing HTTP connections from: 127.0.0.0/8 ::1/128 
    12021-10-18T09:12:31Z [init] [util/syscall_sandbox.cpp:487] [SyscallSandboxDebugSignalHandler] ERROR: The syscall "gettimeofday" (syscall number 96) is not allowed by the syscall sandbox in thread "init". Please report.
    
  2. practicalswift commented at 9:49 am on October 18, 2021: contributor

    What environment/configuration is this? Interesting that we haven’t encountered this earlier :)

    I guess one reason we haven’t seen this one earlier is that the library function gettimeofday can be implemented using the syscall clock_gettime (instead of the actual gettimeofday syscall).

  3. in src/util/syscall_sandbox.cpp:180 in fa4ae9d0de outdated
    176@@ -177,6 +177,7 @@ const std::map<uint32_t, std::string> LINUX_SYSCALLS{
    177     {__NR_geteuid, "geteuid"},
    178     {__NR_getgid, "getgid"},
    179     {__NR_getgroups, "getgroups"},
    180+    {__NR_gettimeofday, "gettimeofday"},
    


    practicalswift commented at 9:54 am on October 18, 2021:
    Note that __NR_gettimeofday is already included in LINUX_SYSCALLS below (after gettid).

    MarcoFalke commented at 10:11 am on October 18, 2021:
    Should this list be sorted?

    practicalswift commented at 10:44 am on October 18, 2021:
    Yes, absolutely :)

    MarcoFalke commented at 10:25 am on October 19, 2021:
    Thanks, sorted.
  4. DrahtBot added the label Utils/log/libs on Oct 18, 2021
  5. laanwj commented at 12:28 pm on October 18, 2021: member
    Code review ACK fa4ae9d0de7b99bae934bb4ae7ce6739d050fe6f Some context: normally the DSO (kernel shared object) takes care of gettimeofday. This is much faster as the time is in a shared mapped page. However, if this isn’t available for some reason, libc take the slow path by calling the actual system call.
  6. laanwj renamed this:
    Add missing gettimeofday to syscall sandbox
    util: Add missing gettimeofday to syscall sandbox
    on Oct 18, 2021
  7. practicalswift commented at 12:48 pm on October 18, 2021: contributor

    More context:

     0       Why does the vDSO exist at all?  There are some system calls the
     1       kernel provides that user-space code ends up using frequently, to
     2       the point that such calls can dominate overall performance.  This
     3       is due both to the frequency of the call as well as the context-
     4       switch overhead that results from exiting user space and entering
     5       the kernel.
     6...
     7       One frequently used system call is gettimeofday(2).  This system
     8       call is called both directly by user-space applications as well
     9       as indirectly by the C library.  Think timestamps or timing loops
    10       or pollingall of these frequently need to know what time it is
    11       right now.  This information is also not secretany application
    12       in any privilege mode (root or any unprivileged user) will get
    13       the same answer.  Thus the kernel arranges for the information
    14       required to answer this question to be placed in memory the
    15       process can access.  Now a call to gettimeofday(2) changes from a
    16       system call to a normal function call and a few memory accesses.
    17...
    18   x86-64 functions
    19       The table below lists the symbols exported by the vDSO.  All of
    20       these symbols are also available without the "__vdso_" prefix,
    21       but you should ignore those and stick to the names below.
    22
    23       symbol                 version
    24       ─────────────────────────────────
    25       __vdso_clock_gettime   LINUX_2.6
    26       __vdso_getcpu          LINUX_2.6
    27       __vdso_gettimeofday    LINUX_2.6
    28       __vdso_time            LINUX_2.6
    

    From https://man7.org/linux/man-pages/man7/vdso.7.html

  8. practicalswift commented at 8:54 am on October 19, 2021: contributor

    Concept ACK (obviously)

    And cr ACK once the removal of the duplicate LINUX_SYSCALLS is done :)

  9. MarcoFalke commented at 10:22 am on October 19, 2021: member

    What environment/configuration is this? Interesting that we haven’t encountered this earlier :)

    It might be required to change the timezone or so?

  10. Add missing gettimeofday to syscall sandbox
    Also, sort entries. Can be reviewed with: --color-moved=dimmed-zebra
    faf13e272c
  11. MarcoFalke force-pushed on Oct 19, 2021
  12. MarcoFalke added the label DrahtBot Guix build requested on Oct 19, 2021
  13. practicalswift commented at 11:58 am on October 19, 2021: contributor
    cr ACK faf13e272cad44917c4e5516172617fe8d68c00a
  14. MarcoFalke merged this on Oct 20, 2021
  15. MarcoFalke closed this on Oct 20, 2021

  16. MarcoFalke deleted the branch on Oct 20, 2021
  17. sidhujag referenced this in commit 1b989a6fce on Oct 20, 2021
  18. DrahtBot commented at 2:37 am on October 21, 2021: member

    Guix builds

    File commit 2d2516196bd2d9d9a60117df72518620151214f4(master) commit dc468a644755818200105bc247da418504f5bb35(master and this pull)
    SHA256SUMS.part b862268575c288ac... 3a98ba603aeb51b0...
    *-aarch64-linux-gnu-debug.tar.gz 428e4c254d0aa81c... c7f8c1b61c510e1d...
    *-aarch64-linux-gnu.tar.gz 51c4e4725ed369d0... 0143f1ea9fe0c0dd...
    *-arm-linux-gnueabihf-debug.tar.gz 505dae065c2164ff... ddce2ffb8b052b7f...
    *-arm-linux-gnueabihf.tar.gz 8426d3081f5841ec... 928d6de95962cba2...
    *-osx-unsigned.dmg 624ab5d870c35361... 9e636fb19fdb4b29...
    *-osx-unsigned.tar.gz 809e271e6aed6e29... 0b71ad0a66151d74...
    *-osx64.tar.gz 2218a82b1ebefb6d... 8fcdb3df100e796d...
    *-powerpc64-linux-gnu-debug.tar.gz 6bb87ae94a0377f3... 64329f4b1e04728d...
    *-powerpc64-linux-gnu.tar.gz 57ad2e46466c3316... 4dfdf37464995f64...
    *-powerpc64le-linux-gnu-debug.tar.gz ad68c0fb940347d7... 8f55064022a07fd9...
    *-powerpc64le-linux-gnu.tar.gz bfc895fb6122b58a... 2a004006ccfd2798...
    *-riscv64-linux-gnu-debug.tar.gz e02ec039b4d2d982... 6da997601d0f7856...
    *-riscv64-linux-gnu.tar.gz 68eba7584cd4fefc... ad76e1dc376387d1...
    *-win-unsigned.tar.gz 75c5e5c8e0adfa39... 58f995464d8ca249...
    *-win64-debug.zip c129da7fbb9dd787... d24125b4d363bb06...
    *-win64-setup-unsigned.exe eb2e4b19404c9e3f... 08fc1b14fe033a94...
    *-win64.zip 60062e6435a444f8... 04d3b7aeab2336e2...
    *-x86_64-linux-gnu-debug.tar.gz 707949b99d3d5937... e5e03bdeafd8565f...
    *-x86_64-linux-gnu.tar.gz dc0f2171d017a740... b3c422469aa545bd...
    *.tar.gz a5b62f633879dc24... 37af554787f336ec...
    guix_build.log f4de0841efeec33e... b190f7d0029e0f6d...
    guix_build.log.diff 750f9f29b717b6d3...
  19. DrahtBot removed the label DrahtBot Guix build requested on Oct 21, 2021
  20. DrahtBot locked this on Oct 30, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-04 13:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me