From nobody Tue Dec 16 13:33:17 2025 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C255F344022 for ; Fri, 5 Dec 2025 18:36:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764959815; cv=none; b=Hj8Z1mev1SJ40oO5VwWNtqz7CS//fp9mQpdfcMfkn1hSLtkUErY73z0VAX7Qp8okUkkozl3GCGf9DTI9GGsD6TBfO9qZo+OsyuxBww3FZp8Jc2TaxTSIP6746g69mmY4lHxmckzsyQTIL8sSRnOFs0I46cQK+tjTjPXplzLNQos= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764959815; c=relaxed/simple; bh=BfqrkDAmEYT+r742gKB+SlFctae91M/veuPAGWY6Q04=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CN3QHHNDhDDJLHqLQragASnQFL8yDzHMS71qhCeTJ4663AI1g0+r0902ekOSQjwycKDr7ydPS0+bQLkacnWk0KVjpmCmdOzcAhcO+apJaCek+aHOhsxrWlod2tai6Hv2808BCKGL/TrXrlBhUPqQXSu6wLpo1ylIuomdl9+U4+U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc.com header.i=@rivosinc.com header.b=HB821pUV; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc.com header.i=@rivosinc.com header.b="HB821pUV" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-298250d7769so19894005ad.0 for ; Fri, 05 Dec 2025 10:36:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc.com; s=google; t=1764959813; x=1765564613; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ZzDCu7IaTRxcq9mEPcCPJw7K7qmz1vUabcyA8OBdm1w=; b=HB821pUV1vl9H0A3oRaissEDk2LISKxDFsYVfqPT6tn8wBGpbrEI6krNt9XI/mFy33 0D3q/fE4U6a18UsUfyfkpfJ2UZrHBGWwzbGAHLZngUk6Fazpvkq6/LAt+TnKN5RMSvYS wa6S6Lj4lWPdXomOLBmYeQE8XfXyuvOBY1SjY5S9kxUh0kgCYgio4S9m9uwDAfOcuGLo J3Qm5ZTPVxEVk/KfB6j7rTG29WtnxuhijC6xlFCw+sxTpz3SaLenSqzMDEYdh8gQIIrk umIpqFuw87gYhp9ZC60oHVfiino3jQyMzlimHJvC8oWZAMW4UGYhF68RMAxvUlBFhdS4 WE1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764959813; x=1765564613; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ZzDCu7IaTRxcq9mEPcCPJw7K7qmz1vUabcyA8OBdm1w=; b=O5hgaNXqX5qRK+zvL0Rj94f8CqTT4pLJvrfbN4ZxoN2jqgiHNdOevmABB/QFPMzxD9 Tyl1QBLb9wMa1jQgtm67kHqkSWvy4l/t91HZT+fuCa6rEKxTePG0RWnvYMWgKAgxZFxF UkeN87ibmphh6UA16YP1NYaXPwrDTlbKncgjJs+romoqVtuxg8xDxF0YzRnNf68BEx4j 2aTlc/KJ3nTc2U/mtdL7+2FoaLyg7epiuA7JLJT6aLmske8IzYafeWGG4w5p3g3f5SCx 7siI0clO9Gm2rGc9DXSUnUh38YbJcc/yWkS6ecvS/PlaZiFEx28cxW0uX+13i0gvrGgx cw0Q== X-Gm-Message-State: AOJu0YwxPlH1OjjJqDsYydiMil1J+kW0gZcgVm5Gm9/qbWy7pylogXsb RM+KX9BBmtvmmGpspSwQBppPg6R8esMzu9tHS8V4PKztM1QvH6QtYoxXALasEilfNKE= X-Gm-Gg: ASbGnctAwXmbZtoBb32GGiQLGD+5671fb+vHps7zao/ZGuRRrszwqeyVCNp3wG+4f+k Gkg2YymeVq6Vp4TAaw+Rq/jcLVWkuX0TEFoWVDjXnQOmOMCLFxCU8XqHoFcrCLVda3AS8spnem8 WzIwRdp7vQYctttZ3iNwiUOCQ5J04tD11sPh5swdA6DJMimB0gtOmMa/KlXQh029zXXoKLAUDM5 QA8ziu3syOKvaz+VLcF2KT5KH79Fn/Il2zyBEyrrTcMAcojt0jHVKeAgfisrMPGdIBT9JlF6NiG LZb5cBHzAyB54TdSZ4cHQnZCgNsKao6UnY5jiUOn0iM3StGL6SbehiRFLCr4WbLtaLuOcEfu2wP MW5PzpRos4e8hx73IpXRFaOqilXa+urBszNr3HIwLhjM+12lOLDFuuVK/W75Ui7Zaz1mTf5amjH HkTuoY+sj+3a7jgTvm3H1t X-Google-Smtp-Source: AGHT+IGMTXNhEE0AGobVo0Q+Qpcz65YU2t6Uoez+HvjFdTXQk2XlyYkBUQRk9w4i9DYExo/tp12ayw== X-Received: by 2002:a05:7300:bb08:b0:2a4:7270:1788 with SMTP id 5a478bee46e88-2abc720149cmr114273eec.19.1764959812961; Fri, 05 Dec 2025 10:36:52 -0800 (PST) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2aba8395d99sm23933342eec.1.2025.12.05.10.36.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Dec 2025 10:36:52 -0800 (PST) From: Deepak Gupta Date: Fri, 05 Dec 2025 10:36:47 -0800 Subject: [PATCH v25 01/28] mm: VM_SHADOW_STACK definition for riscv Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251205-v5_user_cfi_series-v25-1-8a3570c3e145@rivosinc.com> References: <20251205-v5_user_cfi_series-v25-0-8a3570c3e145@rivosinc.com> In-Reply-To: <20251205-v5_user_cfi_series-v25-0-8a3570c3e145@rivosinc.com> To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andrew Morton , "Liam R. Howlett" , Vlastimil Babka , Lorenzo Stoakes , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Arnd Bergmann , Christian Brauner , Peter Zijlstra , Oleg Nesterov , Eric Biederman , Kees Cook , Jonathan Corbet , Shuah Khan , Jann Horn , Conor Dooley , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Alice Ryhl , Trevor Gross , Benno Lossin Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, alistair.francis@wdc.com, richard.henderson@linaro.org, jim.shu@sifive.com, andybnac@gmail.com, kito.cheng@sifive.com, charlie@rivosinc.com, atishp@rivosinc.com, evan@rivosinc.com, cleger@rivosinc.com, alexghiti@rivosinc.com, samitolvanen@google.com, broonie@kernel.org, rick.p.edgecombe@intel.com, rust-for-linux@vger.kernel.org, Zong Li , David Hildenbrand , Andreas Korb , Valentin Haudiquet , Deepak Gupta X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1764959808; l=941; i=debug@rivosinc.com; s=20251023; h=from:subject:message-id; bh=BfqrkDAmEYT+r742gKB+SlFctae91M/veuPAGWY6Q04=; b=wb8Cvp9WwhgSAwjQuZXG2bfRw8uKBYeoYJuQ+D08ldqWnIr/+SHvUA9MzZ7+c1hnN4WDZnkHs M6IZRQCZeBaCy67MIkBFvjWj4owucJIYwhEmnGzRtLdXw0MOWKyNECN X-Developer-Key: i=debug@rivosinc.com; a=ed25519; pk=O37GQv1thBhZToXyQKdecPDhtWVbEDRQ0RIndijvpjk= VM_HIGH_ARCH_5 is used for riscv Reviewed-by: Zong Li Reviewed-by: Alexandre Ghiti Acked-by: David Hildenbrand Tested-by: Andreas Korb Tested-by: Valentin Haudiquet Signed-off-by: Deepak Gupta --- include/linux/mm.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index d16b33bacc32..2032d3f195f1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -380,6 +380,13 @@ extern unsigned int kobjsize(const void *objp); # define VM_SHADOW_STACK VM_HIGH_ARCH_6 #endif =20 +#if defined(CONFIG_RISCV_USER_CFI) +/* + * Following x86 and picking up the same bitpos. + */ +# define VM_SHADOW_STACK VM_HIGH_ARCH_5 +#endif + #ifndef VM_SHADOW_STACK # define VM_SHADOW_STACK VM_NONE #endif --=20 2.45.0