On architecture that are not able to handle in hardware misaligned access, it could cause the application to be killed by a SIGBUS
So, the following simple assignment void *test; *(int *)test = stat_i; causes on SH4 the following error: Unaligned userspace access in "shmctl01" pid=8547 pc=0x0040221a ins=0x400b Sending SIGBUS to "shmctl01" due to unaligned access (PC 40221a PR 40221e) Using a 'memcpy' is safe. Signed-off-by: Carmelo Amoroso <[email protected]> --- testcases/kernel/syscalls/ipc/shmctl/shmctl01.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c index a37599a..38dcc12 100644 --- a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c +++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c @@ -325,7 +325,7 @@ void do_child() tst_brkm(TBROK, cleanup, "sync_pipe_close failed"); /* do an assignement for fun */ - *(int *)test = stat_i; + memcpy(test, &stat_i, sizeof(stat_i)); /* pause until we get a signal from stat_cleanup() */ rval = pause(); -- 1.7.4.4 ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
