From patchwork Thu Sep 12 23:16:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Gupta X-Patchwork-Id: 13802845 Return-Path: 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 AB5CEEEE271 for ; Thu, 12 Sep 2024 23:18:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 41CDD6B00B8; Thu, 12 Sep 2024 19:18:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A5826B00B9; Thu, 12 Sep 2024 19:18:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A8EB8D0003; Thu, 12 Sep 2024 19:18:46 -0400 (EDT) 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 EE9CB6B00B8 for ; Thu, 12 Sep 2024 19:18:45 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A7AE0120CCE for ; Thu, 12 Sep 2024 23:18:45 +0000 (UTC) X-FDA: 82557653010.20.2BEC944 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by imf05.hostedemail.com (Postfix) with ESMTP id BC238100002 for ; Thu, 12 Sep 2024 23:18:43 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=LEcJbfYF; spf=pass (imf05.hostedemail.com: domain of debug@rivosinc.com designates 209.85.216.43 as permitted sender) smtp.mailfrom=debug@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726183017; 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=+38J+w59/fsg+wZPwkpHjWKQt6YBaFGJt3wtFmX9cIM=; b=c62VK1zBghxgSMdk40c0YIB4bgGz4wkk7sgHHvHJCcZ/+vnFItipVZ3tek7Idi3D5vwEyx AOnYV3FDHrIOGPrjy/gywSnYl6cV2FDIiuYlfMiqRWY3ps+weN6/CW3rVg9CFdxd3ws9cu DN2cAB0Jvs1Deh36fiKMAy9geK7MfQ4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726183017; a=rsa-sha256; cv=none; b=XobwDZdlYiwYB1woE7EIv1WM8/3KZo4OdMib2ubh7g6SJ6Q7vRNzOG1fshW36S+UK0Ve9x Fam1eDJdcGJSFASKDLqtlNXhx2kCMyEOPDgCtJJ/4UcthZAtE+ql89To2KoQX3k8M6Pa/g HA1BqmvC75g1nDaWb/rY3mPu7KPsjy4= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=LEcJbfYF; spf=pass (imf05.hostedemail.com: domain of debug@rivosinc.com designates 209.85.216.43 as permitted sender) smtp.mailfrom=debug@rivosinc.com; dmarc=none Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-2d86f71353dso1108634a91.2 for ; Thu, 12 Sep 2024 16:18:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1726183122; x=1726787922; 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=+38J+w59/fsg+wZPwkpHjWKQt6YBaFGJt3wtFmX9cIM=; b=LEcJbfYF23TCwemd2S51vn91guuPGjkucSXxB14VjqZTbzm2JOl3vQ1YtO/ZImhwwT CRZu3JAg4FZcqO/aCn40WoaVAWxCBe42qtXNCd5fNXf+swq94MlrJdIjAdF9LV7+XExc fcC+q6rocpbBs54AKkLR1TeKvzFWRzIM21W+a9EIRG5sdtgjGj8McLIu6z/xPkB7cEio XJQ4OFB77MerYXLXweP+GG28xFMoTDOQnvHPGghjJBgzHj/CMz4uxJt3WSFr+9nikvVn d3+q05IJpw4Zr/EScrWw2e+eYiZwX+RIBCNSm20E+IEXzSxh+urB1nIAvRV4tbgdvKe0 c7Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726183122; x=1726787922; 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=+38J+w59/fsg+wZPwkpHjWKQt6YBaFGJt3wtFmX9cIM=; b=H6L97qx+wEe8t5WGysKaLA3S68becaMOWD2Njhzk6D+ihB4tmugtsA2JN9b6khLi8D Xkzcl0OT5+roHrOtjW10gmWVovStl1gGC1SitODKypl+TVGgJPeZmaHWEP/ALLhyI/C7 M9RUbdEyhShHAX36S4YKZkwjdHVsPZcapDcR6xPDslcVOQ1+79Jh0bh1fvZggQjEzJ1V MUlaEStML0QojOh9MFoe7In7JkOsolhe9KD2948vsNMj1LGxC7ExMt8G+rFjbkhlT7ZX 2SvOmRGNlsNz7fj1GJBB0KuzA8BGRgCgFt6S7She/lwxRr9F4T4M6koOiUxVIFHU2icK 8Rlw== X-Forwarded-Encrypted: i=1; AJvYcCWsVFa36c5ApXXSejnzT8RT25GR3AXGJ/NuV5s/hzL78U3hBKLAWCjb3XwmXBnKR2m1L8O9E6riig==@kvack.org X-Gm-Message-State: AOJu0Yx7OB0wo/6bSuqslDrivzsVCGAPkEwg12BCtfklxpkeOuhUFkm4 9h4tgv8xJVp4+jqDgavYZQmrMok65oQnP2P2SjdOHnOkCX+Kp5sDuunWByG6KDM= X-Google-Smtp-Source: AGHT+IHfT/S6FiX6u36xFuQAdjiVXSnBTlg8zgoeNqcnzuIIMjt0legeBCv+aVmkm3X/I1OJo91O6Q== X-Received: by 2002:a17:90a:4b44:b0:2da:9115:15ce with SMTP id 98e67ed59e1d1-2db9ff94036mr4324100a91.15.1726183122337; Thu, 12 Sep 2024 16:18:42 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2db6c1ac69asm3157591a91.0.2024.09.12.16.18.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Sep 2024 16:18:42 -0700 (PDT) From: Deepak Gupta To: paul.walmsley@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-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: corbet@lwn.net, palmer@dabbelt.com, aou@eecs.berkeley.edu, robh@kernel.org, krzk+dt@kernel.org, oleg@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, peterz@infradead.org, akpm@linux-foundation.org, arnd@arndb.de, ebiederm@xmission.com, kees@kernel.org, Liam.Howlett@oracle.com, vbabka@suse.cz, lorenzo.stoakes@oracle.com, shuah@kernel.org, brauner@kernel.org, samuel.holland@sifive.com, debug@rivosinc.com, andy.chiu@sifive.com, jerry.shih@sifive.com, greentime.hu@sifive.com, charlie@rivosinc.com, evan@rivosinc.com, cleger@rivosinc.com, xiao.w.wang@intel.com, ajones@ventanamicro.com, anup@brainfault.org, mchitale@ventanamicro.com, atishp@rivosinc.com, sameo@rivosinc.com, bjorn@rivosinc.com, alexghiti@rivosinc.com, david@redhat.com, libang.li@antgroup.com, jszhang@kernel.org, leobras@redhat.com, guoren@kernel.org, samitolvanen@google.com, songshuaishuai@tinylab.org, costa.shul@redhat.com, bhe@redhat.com, zong.li@sifive.com, puranjay@kernel.org, namcaov@gmail.com, antonb@tenstorrent.com, sorear@fastmail.com, quic_bjorande@quicinc.com, ancientmodern4@gmail.com, ben.dooks@codethink.co.uk, quic_zhonhan@quicinc.com, cuiyunhui@bytedance.com, yang.lee@linux.alibaba.com, ke.zhao@shingroup.cn, sunilvl@ventanamicro.com, tanzhasanwork@gmail.com, schwab@suse.de, dawei.li@shingroup.cn, rppt@kernel.org, willy@infradead.org, usama.anjum@collabora.com, osalvador@suse.de, ryan.roberts@arm.com, andrii@kernel.org, alx@kernel.org, catalin.marinas@arm.com, broonie@kernel.org, revest@chromium.org, bgray@linux.ibm.com, deller@gmx.de, zev@bewilderbeest.net Subject: [PATCH v4 22/30] riscv sigcontext: cfi state struct definition for sigcontext Date: Thu, 12 Sep 2024 16:16:41 -0700 Message-ID: <20240912231650.3740732-23-debug@rivosinc.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240912231650.3740732-1-debug@rivosinc.com> References: <20240912231650.3740732-1-debug@rivosinc.com> MIME-Version: 1.0 X-Stat-Signature: 9fekpc7cqfrxno7oyrutaemfpe6oia3y X-Rspamd-Queue-Id: BC238100002 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1726183123-965896 X-HE-Meta: U2FsdGVkX18bmG69LK+b35UoSkl7qWCk/HXUaHz3KZI/vh7cKSF/nBh18jSTXsTKIG4Hw1lBTSikT4C5pmtudvlQIUIUT3Nge1MLl9rUqoVg0BtixtxHhsCH85yi2PTbAox8BKr3W6fkfH01Ih+QB1AaXeMZCPKA3OFyTWFylrnkZ/UWVr1nCykb6AyjA3oElM8wyRmldTq1R2us0RQiW/dSZ2GwXcs7ZAugMdfOKMpjGUgjBvH54xwPs6gfwPkK0ML4awNNYso6FN9IOlxiS3432LcqLg7bBrT3y62bcf2LRPUnlemsLDO240TTotpqpNJbvgL8B8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Qmsusvkm1sLI8f6yOd53/0pHBmRaqHCz2 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000839, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Shadow stack needs to be saved and restored on signal delivery and signal return. sigcontext embedded in ucontext is extendible. Defining cfi state in there which can be used to save cfi state before signal delivery and restore cfi state on sigreturn Signed-off-by: Deepak Gupta --- arch/riscv/include/uapi/asm/sigcontext.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/riscv/include/uapi/asm/sigcontext.h b/arch/riscv/include/uapi/asm/sigcontext.h index cd4f175dc837..c4d19a10651d 100644 --- a/arch/riscv/include/uapi/asm/sigcontext.h +++ b/arch/riscv/include/uapi/asm/sigcontext.h @@ -21,6 +21,9 @@ struct __sc_riscv_v_state { struct __riscv_v_ext_state v_state; } __attribute__((aligned(16))); +struct __sc_riscv_cfi_state { + unsigned long ss_ptr; /* shadow stack pointer */ +}; /* * Signal context structure *