Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4541503iog; Wed, 22 Jun 2022 00:21:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u/by7u9Qo1iHRUn2kXDktk1Tf9N4Es0bkWrHa0xBv8I9iOcRaW2gorNgbanb8qD1TuJ40w X-Received: by 2002:a05:6402:d5c:b0:435:6e2f:245b with SMTP id ec28-20020a0564020d5c00b004356e2f245bmr2481848edb.145.1655882476246; Wed, 22 Jun 2022 00:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655882476; cv=none; d=google.com; s=arc-20160816; b=ubUEe2VgvBMO2dJHRF3laxy3iQd0n8fgghjG11zIwNDWrK5xvbqziAhAI0pnTHN4eZ oRevn5IEw23nv5wJP42BXUCAi5/UgCWnHSsE/9q1cZHA0Dgi/wo+j+HbUCfB+XrEL1hn 3d5NA/MxEjXZ2WJ5j55sTGaOzilGV0cYZ8CoYPqba2a33oMZCXza/ZHM0ZgPaP8gj09U ZcyW17xXEfojJ/ZWDS2tycfKgY6yKgw5FQ9O5YDjg8YoG+yJdod5w5GJXOOnL9UiRMu/ aXbrrj1qahwVhvhrwD9rFuIt2ry9LPX2EHLwcDixnMUoQrOBEVTV5aOErO8hjN8OQhkn wzJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id; bh=yAKCZxC9N3K1ay7xJfv7NpB2JpjNj3wnItToSkM0VVU=; b=dNU+2ca4E3AZge48GGeHhwRkXsuFjTkYdOMR6UaP+gLyui8WTpHcvXvra0bCDsh8ZL lX5HwvDW79rME7AR1LbRAUm/OPaFre1mWL3MVyA9ZAf2D4z0x5DUnb1XawAdt/Vc+Nbh vjjVBrByGTdQW30WdxFHbqUbAjuXMB/OCDj0cvZ2iT/dI0G7xnzIaBunF7c4+8aYK2ps vVYl81CeyvJKVo21gHc2nnOSUUGaTd9/DRyZR7bbfl9fUXBMUGsT2nWGImXbOOYDn4PH clhnxQwfX3yunnpR9RWi22OhXrxKauPocX2fQ22D5dFd1GSp81u3l0tcY0nTWpQey3Fq OeKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13-20020a056402254d00b004359ebb62d7si4236770edb.1.2022.06.22.00.20.50; Wed, 22 Jun 2022 00:21:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351534AbiFVGuJ (ORCPT + 99 others); Wed, 22 Jun 2022 02:50:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351579AbiFVGty (ORCPT ); Wed, 22 Jun 2022 02:49:54 -0400 Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0654035ABA for ; Tue, 21 Jun 2022 23:49:52 -0700 (PDT) Received: from fsav412.sakura.ne.jp (fsav412.sakura.ne.jp [133.242.250.111]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 25M6nNKG065902; Wed, 22 Jun 2022 15:49:23 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav412.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav412.sakura.ne.jp); Wed, 22 Jun 2022 15:49:23 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav412.sakura.ne.jp) Received: from [192.168.1.9] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 25M6nMAZ065894 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Wed, 22 Jun 2022 15:49:23 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: <795c9463-452e-bf64-1cc0-c318ccecb1da@I-love.SAKURA.ne.jp> Date: Wed, 22 Jun 2022 15:49:21 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Content-Language: en-US To: Russell King , Tony Lindgren Cc: LKML , Linux ARM From: Tetsuo Handa Subject: [PATCH] ARM: spectre-v2: fix smp_processor_id() warning Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 syzbot complains smp_processor_id() from harden_branch_predictor() from page fault path [1]. Explicitly disable preemption and use raw_smp_processor_id(). Link: https://syzkaller.appspot.com/bug?extid=a7ee43e564223f195c84 [1] Reported-by: syzbot Fixes: f5fe12b1eaee220c ("ARM: spectre-v2: harden user aborts in kernel space") Signed-off-by: Tetsuo Handa --- This patch is completely untested. arch/arm/include/asm/system_misc.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/system_misc.h b/arch/arm/include/asm/system_misc.h index 98b37340376b..a92446769acd 100644 --- a/arch/arm/include/asm/system_misc.h +++ b/arch/arm/include/asm/system_misc.h @@ -20,8 +20,11 @@ typedef void (*harden_branch_predictor_fn_t)(void); DECLARE_PER_CPU(harden_branch_predictor_fn_t, harden_branch_predictor_fn); static inline void harden_branch_predictor(void) { - harden_branch_predictor_fn_t fn = per_cpu(harden_branch_predictor_fn, - smp_processor_id()); + harden_branch_predictor_fn_t fn; + + preempt_disable_notrace(); + fn = per_cpu(harden_branch_predictor_fn, raw_smp_processor_id()); + preempt_enable_no_resched_notrace(); if (fn) fn(); } -- 2.18.4