lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 16 Jul 2020 20:22:15 +0200
From:   Thomas Gleixner <tglx@...utronix.de>
To:     LKML <linux-kernel@...r.kernel.org>
Cc:     x86@...nel.org, linux-arch@...r.kernel.org,
        Will Deacon <will@...nel.org>, Arnd Bergmann <arnd@...db.de>,
        Mark Rutland <mark.rutland@....com>,
        Kees Cook <keescook@...omium.org>,
        Keno Fischer <keno@...iacomputing.com>,
        Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org
Subject: [patch V3 07/13] x86/ptrace: Provide pt_regs helpers for entry/exit

As a preparatory step for moving the syscall and interrupt entry/exit
handling into generic code, provide pt_regs helpers which allow to:

  - Retrieve the syscall number from pt_regs
  - Retrieve the syscall return value from pt_regs
  - Retrieve the interrupt state from pt_regs to check whether interrupts
    are reenabled by return from interrupt/exception.

Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
 arch/x86/include/asm/ptrace.h |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -209,6 +209,21 @@ static inline void user_stack_pointer_se
 	regs->sp = val;
 }
 
+static inline unsigned long regs_syscall_nr(struct pt_regs *regs)
+{
+	return regs->orig_ax;
+}
+
+static inline long regs_syscall_retval(struct pt_regs *regs)
+{
+	return regs->ax;
+}
+
+static __always_inline bool regs_irqs_disabled(struct pt_regs *regs)
+{
+	return !(regs->flags & X86_EFLAGS_IF);
+}
+
 /* Query offset/name of register from its name/offset */
 extern int regs_query_register_offset(const char *name);
 extern const char *regs_query_register_name(unsigned int offset);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ