From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83EC9C433EF for ; Fri, 8 Oct 2021 07:43:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 4B9E061027 for ; Fri, 8 Oct 2021 07:43:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4B9E061027 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=D/2v/jDkh32+owG9umd6/3Q7ssjS9mn/tZlZywhGcPI=; b=AYiSM32mLpaX3q A87NWaAjS+ok+ZjVVNR+pHvMbe5rOA0VEUK/9Fw2GOITghhMngWBdsnPJz0QGMEcWSHHXVSTE37zZ CH6W0AvNU09rTfSRdtHWPXYnNmTwQbFeq9bzhU4QOleUmVkCaz9DTZaxmS1XSEWA3fTbpqBRSTgmD 55nfjLV3w6yeytf8U8TF7ZrhAZZ47frvwlSNfRnIdvPOchVBOhvs4Y1SC2ZRGmsW/2gA50w7At4qN BfCNzc1jcA9KzIFkJ0N+UACtQqa1NjtJQMEr57Kiltg72KFYA0DsGq9Dmt3rC0Dofvtx49xOo75On RHW2vK0YQZ9jsG+3Dd9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mYkVq-001tLe-B6; Fri, 08 Oct 2021 07:41:50 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mYkVm-001tKk-5T for linux-arm-kernel@lists.infradead.org; Fri, 08 Oct 2021 07:41:47 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5BEF760F9D; Fri, 8 Oct 2021 07:41:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633678903; bh=uTOLUQ2ksrvqosopB9SQBXCBS27tQggXi4txdKaKzkU=; h=From:To:Cc:Subject:Date:From; b=eIx9HthY4G9mUJ24n5wOvh8w7urJDvw5fSuM4DToPN2OE1TEB/NMROGv9QsXGlEme hn1nOUB97ggPUoh4T6Y5QFCbQGV+cfd0azXg+ir3jhyI54YhYc31F1fdMW7mpM9O+d O6Z+3P4Faq016B3I3pGjAQK0HYoFfKndeAJXDMhDDn9BisPI8ZlA3ZPNznrjtirSKo iPaf7CpxqlIB7tk0kJmILtXADtcWdCtQEaaOduGnLsVAea9EzhKD683TuTlW5i/NeJ SurcaVKXNEhPyrjy+mgfHRHDIRn+UxXquOiczsJsRZad/FqEFKDN8VPSkiRO+NZav2 VwAq+xY+YVsOA== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk Cc: Ard Biesheuvel , Nicolas Pitre , Arnd Bergmann , Kees Cook , Keith Packard , Linus Walleij Subject: [PATCH 0/5] ARM: add vmap'ed stack support Date: Fri, 8 Oct 2021 09:41:22 +0200 Message-Id: <20211008074127.435364-1-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3007; h=from:subject; bh=uTOLUQ2ksrvqosopB9SQBXCBS27tQggXi4txdKaKzkU=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBhX/YTRTX5v5BxIzkgS5GzZ1aya3l9h9JsCEeZ4Xmc Z2WgzruJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYV/2EwAKCRDDTyI5ktmPJEyyDA CYvfNjMRv2c9aUjhmDog1J1voFGIC8bOrIfwzFOAsgDXKT8eca7A0nG05pYGX3jDYqXc6P7oe1lCea qj7fiDSZNszOjAFTWrRFqOUVSLftN4ZtKR+GXu+AA7ms/CjMZMchPr/G3P3dgUJ3x5yZpXVY+LrAhP 8FxAr66XcekFFYXqcXnnTvkBiXY1ZSy96G53BhbgK4fxdfO8o/qphG0xvq6zF3gjRoqLrP5AfYQKEm OuK43hB0fw1V0bchynnkO30YLSSwJv3fdEi8ForexRzfjnvqxy10t5OmCsW7+7IMLHAjoFXSxtmwOK QoNNclOAesjnYZmlZXJRsPSTv+OAIeWpZjH/iZBNKSQ0zUbq+zQoy9pkgZDayXoTb4HKnwolEIXx+h 8Zcal8j42yfzCIBz9QY3OOD7MmB6wkU5mkePlCCjWT/p/7DDik9OVDjywF3HkHORthOfr0um+Mb0UY qG+mXpjoAsVIqYcbUfI4NEl4eKu6ddra/OLGrN0YpjsPE= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211008_004146_284783_7A093DBB X-CRM114-Status: GOOD ( 14.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This series enables support on ARM for vmap'ed task and IRQ stacks in the kernel. This is an important hardening feature that terminates tasks on inadvertent or deliberate accesses past the stack pointer, which might otherwise go completely unnoticed. Since having an accurate backtrace is especially important in such cases, this series includes some enhancements to the unwinder and to some hand rolled unwind info to increase the likelihood that a backtrace can be generated when relying on the ARM unwinder. The frame pointer unwinder turns out to be rather bullet proof in this context, and does not need any such enhancements. According to a quick survey I did, compiler generated code puts a single stack push as the first instruction in about 2/3 of the cases, which the unwinder can deal with after applying patch #4, even if this push faulted because of a stack overflow. In the remaining cases, the compiler tends to fall back to R11 or R7 as the frame pointer (on ARM or Thumb-2, respectively), or emit partial unwind frames for the part of the function that runs before the stack frame is set up, and the part that runs inside the stack frame. In either case, the unwinder can deal with such occurrences as they don't rely on the stack pointer directly. Patches #1, #2 and #3 update the ARM asm string routines to align more closely with the compiler's approach, increasing the likelihood that we can unwind them in case of a stack overflow. Patch #5 wires up the generic support, and adds the entry code to detect and deal with stack overflows. This series applies onto my IRQ stacks series sent out earlier: https://lore.kernel.org/linux-arm-kernel/20211005071542.3127341-1-ardb@kernel.org/ Cc: Russell King Cc: Nicolas Pitre Cc: Arnd Bergmann Cc: Kees Cook Cc: Keith Packard Cc: Linus Walleij Ard Biesheuvel (5): ARM: memcpy: use frame pointer as unwind anchor ARM: memmove: use frame pointer as unwind anchor ARM: memset: clean up unwind annotations ARM: unwind: disregard unwind info before stack frame is set up ARM: implement support for vmap'ed stacks arch/arm/Kconfig | 1 + arch/arm/include/asm/assembler.h | 4 ++ arch/arm/include/asm/page.h | 4 ++ arch/arm/include/asm/thread_info.h | 8 +++ arch/arm/kernel/entry-armv.S | 75 ++++++++++++++++++-- arch/arm/kernel/entry-header.S | 74 +++++++++++++++++++ arch/arm/kernel/irq.c | 9 ++- arch/arm/kernel/traps.c | 65 ++++++++++++++++- arch/arm/kernel/unwind.c | 17 ++++- arch/arm/kernel/vmlinux.lds.S | 4 +- arch/arm/lib/copy_template.S | 66 +++++++---------- arch/arm/lib/memmove.S | 60 ++++++---------- arch/arm/lib/memset.S | 7 +- 13 files changed, 295 insertions(+), 99 deletions(-) -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel