Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2148914iof; Tue, 7 Jun 2022 21:22:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4e+Q8Gb8xJVBbYH/xg5WTM5j96YXUf+ZkGh1YLPU8TvmyZWcSQMU7oot9ikAwDvTMTAu1 X-Received: by 2002:a17:902:8488:b0:167:9151:a8db with SMTP id c8-20020a170902848800b001679151a8dbmr7205176plo.2.1654662176898; Tue, 07 Jun 2022 21:22:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654662176; cv=none; d=google.com; s=arc-20160816; b=lmt10k2va0n4DjP5C+AcODkNl2CH5MOoFsuEhXnSVP4fcCbh7OaEZVvcrEmepNbGij wqaYF01714fdTvE4mhimmEm2xiDht6xxjGr/El+fyUgXSvvkqzyYhmYSI5DlaQdzWY8N YluaOsc4b5eVvqo7r04HtVuw9GCEoU3RCmD0f8yp728z5iOVkok4Y951R6hobdDi3l8i BXY9/8arD5UU7u9CRQYgffCgOeiiW4ika+GiKIXiCf7IdAAVlM9fOQ2c1AH1yalxyxgu u4VPLJwLQ+X25kM7o6ifzAQ5FUcL8W2QGjkPAO6nDbM94egzgcbzbgUnHnepCTCq2W+f Lrpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vIjDDgofrDAcxFJTbLXL3JqbHx0+JN7dlMR4ElHQd1U=; b=rSN+zCSGP5AxrFg4P5RVzeo1sMHHAVGLY5W8D3iY+zJSzhmkWf4uoXLpwxIAki+bsa NCDodd6oxmZ9c8j74oo79ACmWvxzTgV1o5rBSCGEiZ/0ZZnxEdEcNIzeqURfmQWa7stk 4hSscM3wNXjXF0VAkXOmRvx5zFDX58N88Jc4QeeIFOQIbNKma++5W0uEpPJBdaqtdCSq PiKQkAv9PmXQ1vJ5um8wT4LMsHVZrT4HZyb3Z+PLmKtRjh/C9J8RWqMabG6L99SIut8U 39GKr/q4TnhiePVqGUep7Sp87mXcNi1P209xwm6Lqs2HomVaKkzhY4YqZylz+e8bMerO KkRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ajFGlSpy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i16-20020a17090a059000b001cbbd85faa9si14114510pji.20.2022.06.07.21.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:22:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ajFGlSpy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C343E2A90F5; Tue, 7 Jun 2022 21:11:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348355AbiFGRyI (ORCPT + 99 others); Tue, 7 Jun 2022 13:54:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348260AbiFGRgK (ORCPT ); Tue, 7 Jun 2022 13:36:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A56D6C56F; Tue, 7 Jun 2022 10:32:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0C2BFB822B7; Tue, 7 Jun 2022 17:32:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67094C385A5; Tue, 7 Jun 2022 17:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654623141; bh=2clv+eIChWCU75Deg8PZdCXvoxeLsnNaYAdk+/FkBa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ajFGlSpyJZnBrH0jvuC0eJhEFmSQ9aAa74HhvgOs6gHmXRWp0uVNlUMNupM29Ovp8 9D+y4gXp0rDZCvz5AEjuN5aC32gb/weMfXuUHjZh4JIDzJ4rY9EMDCx1WvWhXAE1qc yhp7zPSpankficdYKDKkIJnzjqWa+7dJ09Pl+MhY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Sasha Levin Subject: [PATCH 5.10 310/452] powerpc/64: Only WARN if __pa()/__va() called with bad addresses Date: Tue, 7 Jun 2022 19:02:47 +0200 Message-Id: <20220607164917.796945335@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Ellerman [ Upstream commit c4bce84d0bd3f396f702d69be2e92bbd8af97583 ] We added checks to __pa() / __va() to ensure they're only called with appropriate addresses. But using BUG_ON() is too strong, it means virt_addr_valid() will BUG when DEBUG_VIRTUAL is enabled. Instead switch them to warnings, arm64 does the same. Fixes: 4dd7554a6456 ("powerpc/64: Add VIRTUAL_BUG_ON checks for __va and __pa addresses") Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220406145802.538416-5-mpe@ellerman.id.au Signed-off-by: Sasha Levin --- arch/powerpc/include/asm/page.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index f2c5c26869f1..03ae544eb6cc 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h @@ -216,6 +216,9 @@ static inline bool pfn_valid(unsigned long pfn) #define __pa(x) ((phys_addr_t)(unsigned long)(x) - VIRT_PHYS_OFFSET) #else #ifdef CONFIG_PPC64 + +#define VIRTUAL_WARN_ON(x) WARN_ON(IS_ENABLED(CONFIG_DEBUG_VIRTUAL) && (x)) + /* * gcc miscompiles (unsigned long)(&static_var) - PAGE_OFFSET * with -mcmodel=medium, so we use & and | instead of - and + on 64-bit. @@ -223,13 +226,13 @@ static inline bool pfn_valid(unsigned long pfn) */ #define __va(x) \ ({ \ - VIRTUAL_BUG_ON((unsigned long)(x) >= PAGE_OFFSET); \ + VIRTUAL_WARN_ON((unsigned long)(x) >= PAGE_OFFSET); \ (void *)(unsigned long)((phys_addr_t)(x) | PAGE_OFFSET); \ }) #define __pa(x) \ ({ \ - VIRTUAL_BUG_ON((unsigned long)(x) < PAGE_OFFSET); \ + VIRTUAL_WARN_ON((unsigned long)(x) < PAGE_OFFSET); \ (unsigned long)(x) & 0x0fffffffffffffffUL; \ }) -- 2.35.1