From patchwork Tue Jan 10 21:35:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9508567 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 9820160231 for ; Tue, 10 Jan 2017 21:37:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75F44285C3 for ; Tue, 10 Jan 2017 21:37:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A601285C7; Tue, 10 Jan 2017 21:37:28 +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 AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BEFDD285C3 for ; Tue, 10 Jan 2017 21:37:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cR46g-00043q-O7; Tue, 10 Jan 2017 21:37:26 +0000 Received: from mail-qk0-f177.google.com ([209.85.220.177]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cR45u-0002Ms-TY for linux-arm-kernel@lists.infradead.org; Tue, 10 Jan 2017 21:36:43 +0000 Received: by mail-qk0-f177.google.com with SMTP id a20so190079598qkc.1 for ; Tue, 10 Jan 2017 13:36:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Er0RzU5uemCWqsWGbAb/aRrqSaFsSYG20nRxLoLWiEk=; b=MiWTjIyNavkXk0E14NNQ8lJhcMDcgt4P3eEeC6HZr1dcBUcodHZxJSgb6S9Z7n5mIV wi/tbikh54HtWzFtyXsdmCS9icLbU/zZVNeTHcUbbaQffN96Z+QcstyCYwibhjdyl1YB xV6fkDAXmZQsxsrxKJmy97nFsfbjPGfOs9rJj9qJn8svL0ZksIMOloNDrMrDdKet5sVn P4UJRVtN2sgot2wvjXRj8ScJq1kdTsG2KauPgBb4haEB8eFrEf3etDk6IflSiV3W8CWv SkBYn2NRgs9NRAUNsxG8Ty7d+PEPPHXhzz1/AxSBye8FrQY9xXRBOYZGmWvHThSOoJau hpyQ== X-Gm-Message-State: AIkVDXKSWp81QOW30vWPg3oIlAAt7UmBPn6gjg2YC6Xpfnle4z+56MZ0vvu9IdclwTgsntqb X-Received: by 10.55.106.130 with SMTP id f124mr5047915qkc.117.1484084177690; Tue, 10 Jan 2017 13:36:17 -0800 (PST) Received: from labbott-redhat-machine.redhat.com ([2601:602:9802:a8dc::6b06]) by smtp.gmail.com with ESMTPSA id n188sm2406857qkc.30.2017.01.10.13.36.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Jan 2017 13:36:16 -0800 (PST) From: Laura Abbott To: Mark Rutland , Ard Biesheuvel , Will Deacon , Catalin Marinas , Kees Cook , Florian Fainelli Subject: [PATCHv7 06/11] mm/usercopy: Switch to using lm_alias Date: Tue, 10 Jan 2017 13:35:45 -0800 Message-Id: <1484084150-1523-7-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484084150-1523-1-git-send-email-labbott@redhat.com> References: <1484084150-1523-1-git-send-email-labbott@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170110_133639_221256_BCA0554C X-CRM114-Status: GOOD ( 12.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 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 --- 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 "";