From patchwork Tue Dec 6 23:50:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9463493 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CB0D36022E for ; Tue, 6 Dec 2016 23:57:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC42128476 for ; Tue, 6 Dec 2016 23:57:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD563284D4; Tue, 6 Dec 2016 23:57:59 +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=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 413E928476 for ; Tue, 6 Dec 2016 23:57:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cEPaU-0008Sg-AW; Tue, 06 Dec 2016 23:55:54 +0000 Received: from mail-qk0-f173.google.com ([209.85.220.173]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cEPWf-00042f-TY for linux-arm-kernel@lists.infradead.org; Tue, 06 Dec 2016 23:52:01 +0000 Received: by mail-qk0-f173.google.com with SMTP id q130so209917635qke.1 for ; Tue, 06 Dec 2016 15:51:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/YJPkw1LYngW3QojI4eEBUW6aAyL9CoNyphnn09ytrI=; b=mGIMZGy2XG3Cao8977DKfn2vqbP5Lw4xGqOvgkED+K6fptcbCJNt+mYo1paaWoWLBD d2g+UsOCQ49XgCNtGqOMTffxNZc7R73moV+CMA77aVpN6ZBpR2/jZXM+73YxSLTCU2+N eejEKIsapdvQq289DH9vVJsTYcC1yZeb3lr+ejzRMWItcopwGHnSvoqQMgf4G4Q0YqYw +gcqD9hjDsYm9OzB685WCox5mMBLWl6WtdmlbGxlj3eHIK85tnIT/4NkV97Ewlv9KphA 8PBT7g4bulIoCNGD+05FC2MoHGy22LXUb4n0EUBKQ0hMTAcqUub3RFea7FLWQQVdy7v8 KlQg== X-Gm-Message-State: AKaTC01ul6lQc/2GO9FeIDyiJJZJ79spDnWPuqWLlCVfOC4L8uXfiLeDyM8HfDkArIKym5TT X-Received: by 10.55.47.69 with SMTP id v66mr54877859qkh.209.1481068295695; Tue, 06 Dec 2016 15:51:35 -0800 (PST) Received: from labbott-redhat-machine.redhat.com ([2601:602:9800:177f::df9b]) by smtp.gmail.com with ESMTPSA id o190sm2739212qke.5.2016.12.06.15.51.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Dec 2016 15:51:34 -0800 (PST) From: Laura Abbott To: Mark Rutland , Ard Biesheuvel , Will Deacon , Catalin Marinas , Kees Cook Subject: [PATCHv5 10/11] mm/usercopy: Switch to using lm_alias Date: Tue, 6 Dec 2016 15:50:56 -0800 Message-Id: <1481068257-6367-11-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481068257-6367-1-git-send-email-labbott@redhat.com> References: <1481068257-6367-1-git-send-email-labbott@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161206_155158_253954_BCAA245A X-CRM114-Status: GOOD ( 12.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Ingo Molnar , "H. Peter Anvin" , Joonsoo Kim , Thomas Gleixner , Laura Abbott , Andrew Morton , linux-arm-kernel@lists.infradead.org, Marek Szyprowski 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 The usercopy checking code currently calls __va(__pa(...)) to check for aliases on symbols. Switch to using lm_alias instead. Reviewed-by: Mark Rutland Tested-by: Mark Rutland Acked-by: Kees Cook Signed-off-by: Laura Abbott --- v5: No changes, just acks --- mm/usercopy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/usercopy.c b/mm/usercopy.c index 3c8da0a..8345299 100644 --- a/mm/usercopy.c +++ b/mm/usercopy.c @@ -108,13 +108,13 @@ static inline const char *check_kernel_text_object(const void *ptr, * __pa() is not just the reverse of __va(). This can be detected * and checked: */ - textlow_linear = (unsigned long)__va(__pa(textlow)); + textlow_linear = (unsigned long)lm_alias(textlow); /* No different mapping: we're done. */ if (textlow_linear == textlow) return NULL; /* Check the secondary mapping... */ - texthigh_linear = (unsigned long)__va(__pa(texthigh)); + texthigh_linear = (unsigned long)lm_alias(texthigh); if (overlaps(ptr, n, textlow_linear, texthigh_linear)) return "";