aboutgitcodebugslistschat
path: root/pasta.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2024-04-11 17:48:23 +0200
committerStefano Brivio <sbrivio@redhat.com>2024-04-19 11:15:27 +0200
commitee338a256ee8dff064fd3920a2efe642ef1d3cfa (patch)
tree3b095ced1ff29ea9a872d0e8408a1fe523bb5561 /pasta.c
parent5d5208b67d4e4dfb4098495620591c73ac3de50d (diff)
downloadpasst-ee338a256ee8dff064fd3920a2efe642ef1d3cfa.tar
passt-ee338a256ee8dff064fd3920a2efe642ef1d3cfa.tar.gz
passt-ee338a256ee8dff064fd3920a2efe642ef1d3cfa.tar.bz2
passt-ee338a256ee8dff064fd3920a2efe642ef1d3cfa.tar.lz
passt-ee338a256ee8dff064fd3920a2efe642ef1d3cfa.tar.xz
passt-ee338a256ee8dff064fd3920a2efe642ef1d3cfa.tar.zst
passt-ee338a256ee8dff064fd3920a2efe642ef1d3cfa.zip
pasta, util: Align stack area for clones to maximum natural alignment
Given that we use this stack pointer as a location to store arbitrary data types from the cloned process, we need to guarantee that its alignment matches any of those possible data types. runsisi reports that pasta gets a SIGBUS in pasta_open_ns() on aarch64, where the alignment requirement for stack pointers is a 16 bytes (same as the size of a long double), and similar requirements actually apply to most architectures we run on. Reported-by: runsisi <runsisi@hust.edu.cn> Link: https://bugs.passt.top/show_bug.cgi?id=85 Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'pasta.c')
-rw-r--r--pasta.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pasta.c b/pasta.c
index e73b5af..31e1e00 100644
--- a/pasta.c
+++ b/pasta.c
@@ -211,12 +211,13 @@ static int pasta_spawn_cmd(void *arg)
void pasta_start_ns(struct ctx *c, uid_t uid, gid_t gid,
int argc, char *argv[])
{
+ char ns_fn_stack[NS_FN_STACK_SIZE]
+ __attribute__ ((aligned(__alignof__(max_align_t))));
struct pasta_spawn_cmd_arg arg = {
.exe = argv[0],
.argv = argv,
};
char uidmap[BUFSIZ], gidmap[BUFSIZ];
- char ns_fn_stack[NS_FN_STACK_SIZE];
char *sh_argv[] = { NULL, NULL };
char sh_arg0[PATH_MAX + 1];
sigset_t set;