Message ID | 20241126172332.112212-5-ubizjak@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CB29D65532 for <linux-mm@archiver.kernel.org>; Tue, 26 Nov 2024 17:24:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D32FA6B0095; Tue, 26 Nov 2024 12:24:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CBD9B6B0096; Tue, 26 Nov 2024 12:24:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FDAE6B0098; Tue, 26 Nov 2024 12:24:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 7BE1C6B0095 for <linux-mm@kvack.org>; Tue, 26 Nov 2024 12:24:02 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3A4EE40EF7 for <linux-mm@kvack.org>; Tue, 26 Nov 2024 17:24:02 +0000 (UTC) X-FDA: 82828919082.02.8EC9FF1 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by imf24.hostedemail.com (Postfix) with ESMTP id BB6FB18000F for <linux-mm@kvack.org>; Tue, 26 Nov 2024 17:23:59 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=PKMtsBqv; spf=pass (imf24.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=ubizjak@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732641837; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=e67gnDX037AzEtGr2TTuiC3i0rrMYCYbsdiQSpuFMPc=; b=8bGA6rxBvFD9gKs+hJ4uJ7iDSVUxN6tZEbwm0pCKLI4qj18nk8eNAcfi/yMblQdIgjngYG s2UgsgBLDPX3LvkUyTK+7qay8ejK69m/OExbrthbXlAVrPCNzrFXrKkEXKoCgjci8nUUHW ySeaWvRzKHqsBub1fENWQ6I3jRlvtZ0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732641837; a=rsa-sha256; cv=none; b=HTP853F6ojhiD5MsbUSc7L1Vlw3kcYDoULrSEb/kCcf5XmLAdo2sqTf/VkK2jg4E0Mmxzr sI9gn4WdfCg50n2s/NNcaR3oJE7kQP18YMnqUiqddwF04f7mJYhYkerGfTMCxwI20fsAjG 6RHEYrqKZuprDmoSKzOMG2AYPYBajRE= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=PKMtsBqv; spf=pass (imf24.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=ubizjak@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-aa54adcb894so334374466b.0 for <linux-mm@kvack.org>; Tue, 26 Nov 2024 09:23:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732641839; x=1733246639; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e67gnDX037AzEtGr2TTuiC3i0rrMYCYbsdiQSpuFMPc=; b=PKMtsBqvp40BV9KuoTedCIvQWRLd/LptD4fZg4MXt6tJVjgqLdli0e9K4ALFwCplTQ +GjCwnfhTRPUVls/RIvgZryQ8HOgpfMMH7RXESR3iov9qwxDqGpWtXI9zz1FUlczTfPl RRRx4czGJQL/Ikbon0YQdesGm6wpcKNvRciE0JQtFFSJDUMfpEO4bHXL3nYsW/WvyLTn Yc30OSeSKrNiPUuNLJUW95tQKOsJ3zVHxoaYKe7fynhCgmnqpSXghhK2ig9f61iwJns2 icmELcbq66hLIkDaC/Y7cz8xOkLrIP7sQKSqVh1CXlpJUD+bThBl/uNmC+egACyHCUh9 V26g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732641839; x=1733246639; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e67gnDX037AzEtGr2TTuiC3i0rrMYCYbsdiQSpuFMPc=; b=vrB0uIUSlvzPI8s4/kEbdvg1oKc4SRgObBzETMQJnISQ7bPs4gi6NH7kzqUGnAjLaJ WsACZcNCfMDPZS5Fbp66UzI7FBaDnHIUsFcMXiSXlEb8XSMHTai3vVjqt2BQaehf2Oow xcaDO2CNt98nVC4U/+yAFZ1Au3k4w4hIqJWTPd1bbE0LIJhXXbgssOixSspk9LjKFdxI GAugICTVRL1JQLejsDeXUEeDIZT6e0nJrclW7fCUo6Jjjalqn9WwP4Q45jZtPpNn+aUZ 61oXMOK+pvlqN412/rh6wITfu0qepN1E+HrVVtDrSX46954JYRpg9rcOkAMWX/JwjLys PPgg== X-Forwarded-Encrypted: i=1; AJvYcCXB6VVp4w+sOF9U1XuB3ccgwaSjgXlFNDwjTHuyBQ2eLnxPWwrEll39lWlRmOAksCkyTFTUow24Kw==@kvack.org X-Gm-Message-State: AOJu0YzJbmEkLOk6tYSSATgWXIrA3rmd9otj77omDVZCqbdVRt32Z29k sebUyHS6itMr9g3F/zEQentHAkDw5tmb2E0JtBIrjjFNLus2yxGb X-Gm-Gg: ASbGncswgQce4mSz/efHB75C4AeG2B2udZu73Aqdq5Xmrbj/ktG5+YjRssn13qXIgnF h6iQo/lkOgELJjHWjjyLV7puBb2RlAOCku2Z79hq+xIE6G1s0o9NdITJYiUstvVYyRyRfWnHyOU kbyvSikMP9xChM6l0KYmnmAXChehq06NUmFk20W9ynnZGDzRBB2zDoGOZkHJmARRnrUe8UP9HGP PmP7kxmLPLfBjlhHX1GXcF4QpCAyBG/jY7iFS/z4GtFl5Vc7ETpYhCJYFg= X-Google-Smtp-Source: AGHT+IGSX3RDD4Mjs5KZqKxckix0gq8OkR9npjFRRCctDVzzyNWShDqRqCQCbZlVg9RCDHh4i4SbvQ== X-Received: by 2002:a17:906:1baa:b0:aa5:274b:60e9 with SMTP id a640c23a62f3a-aa5274b69ecmr1175231566b.33.1732641838563; Tue, 26 Nov 2024 09:23:58 -0800 (PST) Received: from localhost.localdomain ([46.248.82.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa534232086sm473832866b.42.2024.11.26.09.23.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 09:23:58 -0800 (PST) From: Uros Bizjak <ubizjak@gmail.com> To: x86@kernel.org, linux-sparse@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-bcachefs@vger.kernel.org, linux-arch@vger.kernel.org, netdev@vger.kernel.org Cc: Uros Bizjak <ubizjak@gmail.com>, Dennis Zhou <dennis@kernel.org>, Tejun Heo <tj@kernel.org>, Christoph Lameter <cl@linux.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, "H. Peter Anvin" <hpa@zytor.com>, Linus Torvalds <torvalds@linux-foundation.org>, Andy Lutomirski <luto@kernel.org>, Luc Van Oostenryck <luc.vanoostenryck@gmail.com>, Nadav Amit <nadav.amit@gmail.com>, Brian Gerst <brgerst@gmail.com>, Peter Zijlstra <peterz@infradead.org> Subject: [PATCH 4/6] percpu: Use TYPEOF_UNQUAL() in *_cpu_ptr() accessors Date: Tue, 26 Nov 2024 18:21:21 +0100 Message-ID: <20241126172332.112212-5-ubizjak@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20241126172332.112212-1-ubizjak@gmail.com> References: <20241126172332.112212-1-ubizjak@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: huei8dq55mubptr3n397zxer5ze4uc11 X-Rspam-User: X-Rspamd-Queue-Id: BB6FB18000F X-Rspamd-Server: rspam02 X-HE-Tag: 1732641839-557824 X-HE-Meta: U2FsdGVkX1/lBmF48oLnlQKzTsG6ENVhfptNohl9A9DxlhMOcgdu4ZnJdeI9NMTKNlAIFo9mjt4Szv2SWmXDPhTjzRJ8LHJ9HnDzV7aveHf+d8u0/Egu3eTmx1M7BL0bzv6cMQeTTt9TUzAcB54/Fl/4qHVk1eEFjdj4nweUGj+v/n5O5l2FOZjJr14GIYtNJjmCF1pvz0vUDLn8Lnzr25ED9KZOBwhh/iLZXjDhdFcSaivZNNXP6+cney6s/TQwFg8V8iJ1T4+fwAXf48aMESxcqDakoHGrNl+89PospYIkoxOzblnm+mX8FE2KODh8JecHAoPcEzjNU3pe4U5S10X9JtGpElboGEZ4qtQSgOJ2YOxbYPfCbBfcB6xrZ3Q9oiSimeFUoXsKPTtuAor5DT7jESuq8H5CtL2AvfNw16wGpzklPWeEtuxYG6TtNykbtpAPl9RJbG5TzafQfkgNsO75WBI/uPjSJ/uIO9oWwri4vhTyQqJXjS47EWOl5qPKZDm+LxDDno8SWVgxS+OJdooeLPMsVMXDnGdWEnNyGEYr0/ymFJuxLJ3K57NW6JkskYJPtT+Zm6rIYlBVsNbvzfh4o6TKtfPq4EadW6PK9abrRElb6Jad2YHeupq21j5aAPyQUa6pN0Ucrmhhvh4BSHUN/AvaWkWVuu2YIy4u5XkNDifH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lUCRaKFvTONs7bT8Zwrn2Kw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Enable strict percpu address space checks
|
expand
|
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index 666e4137b09f..27f668660abe 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h @@ -73,10 +73,14 @@ unsigned long tcp_ptr__ = raw_cpu_read_long(this_cpu_off); \ \ tcp_ptr__ += (__force unsigned long)(_ptr); \ - (typeof(*(_ptr)) __kernel __force *)tcp_ptr__; \ + (TYPEOF_UNQUAL(*(_ptr)) __force __kernel *)tcp_ptr__; \ }) #else -#define arch_raw_cpu_ptr(_ptr) ({ BUILD_BUG(); (typeof(_ptr))0; }) +#define arch_raw_cpu_ptr(_ptr) \ +({ \ + BUILD_BUG(); \ + (TYPEOF_UNQUAL(*(_ptr)) __force __kernel *)0; \ +}) #endif #define PER_CPU_VAR(var) %__percpu_seg:(var)__percpu_rel diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h index 266297b21a5d..2921ea97d242 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h @@ -223,7 +223,7 @@ do { \ #define PERCPU_PTR(__p) \ ({ \ unsigned long __pcpu_ptr = (__force unsigned long)(__p); \ - (typeof(*(__p)) __force __kernel *)(__pcpu_ptr); \ + (TYPEOF_UNQUAL(*(__p)) __force __kernel *)(__pcpu_ptr); \ }) #ifdef CONFIG_SMP
Use TYPEOF_UNQUAL() macro to declare the return type of *_cpu_ptr() accessors in the generic named address space to avoid access to data from pointer to non-enclosed address space type of errors. Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Cc: Dennis Zhou <dennis@kernel.org> Cc: Tejun Heo <tj@kernel.org> Cc: Christoph Lameter <cl@linux.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Cc: Nadav Amit <nadav.amit@gmail.com> Cc: Brian Gerst <brgerst@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> --- arch/x86/include/asm/percpu.h | 8 ++++++-- include/linux/percpu-defs.h | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-)