From patchwork Wed Apr 30 00:16:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Gupta X-Patchwork-Id: 886837 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 CF4D42139D1 for ; Wed, 30 Apr 2025 00:16:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745972191; cv=none; b=WvpLfOU9CeGXkE9nYYzQZXVS95JaQ8zM2r3lRrvKW+hX6wkpZGXf6jItNKDQ2Ed97HLn9DMuOdAxOUdH+wUexVCBmgOIOa5wTKHK/7hvuyK2+XJ/Sa924injfaUJ3u9NI+6747Dq0SKm6x8K9vqUdKfjvDkJlluFIdUUSlxVPRM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745972191; c=relaxed/simple; bh=07JIHRwK+fbY/KS3WXdAQFowggDed4ZKoyBK3fLGucQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UkylzEMVW10vPniTaYIB2CZ4aPLKNkeuMiBgYV8GBklUAoZQoGYhIjWHSZ90Z39HxDHu5p3M3Ah/h5bXal4LVxb9JbQUnt1p93VrHERELb0Vo0gQw+aRdbiobh7InzJgZfxW1GP7ky5uobgMFMgUuo2AogpicvU+IcaoLzzkRts= 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=Nzv7/mko; arc=none smtp.client-ip=209.85.214.173 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="Nzv7/mko" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2243803b776so111464815ad.0 for ; Tue, 29 Apr 2025 17:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1745972189; x=1746576989; 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=SkVK3bviqHN/t8JmfUhzYvFjjtQu0YyYqPmZLVGI/TA=; b=Nzv7/mkobhS1qwl3caSpbMi+f0htEk0T/vf7Qe1W5wYEr1P/pip/onTpADOa77EWPL VC5yH3qrd1yerG80gpoTNpBqBzsH/YKyr9yHicinym+UF5AFlA6btYIFcdbe01ZGQix+ ur4iGwktyjesd2cnorq6wyIqROMMxpePJ2m2iRxx0h+IKFy7xzT6Q+pjxaqsS9kzfjl0 CVNF0FtZtkP9ELctLcok37XoHeUgnpXyzSOMd7xGf21NX5v/MrHpwAEIWQWTXaRrD+ln XdX8GKmTUrslyWATKwGCsPw/EJqmlqpDP1ID9Fp5dqsXEG6b30GfgNlTohfxIHvz7Ja/ yMRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745972189; x=1746576989; 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=SkVK3bviqHN/t8JmfUhzYvFjjtQu0YyYqPmZLVGI/TA=; b=NQ17QBXw2I1vcPKBUbhHDqp9kw3P0dST+iOUuPKq2uVAkFS7ooTwqeIjTehd/SDv+7 oQ6XSIPEf6yQIu2EpMvMYaUYkwj30GUDg+BXY0cYHFvJelNHGCKhvkkGJUFK/pSLrjh/ gIjY4OnVkiNY6SX9HD5cgrsqeGAx37oQF1GbGNUhJoPqXOZsxCPS307EMGUXvZnoF4Xh MNKIvzqDE0PVDd7bySPhtp5vIEfEafPZtNuxC2Jz4g5XwWhdCU6b55cK4SBL7oWnSOi8 Y1M0SOf598quLXHlt+gUpep3hbo0UwcRWf1ITIRn0BucKOnSuFIOBW7lD+29uDGi1Ahx Rerg== X-Forwarded-Encrypted: i=1; AJvYcCViVyJAbtUQavzLH0oKNj133APwjmLDvApGyB+VCZeiDZcTiasIDu3Q+0dhFS1os/HG1QmoleGMEMZRcdDq8m8=@vger.kernel.org X-Gm-Message-State: AOJu0Yx6affCRkuVCFTTcrZRIQM/1WeC+Rzc9Mh+7qRNpdka/bCZLKuD 71FwikHI3mge+nBN4+vrvFRnBDj05Xo2D3S8jo/rtsYbnSPlQSOyzEfJO4z5xCE= X-Gm-Gg: ASbGncsmuMMBlXUY6op5mMIz87zJNE+kas6WB0FmVjOEGpVXFlOF8N00T9eStnJNQNO W5phlitJiV0IMDACMauiaUcLyP15Nkv1b9lA9HuEJFDYBKN2BLEuTES0WIHF+nUGi654nhsnTvD YLgZZ1lwjTpL6YNw292cnnvekeqN/JaKLyfHR3naUmT5O7xCjFzE1kuF5+avOob8NeY9izQ1Kdg RBvLBcUyHZSRRn/4hITTUAxylmwS7NE2EZzpSgdAq8+5RtF69ZCF496WGoXVEhybVT80sj0r2MV PnyDJH/rCufDJEG3F/j1JStoz3xhGmIzFYH5dQADnn4KWV95dxQ= X-Google-Smtp-Source: AGHT+IEaCOo3UdLjB/YDRvV5wqIWEkwy6tQXnBD9FT8T9fOLPTePyGUVcVc/ygroOS4hwPE4lcSyLA== X-Received: by 2002:a17:903:1983:b0:216:644f:bc0e with SMTP id d9443c01a7336-22df35192a3mr22839375ad.24.1745972189106; Tue, 29 Apr 2025 17:16:29 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22db4d770d6sm109386035ad.17.2025.04.29.17.16.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Apr 2025 17:16:28 -0700 (PDT) From: Deepak Gupta Date: Tue, 29 Apr 2025 17:16:18 -0700 Subject: [PATCH v14 01/27] mm: VM_SHADOW_STACK definition for riscv Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250429-v5_user_cfi_series-v14-1-5239410d012a@rivosinc.com> References: <20250429-v5_user_cfi_series-v14-0-5239410d012a@rivosinc.com> In-Reply-To: <20250429-v5_user_cfi_series-v14-0-5239410d012a@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?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross 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 , Deepak Gupta X-Mailer: b4 0.13.0 VM_HIGH_ARCH_5 is used for riscv Reviewed-by: Zong Li Reviewed-by: Alexandre Ghiti 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 b7f13f087954..3487f28fa0bf 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -352,6 +352,13 @@ extern unsigned int kobjsize(const void *objp); # define VM_SHADOW_STACK VM_HIGH_ARCH_6 #endif +#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