From patchwork Fri Dec 11 09:15:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maninder Singh X-Patchwork-Id: 11967771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 548E4C433FE for ; Fri, 11 Dec 2020 09:21:23 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA26A23F34 for ; Fri, 11 Dec 2020 09:21:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA26A23F34 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References: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:In-Reply-To:List-Owner; bh=w3HwHLT7Kcxy9EeRzIBGuwgl5oB0yRHCFdPKG1WUAXE=; b=I/lkq2hJJGQJDJUORJa5fvaqE2 exdcfMs0K+ZQcPA8EWL/MuXtdAk3X1mNCMFpKPhSXAX82QSAdFdFQQmRDhbDEvdqpFyyYvnw95daN HqUW38XENXcnCYECn9zo7ZbQR8hBAZ/hubB2qZn0bcBuNj+yxOZ77EXlEKT3ZltpisfMzPid5s8i2 KEEnyKIn2gwE/5wa5PTQoaKaSrkQIeQi61k5NI/DyVNcBo3tsX+jkNz2zj1YvHs8X5Vp9BHXu3kSS 1OZY7BMMmlZzBIx+mYj2Ti63KvtZaxPsb35VYnIitS2EJXrXl7kFznnW7kv9WlaamG+3kZv9OULQa 79f6RI1w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kneak-0006o6-5V; Fri, 11 Dec 2020 09:19:58 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kneah-0006nO-0R for linux-arm-kernel@lists.infradead.org; Fri, 11 Dec 2020 09:19:56 +0000 Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20201211091951epoutp0378fb3ffd31d0c6b6edb1e7e5d43ae1fc~PnvqbNF8H1672816728epoutp030 for ; Fri, 11 Dec 2020 09:19:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20201211091951epoutp0378fb3ffd31d0c6b6edb1e7e5d43ae1fc~PnvqbNF8H1672816728epoutp030 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1607678391; bh=ohgKPbsgCEs/Rg0yN/iTohBOMP6Lg1rrKl+Mg5HSpSY=; h=From:To:Cc:Subject:Date:References:From; b=UrGjLCkZ3NH/z1peNI1aDzNBZOCUmvOx4urm+vLeR5jMEwHOuByHvWgxy3ixqzeoN UcxXgH2DZt07PFKLNHr4i2vRdXSENxt3RgCb6onjG6rRtuUiTY5AAGV7FQfsxB0xl4 gK2dnjNCB7jAB0dVnanTInG1Vu7+LqmWXEDtRmM4= Received: from epsmges5p1new.samsung.com (unknown [182.195.42.73]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20201211091950epcas5p34ef5280f7b60cc5f58c9a0a23b68422e~Pnvpw4h5t2217522175epcas5p3o; Fri, 11 Dec 2020 09:19:50 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id B4.00.15682.6B933DF5; Fri, 11 Dec 2020 18:19:50 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20201211091546epcas5p24511325afff612d57306d733a3307648~PnsGxin2V1267412674epcas5p2N; Fri, 11 Dec 2020 09:15:46 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201211091546epsmtrp26e19eca5d4168b93bcaf894058062f31~PnsGwsQQ90753707537epsmtrp2y; Fri, 11 Dec 2020 09:15:46 +0000 (GMT) X-AuditID: b6c32a49-8bfff70000013d42-eb-5fd339b6775a Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 7E.01.13470.2C833DF5; Fri, 11 Dec 2020 18:15:46 +0900 (KST) Received: from localhost.localdomain (unknown [107.109.224.44]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201211091544epsmtip187cfebb6c98e4b7104bd267ff5b1d6a6~PnsEfxsaG0516605166epsmtip1d; Fri, 11 Dec 2020 09:15:44 +0000 (GMT) From: Maninder Singh To: catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, broonie@kernel.org, vincenzo.frascino@arm.com, samitolvanen@google.com, ardb@kernel.org, maz@kernel.org Subject: [PATCH 1/1] arm64/entry.S: check for stack overflow in el1 case only Date: Fri, 11 Dec 2020 14:45:31 +0530 Message-Id: <1607678131-20347-1-git-send-email-maninder1.s@samsung.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA0VSe0hTcRjtt3u9u4qLy7byU9NquR5KK6HyBj2MoiZFavRGnUsvWulam5YF paRZ6jSjF2WpPbS4ZNYmo7RVzMLMJS4xHayyMq2sdJmZ62FtV+m/c75zznfg4yMxoRP3I7er 0hiNSpkiIbxwY/2smbONC1sVc3U6oK11DD38rQ/Rp153EXRfpQ7R+rfPPejW2vMEXV+Wi9MV 7VYefed8owddce2zB21uvIBo059hnM6xzw8XyK+XXkfycn26XM/mEXLDlUx5UQ2L5AP6wChi q9eiRCZl+x5GM2dJvFfyb50eV7NkxlBxJS8LvSDykScJ1DzoLynE85EXKaTqEHQahzCXIKS+ IrAPhXDCdwQ3e4rwscSg8/5owoTAyB7hc+QbghGW5btcBCUDtvau2yWmqhHU245hLoJRlxA8 sz10t4uoSLDY9O5CnJKCadDsTguoVXCry+DB9QWCrTnPHQbqJR+uDB79R8h/ZAUUVAVxHhF8 bKjhc9gPBr6YCM6fjeDrvSrEkZMIKqyO0a1LoTc7i+dahFGzoLp2DjcOgFNPbvBcGKPGQ+HP Lh43F8Dt0jEshRzbzdE1/jDgcIweRg6vqgcRd71YqGsrJopRwLn/DeUIsciXUWtTkxjtfHWo itkr0ypTtemqJFnCrlQ9cr9HcMRt9KKzX2ZGPBKZEZCYRCwIwJ8phIJE5b79jGaXQpOewmjN yJ/EJT4CyQ9LnJBKUqYxOxlGzWjGVB7p6ZfFC/u1+oA64nSTWGsr11UmhnSM8GdG3wjzzWAT CnPDz5Z1BGo2Pbn79l3HB//3i3+x322e5dMOR4dtXCAaN2nl5UPrZrRhM5ZfHXm8cKulRKlU F1DiH8d3+6mSMzY8/dlyMbiSln6KWrv0kmJH98X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xfOKuJme3w7a+BZ17I9l/7/6qtc8bpP6zRDArK 133iN3LNuH/a4ePpx4cq88+/jY2U5U9x4lO2urR+ghJLcUaioRZzUXEiAC5Wb8myAgAA X-CMS-MailID: 20201211091546epcas5p24511325afff612d57306d733a3307648 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20201211091546epcas5p24511325afff612d57306d733a3307648 References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201211_041955_579224_D053652D X-CRM114-Status: GOOD ( 15.48 ) 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: v.narang@samsung.com, Maninder Singh , a.sahrawat@samsung.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org current code checks for sp bit flip in all exceptions, but only el1 exceptions requires this. el0 can not enter into stack overflow case directly. it will improve performance for el0 exceptions and interrupts. Signed-off-by: Maninder Singh Signed-off-by: Vaneet Narang --- arch/arm64/kernel/entry.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 2a93fa5..cad8faf 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -77,6 +77,7 @@ alternative_else_nop_endif sub sp, sp, #S_FRAME_SIZE #ifdef CONFIG_VMAP_STACK + .if \el == 1 /* * Test whether the SP has overflowed, without corrupting a GPR. * Task and IRQ stacks are aligned so that SP & (1 << THREAD_SHIFT) @@ -118,6 +119,7 @@ alternative_else_nop_endif /* We were already on the overflow stack. Restore sp/x0 and carry on. */ sub sp, sp, x0 mrs x0, tpidrro_el0 + .endif #endif b el\()\el\()_\label .endm