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-next>] [day] [month] [year] [list]
Date:   Fri, 31 Jul 2020 10:56:16 +0800
From:   Jin Yao <yao.jin@...ux.intel.com>
To:     peterz@...radead.org, mingo@...hat.com, oleg@...hat.com,
        acme@...nel.org, jolsa@...nel.org
Cc:     Linux-kernel@...r.kernel.org, ak@...ux.intel.com,
        kan.liang@...el.com, yao.jin@...el.com,
        alexander.shishkin@...ux.intel.com, mark.rutland@....com,
        Jin Yao <yao.jin@...ux.intel.com>
Subject: [PATCH v1 1/2] Missing instruction_pointer_set() instances

There is a potential security issue that perf kernel samples
may be leaked even though kernel sampling is disabled. For fixing
the potential leakage, the idea is to use instruction_pointer_set
to set invalid ip address in leaked perf samples in some cases.

But instruction_pointer_set is missing on some architectures.
Define instruction_pointer_set for these architectures.

Signed-off-by: Jin Yao <yao.jin@...ux.intel.com>
---
 arch/alpha/include/asm/ptrace.h  | 6 ++++++
 arch/arc/include/asm/ptrace.h    | 6 ++++++
 arch/nds32/include/asm/ptrace.h  | 7 +++++++
 arch/xtensa/include/asm/ptrace.h | 6 ++++++
 4 files changed, 25 insertions(+)

diff --git a/arch/alpha/include/asm/ptrace.h b/arch/alpha/include/asm/ptrace.h
index df5f317ab3fc..c464d525c110 100644
--- a/arch/alpha/include/asm/ptrace.h
+++ b/arch/alpha/include/asm/ptrace.h
@@ -25,4 +25,10 @@ static inline unsigned long regs_return_value(struct pt_regs *regs)
 	return regs->r0;
 }
 
+static inline void instruction_pointer_set(struct pt_regs *regs,
+					   unsigned long val)
+{
+	regs->pc = val;
+}
+
 #endif
diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h
index 2fdb87addadc..8869a6c0fe8c 100644
--- a/arch/arc/include/asm/ptrace.h
+++ b/arch/arc/include/asm/ptrace.h
@@ -154,6 +154,12 @@ static inline long regs_return_value(struct pt_regs *regs)
 	return (long)regs->r0;
 }
 
+static inline void instruction_pointer_set(struct pt_regs *regs,
+					   unsigned long val)
+{
+	regs->ret = val;
+}
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* __ASM_PTRACE_H */
diff --git a/arch/nds32/include/asm/ptrace.h b/arch/nds32/include/asm/ptrace.h
index 919ee223620c..19a916bef7f5 100644
--- a/arch/nds32/include/asm/ptrace.h
+++ b/arch/nds32/include/asm/ptrace.h
@@ -62,6 +62,13 @@ static inline unsigned long regs_return_value(struct pt_regs *regs)
 {
 	return regs->uregs[0];
 }
+
+static inline void instruction_pointer_set(struct pt_regs *regs,
+					   unsigned long val)
+{
+	regs->ipc = val;
+}
+
 extern void show_regs(struct pt_regs *);
 /* Avoid circular header include via sched.h */
 struct task_struct;
diff --git a/arch/xtensa/include/asm/ptrace.h b/arch/xtensa/include/asm/ptrace.h
index b109416dc07e..82ab1ba99259 100644
--- a/arch/xtensa/include/asm/ptrace.h
+++ b/arch/xtensa/include/asm/ptrace.h
@@ -90,6 +90,12 @@ struct pt_regs {
 # define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \
 					       (regs)->areg[1]))
 
+static inline void instruction_pointer_set(struct pt_regs *regs,
+					   unsigned long val)
+{
+	regs->pc = val;
+}
+
 # ifndef CONFIG_SMP
 #  define profile_pc(regs) instruction_pointer(regs)
 # else
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ