when called by podman, pasta failed with exit code -1, this is the stacktrace of pasta: ```sh $ sudo coredumpctl debug 1649827 PID: 1649827 (pasta) UID: 1001 (runsisi) GID: 1001 (runsisi) Signal: 7 (BUS) Timestamp: Thu 2024-04-11 14:53:48 CST (2min 9s ago) Command Line: /usr/bin/pasta --config-net --dns-forward 169.254.0.1 -t none -u none -T none -U none --no-map-gw --quiet --netns /run/user/1001/netns/netns-d134910b-6a9b-0c82-16c1-b85bb74a2dfe Executable: /usr/bin/passt Control Group: /user.slice/user-1001.slice/user@1001.service/user.slice/podman-1649557.scope Unit: user@1001.service User Unit: podman-1649557.scope Slice: user-1001.slice Owner UID: 1001 (runsisi) Boot ID: 69d84a88167948558f44abd517c23c1f Machine ID: 05abaa75ced4478c8cfed53f013fb30c Hostname: xstack Storage: /var/lib/systemd/coredump/core.pasta.1001.69d84a88167948558f44abd517c23c1f.1649827.1712818428000000000000.lz4 Message: Process 1649827 (pasta) of user 1001 dumped core. Stack trace of thread 1649827: #0 0x0000aaadc596e590 ns_check (passt) #1 0x0000fffd1395a1ec thread_start (libc.so.6) Stack trace of thread 1649826: #0 0x0000fffd1395a1c0 __clone (libc.so.6) #1 0x0000aaadc596e8c4 pasta_open_ns (passt) #2 0x0000aaadc596724c conf (passt) #3 0x0000aaadc5963434 main (passt) #4 0x0000fffd138a3fe0 __libc_start_main (libc.so.6) #5 0x0000aaadc5963be4 $x (passt) #6 0x0000aaadc5963be4 $x (passt) ``` run pasta on its own fails too: ```sh $ ./pasta Multiple interfaces with IPv6 routes, use -i to select one Couldn't pick external interface: disabling IPv6 Bus error ``` aarch64 requires stack pointer aligns to 16 bytes[1], `clone` may not properly aligned: ```c // util.c int do_clone(int (*fn)(void *), char *stack_area, size_t stack_size, int flags, void *arg) { #ifdef __ia64__ return __clone2(fn, stack_area + stack_size / 2, stack_size / 2, flags, arg); #else return clone(fn, stack_area + stack_size / 2, flags, arg); #endif } ``` [1] How do I parse ARM64 assembly SIGBUS error? https://stackoverflow.com/questions/72724797/how-do-i-parse-arm64-assembly-sigbus-error
Thanks for reporting this, runsisi. (In reply to runsisi from comment #0) > [...] > > aarch64 requires stack pointer aligns to 16 bytes[1] Right, I forgot about that. Could you try with this quick patch: diff --git a/pasta.c b/pasta.c index 61feaa9..c70c1d1 100644 --- a/pasta.c +++ b/pasta.c @@ -216,7 +216,7 @@ void pasta_start_ns(struct ctx *c, uid_t uid, gid_t gid, .argv = argv, }; char uidmap[BUFSIZ], gidmap[BUFSIZ]; - char ns_fn_stack[NS_FN_STACK_SIZE]; + char ns_fn_stack[NS_FN_STACK_SIZE] __attribute__ ((aligned(16))); char *sh_argv[] = { NULL, NULL }; char sh_arg0[PATH_MAX + 1]; sigset_t set; ? I can otherwise have a look in a bit.
it works :) thanks! ```diff diff --git a/pasta.c b/pasta.c index 61feaa9..c70c1d1 100644 --- a/pasta.c +++ b/pasta.c @@ -216,7 +216,7 @@ void pasta_start_ns(struct ctx *c, uid_t uid, gid_t gid, .argv = argv, }; char uidmap[BUFSIZ], gidmap[BUFSIZ]; - char ns_fn_stack[NS_FN_STACK_SIZE]; + char ns_fn_stack[NS_FN_STACK_SIZE] __attribute__ ((aligned(16))); char *sh_argv[] = { NULL, NULL }; char sh_arg0[PATH_MAX + 1]; sigset_t set; diff --git a/util.h b/util.h index 7c261d7..3bfb4e7 100644 --- a/util.h +++ b/util.h @@ -116,7 +116,7 @@ int do_clone(int (*fn)(void *), char *stack_area, size_t stack_size, int flags, void *arg); #define NS_CALL(fn, arg) \ do { \ - char ns_fn_stack[NS_FN_STACK_SIZE]; \ + char ns_fn_stack[NS_FN_STACK_SIZE] __attribute__ ((aligned(16))); \ \ do_clone((fn), ns_fn_stack, sizeof(ns_fn_stack), \ CLONE_VM | CLONE_VFORK | CLONE_FILES | SIGCHLD,\ ```
Patch pending review (a re-test would be appreciated too) at: https://archives.passt.top/passt-dev/20240411221800.548140-1-sbrivio@redhat.com/
applied the patch: ```sh $ b4 am -o- https://archives.passt.top/passt-dev/20240411221800.548140-1-sbrivio@redhat.com/ | git am ``` and tested on aarch64 & amd64, no SIGBUS error anymore.
Thanks!
Fixed in commit ee338a256ee8 ("pasta, util: Align stack area for clones to maximum natural alignment"), released in 2024_04_26.d03c4e2.