From nobody Fri Apr 4 15:19:08 2025 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 A24FA1A317D for ; Fri, 14 Mar 2025 21:39:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741988372; cv=none; b=dxFmqn9upJIkw4kU7jU92W/UeghViHfcb/c7/T1x4Mvn7ij/HfnUSTxVEs8iL2LX2by7YEKD0i+v8rpVIzwgPK0ubFM5wUQHnLSxJLtZ/HIp+t0TDivhE01zLPoelIXxJgOo+J6ZZ67+u3Hm58Nvl7I9XK+/Ktdm/UWHXNW9WkA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741988372; c=relaxed/simple; bh=pbZsnVycfvlXR/jueZaepHgseReSQSx1x2o5rAzi9lQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=utBV6PLhb7GzsrTbuNPBGVE4kNItygCo8+5bij3kSjAtUfOF38k7HCtzwaAcQUTGrDvg5EGjSeMPFNx/+UKD1EsiAgctVq1OY0q3nyRrDw5VutLVqGDad3TBaSl/OZfT7ZEYRrpS1LxjVYVrCTuuqYen8Z4MbYB7zbBKOY50FJQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=m7KCyXD5; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (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.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="m7KCyXD5" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-224191d92e4so52578995ad.3 for ; Fri, 14 Mar 2025 14:39:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1741988370; x=1742593170; 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=SDDw4jYk8ElhORayLnctVQ+77ceNByh8dqs8gmZ197w=; b=m7KCyXD5LnQkJc1z4hTDR+h/VGiM9ZJOvppzKGG89mi2z7hF997+HAp2iVNQvdG8gU Zv0IMTWNSNbV0PFimBwSB/VWO65+Py8SABFRH+hwGCAIkXUX189K/w+Jch8F4De4htFB L/ml8N0GPEI/0Tg63UW1AuemeMYmMbhk8RIbUkJ0lAIgphrfHA4y8agSB9cOZrdUQ0tm Cgst9vZr21qxvzsgRUiZYXVoL7i3iPwHOFk8ZX43QDBy/nsJVfoUvCFgBN72DuivKhp+ d9q1u9Mu13Es5RX/iMYEoygtZTeQp8jF20lwvdgrnnsECasfo1mih6z4BLag2Ml7Kd8S jVFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741988370; x=1742593170; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SDDw4jYk8ElhORayLnctVQ+77ceNByh8dqs8gmZ197w=; b=a7VIcvhFYoCKF/T7Ze8rOczFwlbP/sXoX2QS0VJJk9b855qfue8jLBsT3ER9jlqNER ODhZEiuozSlTi4D45wCojl0GWlNpUMug0CpCOmTvZRyCMga3G3DXS+Y0VrfxwGwn03Ut z9m1wJQLPrdqwYaz7jb6nJ2HC14ROQvgHc96/rZWjfVI7PnLfB6hNIYcVzjvrwfi3//o wYxAYZZljorN7cKTofzgJA/eG66bGUq8O+KaFVjqYJTuTRTvxoteauSispvnwsoA8QF2 GhMj3yc59aBWKDcyJ5N1OyalwCJRgZaq65x76RSSuo5269dHpCFNU5GtRYLur7M4u3F0 N5Wg== X-Gm-Message-State: AOJu0YyCBnkEhjzdUjJgUrsFyn2NlaaO1CJEkO+NRfQlY4DE9RML8jZf 8+lBUcQXMGIxCevjfkniE+8NBhdA3c3c7TBEUQq00+KzFa68miQVxRcCkcxoUu0= X-Gm-Gg: ASbGncty/AHml5TjBp+4IjxovHq35NHkq/OJ4iU57SEeR/Cj5SAOBql0FrugryLAkh5 oaAtf2eQhzcD3YTyGc8ng+aMJCXZdRIpUvKv3hzyqAjrhnwqUzNBKO2952v06fXX4l1PtmwPHt1 cUA/dGZcXWrdHsxI6XDZ3yyYcI/WquOsL/Jxx0IMR8N/h+/6O3RY6US8gngLBOkz9+bnJDP4wBK hpi867DOZ9JKfOH9Fo+uhOq974APgm4GDIP2pfrNzfO0SKVNO89n+YR82GQ/DNkJjihn+uxRLVH HwlfRXH+PbM7TpzD/tqZqlfNBgpbZTPTfD/JsWgKOX4nSidKnX7ILCM7hJCH5B55Lg== X-Google-Smtp-Source: AGHT+IFpg7z+OE/2A1gqmKjw7jqoEU+X8gr8RuneE9Exr7j30nKzCtL2OnQx5eLIT+ktDst/E1FOnA== X-Received: by 2002:a17:902:db04:b0:224:8bd:a482 with SMTP id d9443c01a7336-225e0aa7e06mr46126855ad.25.1741988369862; Fri, 14 Mar 2025 14:39:29 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-225c68a6e09sm33368855ad.55.2025.03.14.14.39.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Mar 2025 14:39:29 -0700 (PDT) From: Deepak Gupta Date: Fri, 14 Mar 2025 14:39:20 -0700 Subject: [PATCH v12 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: <20250314-v5_user_cfi_series-v12-1-e51202b53138@rivosinc.com> References: <20250314-v5_user_cfi_series-v12-0-e51202b53138@rivosinc.com> In-Reply-To: <20250314-v5_user_cfi_series-v12-0-e51202b53138@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 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, Zong Li , Deepak Gupta X-Mailer: b4 0.14.0 VM_HIGH_ARCH_5 is used for riscv Reviewed-by: Zong Li 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 7b1068ddcbb7..1ef231cbc8fe 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -378,6 +378,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.34.1