[LTP] [PATCH v3 3/3] syscalls/ioctl_ns0[156]: align stack and wait for child
Li Wang
liwang@redhat.com
Thu Jun 13 10:25:52 CEST 2019
On Thu, Jun 13, 2019 at 3:25 PM Jan Stancek <jstancek@redhat.com> wrote:
> Test crashes (SIGBUS) when using child stack have been observed for
> ioctl_ns01. This is because stack isn't aligned. Use ltp_alloc_stack()
> for stack allocation.
>
> Add SIGCHLD to clone flags, so that LTP library can reap all children
> and check their return code. Also check ltp_clone() return value.
>
> Suppress warning for unused *arg in child().
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
> testcases/kernel/syscalls/ioctl/ioctl_ns01.c | 13 +++++++++----
> testcases/kernel/syscalls/ioctl/ioctl_ns05.c | 12 +++++++++---
> testcases/kernel/syscalls/ioctl/ioctl_ns06.c | 15 +++++++++++----
> 3 files changed, 29 insertions(+), 11 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
> b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
> index dfde4da6c5d6..d241a5d0fa53 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
> @@ -23,7 +23,7 @@
>
> #define STACK_SIZE (1024 * 1024)
>
> -static char child_stack[STACK_SIZE];
> +static char *child_stack;
>
> static void setup(void)
> {
> @@ -31,6 +31,10 @@ static void setup(void)
>
> if (exists < 0)
> tst_res(TCONF, "namespace not available");
> +
> + child_stack = ltp_alloc_stack(STACK_SIZE);
>
As you commented that "User is responsible for freeing allocated memory",
but you forget to do that in each of these test cases :).
We need free(child_stack) in the cleanup function.
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190613/898bdd4e/attachment.html>
More information about the ltp
mailing list