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 X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 6F3BFC3A5A9 for ; Mon, 4 May 2020 13:36:53 +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 448492078E for ; Mon, 4 May 2020 13:36:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XNIPkK9H"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="MFsfPZ/E" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 448492078E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date: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=dAXfz1BPPCZKWdL8fzfAAlfsXP8IbRTVc+wIEqlRaSE=; b=XNIPkK9Hdp0HUw vzQ7pnfXPwbsUo4JZhYQJmrkKjHsE34Og3kqsDCS/NTfdQwbNqB4jKLg4HWNf29kIx2SNKwwseRSu jQ/NOvoA9M8y8cfVJ/LysxWvqS+En+/TgjQ3FUNrqQLB+BnOZ8e1ld8v/hp++gRGNb1RCT7rknR9k toIscG2Y6s18uLpM0AhmxPgJo+Hc45ko7gl5eda2Fpnnv2k7nETEv8xMk0PtPQ98XbLuv43PnCGNO PNpxWdXHNMzqzlyiY5p0TXPdjknvcQvpZ/EW/rLhH9FP1OiiqCr/m9TCO8msoEJe22EI8j00q2cGV xEzgPzGqxNQ8KMCcACEQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVbH9-0007DZ-VQ; Mon, 04 May 2020 13:36:51 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVbH6-0004SI-UA for linux-arm-kernel@lists.infradead.org; Mon, 04 May 2020 13:36:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:Content-Type:MIME-Version: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=SzjxIqW2peLnUR0XEi6Nu0WuMEtAymQepnCQFPPHy2k=; b=MFsfPZ/ETb4lJ4HP2BQoyXSuf 9JbaxT1ySghoe+bg8dvz+v8lHgu11dkTSLF3A27NkSWoRwBoLGRT9+H4dkTtRVEQq2YHTDonT+g4f /R5d6VtN2Q0kc26F6d1yEMIF0sGWparOhAkORReUaP/CN6UsIxw6IZPGA0+PVsdi4Y2daDOuzhXE7 Ee6nncuD6JRb8To4nzlZJT05RlKH18VXqTF7BGSzeKTk+Sib8xiRluseyeITXQMVa8ZizAcP/8bes OMynzEVG51Z+cv3bjmnrP5O55/bieL1hH1Anlm/OMJbrsK7609+wtaedJEdFaBN5RcVIYGOBK/kXl /8DstwOQg==; Received: from shell.armlinux.org.uk ([2002:4e20:1eda:1:5054:ff:fe00:4ec]:53626) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVbEz-0004tK-I7; Mon, 04 May 2020 14:34:37 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1jVbEx-0006An-UD; Mon, 04 May 2020 14:34:35 +0100 Date: Mon, 4 May 2020 14:34:35 +0100 From: Russell King - ARM Linux admin To: linux-arm-kernel@lists.infradead.org, Tomas Paukrt Subject: [PATCH 0/3] Fix uaccess kernel protection on ARMv5 and earlier Message-ID: <20200504133435.GD1551@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_063648_977584_D3331173 X-CRM114-Status: GOOD ( 12.99 ) 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: Will Deacon , Alexander Viro Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, This series fixes a problem with the ability for the user accessors to access kernel space in a very specific circumstance. I'm greatful to Tomas Paukrt for having the patience to track down the problem. This only happens when the following conditions are met: - ARMv5 or earlier CPU - Software PAN is disabled - Nested exceptions that want to use user accessors to touch kernel space (implying use of the set_fs() function.) The result is that the domain register is not preserved across the nested exception, but instead is reset to prevent kernel accesses while we are inside a region that should be permitting them. Further technical details can be found in patch 3. Patch 1 consolidates the uaccess macros into a new include file. Patch 2 integrates the address limit save/reset/restore into this file, moving it from entry-armv.S, since we need to integrate this with the domain register manipulations. Patch 3 ensures that the domain register is always saved and restored not only if we are using software PAN, but if we're using CPU domains for kernel memory protection. arch/arm/include/asm/assembler.h | 75 +----------------------- arch/arm/include/asm/uaccess-asm.h | 117 +++++++++++++++++++++++++++++++++++++ arch/arm/kernel/entry-armv.S | 11 +--- arch/arm/kernel/entry-header.S | 9 +-- 4 files changed, 123 insertions(+), 89 deletions(-) create mode 100644 arch/arm/include/asm/uaccess-asm.h -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel