Message ID | 20240329044459.3990638-3-debug@rivosinc.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 56BD3C6FD1F for <linux-mm@archiver.kernel.org>; Fri, 29 Mar 2024 04:45:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE2996B008A; Fri, 29 Mar 2024 00:45:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D93186B0092; Fri, 29 Mar 2024 00:45:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBE976B0095; Fri, 29 Mar 2024 00:45:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9964D6B008A for <linux-mm@kvack.org>; Fri, 29 Mar 2024 00:45:23 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 58884160F62 for <linux-mm@kvack.org>; Fri, 29 Mar 2024 04:45:23 +0000 (UTC) X-FDA: 81948837726.24.369BEF6 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by imf08.hostedemail.com (Postfix) with ESMTP id 82C5516000C for <linux-mm@kvack.org>; Fri, 29 Mar 2024 04:45:21 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=gzC3s+aU; dmarc=none; spf=pass (imf08.hostedemail.com: domain of debug@rivosinc.com designates 209.85.210.181 as permitted sender) smtp.mailfrom=debug@rivosinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711687521; 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=3HlYvLaJr4l3bVtwLdV9ET8gn8bkDD3ErKtF/Cp9Ezk=; b=LkjtXqr8M0FT90yzDR07OPXDu+l1nJOfHvSClBmvY3CIKv6xAWZ4/EyS7STXYsSl6zWLxR goIbd1Xx1lSP1HgmEWs71GEjZ23OzHC6BXwp2Trt95ZRYZ1j3jv2US/k5yww3+jGlfFejq YFKMuV5s4DYki/eGWO7nuxgTGP7CKSU= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=gzC3s+aU; dmarc=none; spf=pass (imf08.hostedemail.com: domain of debug@rivosinc.com designates 209.85.210.181 as permitted sender) smtp.mailfrom=debug@rivosinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711687521; a=rsa-sha256; cv=none; b=nUdieyp9L/1Xl5SzTY+vQqYojYCB5rYdsy1BlI8bSdlNHCZP+TAV6yhAePc9bTnSXg6tgI eDnY58OUrFOo1xCFQLM7hbUKrQveM/LwNVaBGnslNNS5CowEDmpm7wRebsNxWPpguY4bat 2IUhXqipKMSkpzzQ8+lf9uPY9wcx5+Y= Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6e6082eab17so1501181b3a.1 for <linux-mm@kvack.org>; Thu, 28 Mar 2024 21:45:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1711687520; x=1712292320; 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=3HlYvLaJr4l3bVtwLdV9ET8gn8bkDD3ErKtF/Cp9Ezk=; b=gzC3s+aUCJgkJNbuciXpYP9AOkY8z66FAtVI6pziilEDOTXXqGKS0GJDj8C0H45G6l vNprqAkZC6xTuFW+EQBpY9Xhi0Z2sMJ3Oo/NIGKCeGK06Do0eapy8NUHKxFg/t58Z1F+ lX3psSzMuTIdbdUuPVnFlxIdSQa9evjLHBOr5Nu2gCHfsZSqnJIJgcGvBXtXTtDD6d/I OECPhY0AiBprLA/VXgQGIznTK386uBkBb0fSDwoqrapHFeSKw0JA44Q4zJk37ECyCvK7 q93G40IVIwTnhshibmi5MNw0rpBsDbpRzyC+SAIlOSnl3kwlf7nvKkUV6LJ1J9OF2ZHz byXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711687520; x=1712292320; 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=3HlYvLaJr4l3bVtwLdV9ET8gn8bkDD3ErKtF/Cp9Ezk=; b=mGNqlGv32GbyV5/dsmp9Yc5WBvwBdDHaI9Ggybpj1K39GZ8mAPdzV0BYP/Ik2Gps+G SqepYA2cLkI2Yix29VjDVyZn67epxvRKFsVNaOQUXpseqa3V6MngIBVJ82w83RbUS69+ JYLHBZsA1uaFclA41TLRij6OX9gQPZVaBPAwMXmm9aDbUx5KSq4Zine7fUhXDy6YpmFo HGd0MYrgoP8EHWs9mfZKI09iR3t6gchPMBLCf7g2+BAJMq0Y9LM5ni2WYTtE44sxTmRN zw50Bf+ho1DXZtp6h2aQzsaN+bXQqiOU5cCvck3L9R/cv3+JwuV8/H/IrRX0c56eh5I1 J+6g== X-Forwarded-Encrypted: i=1; AJvYcCWzlIQVk2Ax/+B3alRq01mAGy8aIF4EUDI+2Jtfl4dJRFLmdzTKfTynBKkBMZQ6GsjALUogtKnA3nfeMQt2JG81pWM= X-Gm-Message-State: AOJu0YzFLilwIoED80NIwgS9tBI4pNBdu9HAmtRtFMOaWwcfdJNtIH2r aPB+kv8I1Ur3HnpK4sE6OmjRzNMDc7lql36kdj4aEhOzoKC/AB6pC0xSeg09Y5Y= X-Google-Smtp-Source: AGHT+IFTo+txCMZKEE06IZ+V4dIOgngRem/aEEKbckfraBrrpL/AYZj752mW4B4fwSBOz0hRyqWgfA== X-Received: by 2002:a05:6a00:1c85:b0:6ea:c7bb:187b with SMTP id y5-20020a056a001c8500b006eac7bb187bmr1078563pfw.5.1711687520251; Thu, 28 Mar 2024 21:45:20 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id i18-20020aa78b52000000b006ea7e972947sm2217120pfd.130.2024.03.28.21.45.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 21:45:19 -0700 (PDT) From: Deepak Gupta <debug@rivosinc.com> To: paul.walmsley@sifive.com, rick.p.edgecombe@intel.com, broonie@kernel.org, Szabolcs.Nagy@arm.com, kito.cheng@sifive.com, keescook@chromium.org, ajones@ventanamicro.com, conor.dooley@microchip.com, cleger@rivosinc.com, atishp@atishpatra.org, alex@ghiti.fr, bjorn@rivosinc.com, alexghiti@rivosinc.com, samuel.holland@sifive.com, palmer@sifive.com, conor@kernel.org, linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: corbet@lwn.net, tech-j-ext@lists.risc-v.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, oleg@redhat.com, akpm@linux-foundation.org, arnd@arndb.de, ebiederm@xmission.com, Liam.Howlett@oracle.com, vbabka@suse.cz, lstoakes@gmail.com, shuah@kernel.org, brauner@kernel.org, debug@rivosinc.com, andy.chiu@sifive.com, jerry.shih@sifive.com, hankuan.chen@sifive.com, greentime.hu@sifive.com, evan@rivosinc.com, xiao.w.wang@intel.com, charlie@rivosinc.com, apatel@ventanamicro.com, mchitale@ventanamicro.com, dbarboza@ventanamicro.com, sameo@rivosinc.com, shikemeng@huaweicloud.com, willy@infradead.org, vincent.chen@sifive.com, guoren@kernel.org, samitolvanen@google.com, songshuaishuai@tinylab.org, gerg@kernel.org, heiko@sntech.de, bhe@redhat.com, jeeheng.sia@starfivetech.com, cyy@cyyself.name, maskray@google.com, ancientmodern4@gmail.com, mathis.salmen@matsal.de, cuiyunhui@bytedance.com, bgray@linux.ibm.com, mpe@ellerman.id.au, baruch@tkos.co.il, alx@kernel.org, david@redhat.com, catalin.marinas@arm.com, revest@chromium.org, josh@joshtriplett.org, shr@devkernel.io, deller@gmx.de, omosnace@redhat.com, ojeda@kernel.org, jhubbard@nvidia.com Subject: [PATCH v2 02/27] riscv: define default value for envcfg Date: Thu, 28 Mar 2024 21:44:34 -0700 Message-Id: <20240329044459.3990638-3-debug@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240329044459.3990638-1-debug@rivosinc.com> References: <20240329044459.3990638-1-debug@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 82C5516000C X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: fsm1g7bo5dupx7kbp8undtw85zk1o56g X-HE-Tag: 1711687521-944358 X-HE-Meta: U2FsdGVkX19XtwrjaAMcKrb6XpKy5zYOrAxrk2tJhaRRhfhvkoa0z94boYqdyTbcO7Oe+UgXG2gPs/6Jyu/4zTVnyLGJ14a1s/daeV4TQdMhML5NPBf21m9JB4yeJ7fT3sHD+IS/BAyhGL7AeDeViDgB9tus4lvobc+UFaELZXLs2S5T7Egz0k62kgEZ4WkGYmjKdAm5kf+DBUgMOB7lvaUUb6s0sBAV3EzO9geher0QPhdQx/XU6GGJ/8uQLoNucfYSSL71JDDO1r0bkwRjUIdRTH+wRbiQPN1pBHnyjl28un9gZHGQpsbYu4yMEB9uamy37+9G5V8SX/bo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nY4aCGQ7MiSea29ZK3YwRRgyoP9zcRjNg98so1ml61y7ZObrn43OuU6CXiggee40dp4nNN7KmDbTmXnKjuV7TTMgvEV2/SPoph1ydyxkurRy8= 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 |
riscv control-flow integrity for usermode
|
expand
|
diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h index 2468c55933cd..bbd2207adb39 100644 --- a/arch/riscv/include/asm/csr.h +++ b/arch/riscv/include/asm/csr.h @@ -202,6 +202,8 @@ #define ENVCFG_CBIE_FLUSH _AC(0x1, UL) #define ENVCFG_CBIE_INV _AC(0x3, UL) #define ENVCFG_FIOM _AC(0x1, UL) +/* by default all threads should be able to zero cache */ +#define ENVCFG_BASE ENVCFG_CBZE /* Smstateen bits */ #define SMSTATEEN0_AIA_IMSIC_SHIFT 58 diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c index 92922dbd5b5c..9a85c9d4c902 100644 --- a/arch/riscv/kernel/process.c +++ b/arch/riscv/kernel/process.c @@ -152,6 +152,7 @@ void start_thread(struct pt_regs *regs, unsigned long pc, else regs->status |= SR_UXL_64; #endif + current->thread_info.envcfg = ENVCFG_BASE; } void flush_thread(void)
Defines a base default value for envcfg per task. By default all tasks should have cache zeroing capability. Any future base capabilities that apply to all tasks can be turned on same way. Signed-off-by: Deepak Gupta <debug@rivosinc.com> --- arch/riscv/include/asm/csr.h | 2 ++ arch/riscv/kernel/process.c | 1 + 2 files changed, 3 insertions(+)