mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-08-03 07:12:48 +00:00
define macro for stack alignment
Replace stack alignment magic constant with __stack_aligned__ macro. Also align stack for sigaltstack test case. Signed-off-by: Vijaya Kumar K <vijayak@caviumnetworks.com> Reviewed-by: Christopher Covington <cov@codeaurora.org> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
831f7b9191
commit
8a7c006bdd
13 changed files with 25 additions and 12 deletions
|
|
@ -808,7 +808,7 @@ struct clone_arg {
|
|||
* Reserve some space for clone() to locate arguments
|
||||
* and retcode in this place
|
||||
*/
|
||||
char stack[128] __attribute__((aligned (16)));
|
||||
char stack[128] __stack_aligned__;
|
||||
char stack_ptr[0];
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1075,7 +1075,7 @@ struct cr_clone_arg {
|
|||
* Reserve some space for clone() to locate arguments
|
||||
* and retcode in this place
|
||||
*/
|
||||
char stack[128] __attribute__((aligned (16)));
|
||||
char stack[128] __stack_aligned__;
|
||||
char stack_ptr[0];
|
||||
struct pstree_item *item;
|
||||
unsigned long clone_flags;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,12 @@
|
|||
|
||||
#define __aligned(x) __attribute__((aligned(x)))
|
||||
|
||||
/*
|
||||
* Macro to define stack alignment.
|
||||
* aarch64 requires stack to be aligned to 16 bytes.
|
||||
*/
|
||||
#define __stack_aligned__ __attribute__((aligned(16)))
|
||||
|
||||
#ifndef offsetof
|
||||
# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ struct restore_mem_zone {
|
|||
u8 redzone[RESTORE_STACK_REDZONE];
|
||||
u8 stack[RESTORE_STACK_SIZE];
|
||||
u8 rt_sigframe[RESTORE_STACK_SIGFRAME];
|
||||
} __aligned(16);
|
||||
} __stack_aligned__;
|
||||
|
||||
struct rst_sched_param {
|
||||
int policy;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#include <sched.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "zdtmtst.h"
|
||||
#include "ns.h"
|
||||
|
||||
extern int pivot_root(const char *new_root, const char *put_old);
|
||||
|
|
@ -143,7 +144,7 @@ static int prepare_namespaces(void)
|
|||
|
||||
/* All arguments should be above stack, because it grows down */
|
||||
struct ns_exec_args {
|
||||
char stack[NS_STACK_SIZE] __attribute__((aligned (16)));
|
||||
char stack[NS_STACK_SIZE] __stack_aligned__;
|
||||
char stack_ptr[0];
|
||||
int argc;
|
||||
char **argv;
|
||||
|
|
|
|||
|
|
@ -99,6 +99,12 @@ extern int parse_opt_string(char *param, void *arg);
|
|||
#define __stringify_1(x) #x
|
||||
#define __stringify(x) __stringify_1(x)
|
||||
|
||||
/*
|
||||
* Macro to define stack alignment.
|
||||
* aarch64 requires stack to be aligned to 16 bytes.
|
||||
*/
|
||||
#define __stack_aligned__ __attribute__((aligned(16)))
|
||||
|
||||
/* message helpers */
|
||||
extern int test_log_init(const char *outfile, const char *suffix);
|
||||
extern int zdtm_seccomp;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ static void wait_children()
|
|||
|
||||
static pid_t clone_child(int (*fn)(void *), int flags)
|
||||
{
|
||||
char stack[STACK_SIZE] __attribute__((aligned (16)));
|
||||
char stack[STACK_SIZE] __stack_aligned__;
|
||||
pid_t pid;
|
||||
|
||||
pid = clone(fn, stack + STACK_SIZE,
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ TEST_OPTION(dirname, string, "directory name", 1);
|
|||
#define NS_STACK_SIZE 4096
|
||||
/* All arguments should be above stack, because it grows down */
|
||||
struct ns_exec_args {
|
||||
char stack[NS_STACK_SIZE] __attribute__((aligned (16)));
|
||||
char stack[NS_STACK_SIZE] __stack_aligned__;
|
||||
char stack_ptr[0];
|
||||
int fd;
|
||||
int sync;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ char fpath[PATH_MAX];
|
|||
#define NS_STACK_SIZE 4096
|
||||
/* All arguments should be above stack, because it grows down */
|
||||
struct ns_exec_args {
|
||||
char stack[NS_STACK_SIZE] __attribute__((aligned (16)));
|
||||
char stack[NS_STACK_SIZE] __stack_aligned__;
|
||||
char stack_ptr[0];
|
||||
int fd;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ static char buf[1024];
|
|||
#define NS_STACK_SIZE 4096
|
||||
/* All arguments should be above stack, because it grows down */
|
||||
struct ns_exec_args {
|
||||
char stack[NS_STACK_SIZE] __attribute__((aligned (16)));
|
||||
char stack[NS_STACK_SIZE] __stack_aligned__;
|
||||
char stack_ptr[0];
|
||||
int status_pipe[2];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ static void mainloop()
|
|||
#define CLONE_STACK_SIZE 4096
|
||||
/* All arguments should be above stack, because it grows down */
|
||||
struct clone_args {
|
||||
char stack[CLONE_STACK_SIZE] __attribute__((aligned (16)));
|
||||
char stack[CLONE_STACK_SIZE] __stack_aligned__;
|
||||
char stack_ptr[0];
|
||||
int id;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ static void mainloop()
|
|||
#define CLONE_STACK_SIZE 4096
|
||||
/* All arguments should be above stack, because it grows down */
|
||||
struct clone_args {
|
||||
char stack[CLONE_STACK_SIZE] __attribute__((aligned (16)));
|
||||
char stack[CLONE_STACK_SIZE] __stack_aligned__;
|
||||
char stack_ptr[0];
|
||||
int id;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
const char *test_doc = "Check for alternate signal stack";
|
||||
const char *test_author = "Cyrill Gorcunov <gorcunov@openvz.org>";
|
||||
|
||||
static char stack_thread[SIGSTKSZ + TEST_MSG_BUFFER_SIZE];
|
||||
static char stack_main[SIGSTKSZ + TEST_MSG_BUFFER_SIZE];
|
||||
static char stack_thread[SIGSTKSZ + TEST_MSG_BUFFER_SIZE] __stack_aligned__;
|
||||
static char stack_main[SIGSTKSZ + TEST_MSG_BUFFER_SIZE] __stack_aligned__;
|
||||
|
||||
enum {
|
||||
SAS_MAIN_OLD,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue