Summary: | pasta SIGBUS error on aarch64 | ||
---|---|---|---|
Product: | passt | Reporter: | runsisi <runsisi> |
Component: | pasta | Assignee: | Stefano Brivio <sbrivio> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | runsisi, sbrivio |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux |
Description
runsisi
2024-04-11 07:29:58 UTC
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. |