[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v10 16/38] x86/ptrace: Add FRED additional information to the pt_regs structure
- To: Xin Li <xin3.li@xxxxxxxxx>, linux-doc@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-edac@xxxxxxxxxxxxxxx, linux-hyperv@xxxxxxxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
- From: Nikolay Borisov <nik.borisov@xxxxxxxx>
- Date: Wed, 20 Sep 2023 15:57:20 +0300
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rsfk6HkGCqPcF9+Kkje7EojINs0xmHo2oq3TsscSXGQ=; b=NNXaukbWObrLJe3AD2f2O/fDYt1hqquUdfrviFmZBzqU0ok9TzreOp/Ci/ROXWEyC5XvAn2YulGEFIADtFMZpIK9FknK/O8Xrp+o0X14AuWyJ89FzBW6LlDB39QAvmo8esHSrlyvUyS4mE5EZWyN/zTsWe+VB0gJ7qSvnPpeVuwvmLBkaBU7BZB2zhWMKaEZzdGIyppftZnWgF1jc7J8jJup/G+HIIaL66PhS1aoZ7SgAL5ksmICPzF8KCaI4RTuGL0KZODpLagQZmu3II36J3HbwMHSL/5zwRQHk1kv3gNeCi12c04+GyadRf3fp/RsXFsRsxOeRvaPO7TOlHobZw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YAZVgqnoySM1SFPM72YJjzQGGbWBVNLbEdbKsHX3g9Pbfa1zVS7u9FE86jxte9HYaoGV2EqpLkEhMp933VkXaSo9rpHMJXOneRW7qWVe5fgv8s8l4FgYm3tTDJZD22x/gDQaHzsOZRQ0QuPn70H/RLCm0cuFVyQ2fHME/sqfXPDRyD2M+N+wN7CHKzidS2w7K7dC1L1+++IuASsiP527PcbybM0C8nAp4sLmmp0aWcjydwRu7cn/ccY7yr09k6ZpqBwgKl8EWeLCXUd4lGu3ug4fVMJBeuC3C7lZMDobRo30AujIsHkaEFH0Pt5hltuX1diA31MQ9FU6A2xC/KloNg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: tglx@xxxxxxxxxxxxx, mingo@xxxxxxxxxx, bp@xxxxxxxxx, dave.hansen@xxxxxxxxxxxxxxx, x86@xxxxxxxxxx, hpa@xxxxxxxxx, luto@xxxxxxxxxx, pbonzini@xxxxxxxxxx, seanjc@xxxxxxxxxx, peterz@xxxxxxxxxxxxx, jgross@xxxxxxxx, ravi.v.shankar@xxxxxxxxx, mhiramat@xxxxxxxxxx, andrew.cooper3@xxxxxxxxxx, jiangshanlai@xxxxxxxxx
- Delivery-date: Wed, 20 Sep 2023 12:57:38 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 14.09.23 г. 7:47 ч., Xin Li wrote:
FRED defines additional information in the upper 48 bits of cs/ss
fields. Therefore add the information definitions into the pt_regs
structure.
Specially introduce a new structure fred_ss to denote the FRED flags
above SS selector, which avoids FRED_SSX_ macros and makes the code
simpler and easier to read.
Signed-off-by: H. Peter Anvin (Intel) <hpa@xxxxxxxxx>
Tested-by: Shan Kang <shan.kang@xxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Signed-off-by: Xin Li <xin3.li@xxxxxxxxx>
---
Changes since v9:
* Introduce a new structure fred_ss to denote the FRED flags above SS
selector, which avoids FRED_SSX_ macros and makes the code simpler
and easier to read (Thomas Gleixner).
* Use type u64 to define FRED bit fields instead of type unsigned int
(Thomas Gleixner).
Changes since v8:
* Reflect stack frame definition changes from FRED spec 3.0 to 5.0.
* Use __packed instead of __attribute__((__packed__)) (Borislav Petkov).
* Put all comments above the members, like the rest of the file does
(Borislav Petkov).
Changes since v3:
* Rename csl/ssl of the pt_regs structure to csx/ssx (x for extended)
(Andrew Cooper).
---
arch/x86/include/asm/ptrace.h | 51 +++++++++++++++++++++++++++++++----
1 file changed, 46 insertions(+), 5 deletions(-)
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index f08ea073edd6..5786c8ca5f4c 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -56,6 +56,25 @@ struct pt_regs {
#else /* __i386__ */
+struct fred_ss {
+ u64 ss : 16, // SS selector
Is this structure conformant to the return state as described in FRED 5.0?
— The stack segment of the interrupted context, 64 bits formatted as follows:
• Bits 15:0 contain the SS selector. < - WE HAVE THIS
• Bits 31:16 are not currently defined and will be zero until they are. < -
MISSING hole?
+ sti : 1, // STI state < -
+ swevent : 1, // Set if syscall, sysenter or INT n
+ nmi : 1, // Event is NMI type
+ : 13,
+ vector : 8, // Event vector
+ : 8,
+ type : 4, // Event type
+ : 4,
+ enclave : 1, // Event was incident to enclave execution
+ lm : 1, // CPU was in long mode
+ nested : 1, // Nested exception during FRED delivery
+ // not set for #DF
+ : 1,
+ insnlen : 4; // The length of the instruction causing the
event
+ // Only set for INT0, INT1, INT3, INT n, SYSCALL
+}; // and SYSENTER. 0 otherwise.
+
<Snip>
|