Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp3036820lqz; Wed, 3 Apr 2024 16:48:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWATL/9+8QsFwUh+oFw+2qCy5AQ+vCJxA4wEMY2LCp+swnvI5rJP8/3Gy/3Skl86JnQ1laaUqbw34l9jE13mxeqPySUPk7AxiurGjzEvg== X-Google-Smtp-Source: AGHT+IHzpmsqwQXWwbIemWl6PvACht+3ByZFjUiSl5Vj6zNTgrThsse09nPQvm0/AHWqS851sZ0B X-Received: by 2002:a17:906:b06:b0:a4a:3679:5514 with SMTP id u6-20020a1709060b0600b00a4a36795514mr546350ejg.48.1712188102617; Wed, 03 Apr 2024 16:48:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712188102; cv=pass; d=google.com; s=arc-20160816; b=NhUSssUFhCPlL2Aty98ahStMWvnKgD/G+4MbZQv5QZ3vjXlQFux32vUujbY55mZ/jp o/37R0HpjXx2lHtaGrDYP8kzfd3vJrfhUi9Eu2gGn31rQcz82geRDsivT9gPZJNeoZlZ WIkUWFS6LW7pZHMeM8Uhh3yKmAQJ53MZ7ozbUUIwW9ywSaSDGqg4iO07Jw2MW6HW17/Q /EOGkaEjxa2O9K+d+R7vtFkUSDWoRkru/zCAOKs76T3fsHLtqVN97n2gWPfUZTVfUmPY VYjaFVidlP2+hWyK0On30Uie4p4DC17PEiYszr6APo0XF+9I0wlsNMD/yD4foFk0ENNG 6RBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Qc6tDQVZMFWZI8yrez6t0wejTQ8xJVxgJAnHf9JsPCA=; fh=y4ARqtgSqtbB4y+WKtC9DmhQzNvXgfbUuH9cLPbtB/g=; b=g7OeU4WadwRJMiMceNDzHqysDgJVDhEIjDlXMa6/vE7EgkWHld0w3sZxaCH0qB8cfX 5k1hcAAuppdgPVyfkwXGl1tl13jKnqtWvMnyDJWtDTlDfmtNVhhI/mKbR0YHWmTLcCce ymkBxmtBbQ4oOIV7TZqvsnAYyU7e+phIiTlvm3p+zuILurAlCy6ExzEV7r/PJ8Gz/S7X UhabnsGPew+as7l+BmPNQwBFrdmzKA8KfqVD8aIF42hRU29+xcrEnPr3WIks1X5ZwCu4 hqqEFM4FbntyOMJnONhYs4du+jgV19EycmDLDtC58Y/TgiZsWvPHaHu6rBOZlL4xvxM+ Xptw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=zeonD28X; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-130741-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130741-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id j10-20020a170906474a00b00a4746bf1fc3si7291594ejs.775.2024.04.03.16.48.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 16:48:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130741-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=zeonD28X; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-130741-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130741-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2F7DA1F22836 for ; Wed, 3 Apr 2024 23:48:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B708415B11A; Wed, 3 Apr 2024 23:42:39 +0000 (UTC) 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="zeonD28X" Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 5D20115B0E2 for ; Wed, 3 Apr 2024 23:42:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712187758; cv=none; b=H1OZ858z8N/Apo6QAKAcyofoT0EsNfyIvlzCJCBK+UBfT6Hs101+CHgqKeDIHhxbqIxXT5ZE6M8bdA/pqToBm66VqYGTV1YrLxR8s5p80nxL80exMPnPrObDZq8sU/aPj/YFG380gvHFj8HZTsh/fHjM5ccTPRqXu5kInjwF6Xo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712187758; c=relaxed/simple; bh=pKLFkKzJOJ8TVEvV0fhdtvjJa4v5yVb6+o0QMASZ3Hg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FAhax5EqvkxHeShndSznmjp0uH1GqeWGDtUKak+1XwLyLfwyneom9m30BtZy0F/oHDrOJqwiwH8vO4Uxwpk5BjM0LL4AADEzLDfk1q77ig34o17V9JUfeVHoH0kly13QpHgVK0mEcL8So9RUqtXE+mVkUCQWh2nn5LDHg6NiSbw= 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=zeonD28X; arc=none smtp.client-ip=209.85.214.175 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 Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1e2a2d5f0b7so2878515ad.1 for ; Wed, 03 Apr 2024 16:42:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1712187757; x=1712792557; darn=vger.kernel.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=Qc6tDQVZMFWZI8yrez6t0wejTQ8xJVxgJAnHf9JsPCA=; b=zeonD28X8y+FbBr/1sLhYcVnrAHddElHMKnmeCwKi4dbok67AVeZwn0LlwQwqiXPiU PGEr6z1DIE7hog6DHEU8Qnh9cBt0/tuhYK9yky9U0GVHKAJhg/i2Zt+CRKAYf1aS9EZd r4aAqk3N9y64MDJ+l6pIrLb1Os+E6HWCyQXc0+aTvtjva+sT2wRfbQTWqCk7mMVoCy0S PsIeUS8+gi3CBkFAd4NDBSsT1DHzoZaeCulmT5NVlQg2NASCnQD1FOgi41lSfhWogFj3 lcxS2z/D7X1rxtQpaz1RgzV096xVoLLocVfyJK+xLrcfil6+MuSH6f6aQ2z1G3gmeuzz jUOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712187757; x=1712792557; 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=Qc6tDQVZMFWZI8yrez6t0wejTQ8xJVxgJAnHf9JsPCA=; b=a37sXT/431qN9im22rIVwD8eD9JEz/mjtez1EwY1Zs9eJL2yKjLN/gVveifFEFc/QJ YtAUmSMx0DVhTddoKVnbL8XEBD13/yLiXq7EERsod1NiDrX86kgF4WiAvCUzj7rcNcvc cEYFR4D0IfQ2Uvi3ZF9O9Spm+7ocBwtvtJ8aRTRDJznhquYc5E/2BrzVZn6hb4KYZp3j +lHt3nbf3eQDF06JNjF7DSxgd/m51QONHXUwGpV+QT0lswXLyzNsV/Z61mpY6L/LglMt KkjBgWSMOOh6N3Wj8kE8uJ03BpmWvysArqNUVEFuZLmv7hM1Rc2FEDkQGYhKaCs8FCHm 60jQ== X-Forwarded-Encrypted: i=1; AJvYcCWODIlMGA6xHb1v9osSgGjilZpW2LQB8kFpF3oUcZ13TZcN5NeN5m8vEm8IPUsJ2BSpcf15owwkg20m1z0GCLtbumJ7bicuf/DElBIR X-Gm-Message-State: AOJu0YyQIdb1cnQCwO9yji1NdDBYz7h5s7a6MEeAyppk2bgWsUzde4/j wbbq25O/InnZEwsQVvPg56rTIjwjRtIH9x1P3XOKsOgJ/lVkZmkk0xWmYf5R5tE= X-Received: by 2002:a17:902:d506:b0:1e0:cdbf:24c2 with SMTP id b6-20020a170902d50600b001e0cdbf24c2mr951254plg.29.1712187756641; Wed, 03 Apr 2024 16:42:36 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id b18-20020a170902d51200b001deeac592absm13899117plg.180.2024.04.03.16.42.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 16:42:36 -0700 (PDT) From: Deepak Gupta 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, conor@kernel.org Cc: 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, corbet@lwn.net, 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 v3 22/29] riscv sigcontext: adding cfi state field in sigcontext Date: Wed, 3 Apr 2024 16:35:10 -0700 Message-ID: <20240403234054.2020347-23-debug@rivosinc.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240403234054.2020347-1-debug@rivosinc.com> References: <20240403234054.2020347-1-debug@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Shadow stack needs to be saved and restored on signal delivery and signal return. sigcontext embedded in ucontext is extendible. Adding 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/riscv/include/uapi/asm/sigcontext.h b/arch/riscv/include/uapi/asm/sigcontext.h index cd4f175dc837..5ccdd94a0855 100644 --- a/arch/riscv/include/uapi/asm/sigcontext.h +++ b/arch/riscv/include/uapi/asm/sigcontext.h @@ -21,6 +21,10 @@ 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 */ + unsigned long rsvd; /* keeping another word reserved in case we need it */ +}; /* * Signal context structure * @@ -29,6 +33,7 @@ struct __sc_riscv_v_state { */ struct sigcontext { struct user_regs_struct sc_regs; + struct __sc_riscv_cfi_state sc_cfi_state; union { union __riscv_fp_state sc_fpregs; struct __riscv_extra_ext_header sc_extdesc; -- 2.43.2