summaryrefslogtreecommitdiff
path: root/tools/pcmcia
diff options
context:
space:
mode:
authorAxel Rasmussen <axelrasmussen@google.com>2022-01-28 00:29:51 +0300
committerShuah Khan <skhan@linuxfoundation.org>2022-02-04 23:06:39 +0300
commit4cbd93c3c110447adc66cb67c08af21f939ae2d7 (patch)
tree13021c89ef3980c9cd3e950787912bb4c3f6e41f /tools/pcmcia
parentec049891b2dc16591813eacaddc476b3d27c8c14 (diff)
downloadlinux-4cbd93c3c110447adc66cb67c08af21f939ae2d7.tar.xz
pidfd: fix test failure due to stack overflow on some arches
When running the pidfd_fdinfo_test on arm64, it fails for me. After some digging, the reason is that the child exits due to SIGBUS, because it overflows the 1024 byte stack we've reserved for it. To fix the issue, increase the stack size to 8192 bytes (this number is somewhat arbitrary, and was arrived at through experimentation -- I kept doubling until the failure no longer occurred). Also, let's make the issue easier to debug. wait_for_pid() returns an ambiguous value: it may return -1 in all of these cases: 1. waitpid() itself returned -1 2. waitpid() returned success, but we found !WIFEXITED(status). 3. The child process exited, but it did so with a -1 exit code. There's no way for the caller to tell the difference. So, at least log which occurred, so the test runner can debug things. While debugging this, I found that we had !WIFEXITED(), because the child exited due to a signal. This seems like a reasonably common case, so also print out whether or not we have WIFSIGNALED(), and the associated WTERMSIG() (if any). This lets us see the SIGBUS I'm fixing clearly when it occurs. Finally, I'm suspicious of allocating the child's stack on our stack. man clone(2) suggests that the correct way to do this is with mmap(), and in particular by setting MAP_STACK. So, switch to doing it that way instead. Signed-off-by: Axel Rasmussen <axelrasmussen@google.com> Acked-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/pcmcia')
0 files changed, 0 insertions, 0 deletions