From patchwork Tue Jun 11 07:43:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Stancek X-Patchwork-Id: 1113559 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45NMSv2WBlz9sCJ for ; Tue, 11 Jun 2019 17:43:58 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id BA9633EAFF2 for ; Tue, 11 Jun 2019 09:43:53 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) by picard.linux.it (Postfix) with ESMTP id D57E13EAEBD for ; Tue, 11 Jun 2019 09:43:51 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 3480D1A0106F for ; Tue, 11 Jun 2019 09:43:50 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E2132F8BD9 for ; Tue, 11 Jun 2019 07:43:49 +0000 (UTC) Received: from dustball.brq.redhat.com (unknown [10.43.17.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8D635D6A9 for ; Tue, 11 Jun 2019 07:43:48 +0000 (UTC) From: Jan Stancek To: ltp@lists.linux.it Date: Tue, 11 Jun 2019 09:43:40 +0200 Message-Id: <2abbf8596a01ea056f6e7c9e6c481d67093cea0c.1560238866.git.jstancek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 11 Jun 2019 07:43:49 +0000 (UTC) X-Virus-Scanned: clamav-milter 0.99.2 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-3.smtp.seeweb.it Subject: [LTP] [PATCH] syscalls/ioctl_ns01: fix crash on aarch64 X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Test crashes with SIGBUS when using child stack. Align stack to 256 bytes, which is more than enough for any arch. Neither parent or library is waiting for child process. Add SIGCHLD to clone flags. Check return value of ltp_clone(), and TBROK on failure. Fix warning about unused *arg. Signed-off-by: Jan Stancek --- testcases/kernel/syscalls/ioctl/ioctl_ns01.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c index dfde4da6c5d6..625de9bd832d 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[STACK_SIZE] __attribute__((aligned(256))); static void setup(void) { @@ -53,7 +53,7 @@ static void test_ns_get_parent(void) } } -static int child(void *arg) +static int child(void *arg LTP_ATTRIBUTE_UNUSED) { test_ns_get_parent(); return 0; @@ -61,10 +61,14 @@ static int child(void *arg) static void run(void) { + int child_pid; + test_ns_get_parent(); - ltp_clone(CLONE_NEWPID, &child, 0, + child_pid = ltp_clone(CLONE_NEWPID | SIGCHLD, &child, 0, STACK_SIZE, child_stack); + if (child_pid == -1) + tst_brk(TBROK | TERRNO, "ltp_clone failed"); } static struct tst_test test = {