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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250404083442.5317827966254c89382cc3f4@kernel.org>
Date: Fri, 4 Apr 2025 08:34:42 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Qinxin Xia <xiaqinxin@...wei.com>, Mark Rutland <mark.rutland@....com>
Cc: <yangyicong@...wei.com>, <catalin.marinas@....com>, <will@...nel.org>,
 <naveen.n.rao@...ux.ibm.com>, <anil.s.keshavamurthy@...el.com>,
 <davem@...emloft.net>, <linuxarm@...wei.com>,
 <linux-kernel@...r.kernel.org>, <fanghao11@...wei.com>,
 <prime.zeng@...ilicon.com>, <xuwei5@...wei.com>,
 <jonathan.cameron@...wei.com>
Subject: Re: [PATCH v7] arm64: kprobe: Enable OPTPROBE for arm64

On Sun, 16 Feb 2025 15:00:44 +0800
Qinxin Xia <xiaqinxin@...wei.com> wrote:

> 
> +#define        OPT_SLOT_SIZE   65536
> +
> +	.global optinsn_slot
> +optinsn_slot:
> +	.space  OPT_SLOT_SIZE
> +
> +SYM_CODE_START(optprobe_common)
> +	stp x2, x3, [sp, #S_X2]
> +	stp x4, x5, [sp, #S_X4]
> +	stp x6, x7, [sp, #S_X6]
> +	stp x8, x9, [sp, #S_X8]
> +	stp x10, x11, [sp, #S_X10]
> +	stp x12, x13, [sp, #S_X12]
> +	stp x14, x15, [sp, #S_X14]
> +	stp x16, x17, [sp, #S_X16]
> +	stp x18, x19, [sp, #S_X18]
> +	stp x20, x21, [sp, #S_X20]
> +	stp x22, x23, [sp, #S_X22]
> +	stp x24, x25, [sp, #S_X24]
> +	stp x26, x27, [sp, #S_X26]
> +	stp x28, x29, [sp, #S_X28]
> +	add x2, sp, #PT_REGS_SIZE
> +	str x2, [sp, #S_SP]
> +	/* Construct a useful saved PSTATE */
> +	mrs x2, nzcv
> +	mrs x3, daif
> +	orr x2, x2, x3
> +	mrs x3, CurrentEL
> +	orr x2, x2, x3
> +	mrs x3, SPSel
> +	orr x2, x2, x3
> +	adr x1, 2f
> +	stp x1, x2, [sp, #S_PC]
> +
> +	/* set the pt_regs address to x1 */
> +	mov x1, sp
> +	/* store lr of optprobe_common temporary */
> +	stp x29, x30, [sp, #-16]!
> +	mov x29, sp
> +
> +	bl optprobe_optimized_callback
> +
> +	ldp x29, x30, [sp], #16
> +
> +	ldr x0, [sp, #S_PSTATE]
> +	and x0, x0, #(PSR_N_BIT | PSR_Z_BIT | PSR_C_BIT | PSR_V_BIT)
> +	msr nzcv, x0

BTW, can this code save all registers including flags?
Previously I talked with Mark and he mentioned there is no way to
save pstate register correctly. That is why we could not implement
this feature.


Thank you,


-- 
Masami Hiramatsu (Google) <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ