From patchwork Thu Jun 13 11:13:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 10991575 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A133514C0 for ; Thu, 13 Jun 2019 11:16:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8929A28B9F for ; Thu, 13 Jun 2019 11:16:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78F0328BA1; Thu, 13 Jun 2019 11:16:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0FF6428B9F for ; Thu, 13 Jun 2019 11:15:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=PlRLLEsExNFOQ9gmONVVeSnM+4WrdTPSlziXH7Jozyc=; b=YKTm5T8s3tglUcVRnQaD+1D9AB qeFhYo6A7NsZ9RIjZpbOJWkZillLiVqktV6m8VSTzxMM7lT1nDNbtpzb6AVipDuZrnnwlYdjUkIyO Hw0mTV4P30IUaUvSJlD9TWsUwXqXAVIGscktYxqOKQVNf4bR0ljC8L4sBNJju/oTw2fupHs/79fVH MMLw0S1ECw3eo2rmzJ+C1s4wLs/G6vEjSXQmvnNFKf/hhpXBsG7U0tIdbbG1x+64nxSD+gCE6Ao/k Rkz4zax4bWsEC9TsOp6uU/xnrXmfZcLIhkJsyiUP9vV4bGy8m1ECHS+yEy8J5AioD1NBx5Su0xPzN UYCN5mhQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hbNhy-0001uX-34; Thu, 13 Jun 2019 11:15:54 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hbNgY-0007W2-9F for linux-arm-kernel@lists.infradead.org; Thu, 13 Jun 2019 11:14:28 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 34BC93EF; Thu, 13 Jun 2019 04:14:25 -0700 (PDT) Received: from e120937-lin.cambridge.arm.com (e120937-lin.cambridge.arm.com [10.1.197.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BACEB3F694; Thu, 13 Jun 2019 04:16:07 -0700 (PDT) From: Cristian Marussi To: linux-kselftest@vger.kernel.org, linux-arm-kernel@lists.infradead.org, shuah@kernel.org Subject: [PATCH 03/13] kselftest: arm64: mangle_sp_misaligned Date: Thu, 13 Jun 2019 12:13:25 +0100 Message-Id: <20190613111335.7645-4-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190613111335.7645-1-cristian.marussi@arm.com> References: <20190613111335.7645-1-cristian.marussi@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190613_041426_615316_99D567D7 X-CRM114-Status: GOOD ( 10.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andreyknvl@google.com, dave.martin@arm.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Added a simple mangle testcase which messes with the ucontext_t from within the sig_handler, trying to badly modify and misalign the SP. Expects SIGBUS on test PASS. Signed-off-by: Cristian Marussi --- .../arm64/signal/testcases/.gitignore | 1 + .../signal/testcases/mangle_sp_misaligned.c | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tools/testing/selftests/arm64/signal/testcases/.gitignore create mode 100644 tools/testing/selftests/arm64/signal/testcases/mangle_sp_misaligned.c diff --git a/tools/testing/selftests/arm64/signal/testcases/.gitignore b/tools/testing/selftests/arm64/signal/testcases/.gitignore new file mode 100644 index 000000000000..7f7414d241f2 --- /dev/null +++ b/tools/testing/selftests/arm64/signal/testcases/.gitignore @@ -0,0 +1 @@ +mangle_sp_misaligned diff --git a/tools/testing/selftests/arm64/signal/testcases/mangle_sp_misaligned.c b/tools/testing/selftests/arm64/signal/testcases/mangle_sp_misaligned.c new file mode 100644 index 000000000000..41bd27312e54 --- /dev/null +++ b/tools/testing/selftests/arm64/signal/testcases/mangle_sp_misaligned.c @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2019 ARM Limited */ + +#include "test_signals_utils.h" +#include "testcases.h" + +static int mangle_misaligned_sp_run(struct tdescr *td, siginfo_t *si, + ucontext_t *uc) +{ + ASSERT_GOOD_CONTEXT(uc); + + uc->uc_mcontext.sp += 3; + + return 1; +} + +struct tdescr tde = { + .sanity_disabled = true, + .name = "MANGLE_SP_MISALIGNED", + .descr = "Mangling uc_mcontext with MISALIGNED SP", + .sig_trig = SIGUSR1, + .sig_ok = SIGBUS, + .run = mangle_misaligned_sp_run, +};