diff --git a/minix/servers/vfs/exec.c b/minix/servers/vfs/exec.c index 90e19c057..6d105e2de 100644 --- a/minix/servers/vfs/exec.c +++ b/minix/servers/vfs/exec.c @@ -740,7 +740,12 @@ static int map_header(struct vfs_exec_info *execi) int r; size_t cum_io; off_t pos, new_pos; - static char hdr[PAGE_SIZE]; /* Assume that header is not larger than a page */ + /* Assume that header is not larger than a page. Align the buffer reasonably + * well, because libexec casts it to a structure directly and therefore + * expects it to be aligned appropriately. From here we can only guess the + * proper alignment, but 64 bits should work for all versions of ELF.. + */ + static char hdr[PAGE_SIZE] __aligned(8); pos = 0; /* Read from the start of the file */ diff --git a/minix/servers/vm/main.c b/minix/servers/vm/main.c index b6b305698..884fb43e1 100644 --- a/minix/servers/vm/main.c +++ b/minix/servers/vm/main.c @@ -333,7 +333,8 @@ static void exec_bootproc(struct vmproc *vmp, struct boot_image *ip) { struct vm_exec_info vmexeci; struct exec_info *execi = &vmexeci.execi; - char hdr[VM_PAGE_SIZE]; + /* libexec need proper alignment for casting to structures */ + char hdr[VM_PAGE_SIZE] __aligned(8); size_t frame_size = 0; /* Size of the new initial stack. */ int argc = 0; /* Argument count. */