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]
Message-ID: <87v8lovmoa.fsf@all.your.base.are.belong.to.us>
Date:   Mon, 02 Jan 2023 19:03:33 +0100
From:   Björn Töpel <bjorn@...nel.org>
To:     Chen Guokai <chenguokai17@...ls.ucas.ac.cn>,
        paul.walmsley@...ive.com, palmer@...belt.com,
        aou@...s.berkeley.edu, rostedt@...dmis.org, mingo@...hat.com,
        sfr@...b.auug.org.au
Cc:     linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
        liaochang1@...wei.com, Chen Guokai <chenguokai17@...ls.ucas.ac.cn>
Subject: Re: [PATCH v5 3/9] riscv/kprobe: Prepare the skeleton to prepare
 optimized kprobe

Chen Guokai <chenguokai17@...ls.ucas.ac.cn> writes:

> From: Liao Chang <liaochang1@...wei.com>

>  arch/riscv/kernel/probes/opt.c | 107 ++++++++++++++++++++++++++++++++-
>
> diff --git a/arch/riscv/kernel/probes/opt.c b/arch/riscv/kernel/probes/opt.c
> index 56c8a227c857..a4271e6033ba 100644
> --- a/arch/riscv/kernel/probes/opt.c
> +++ b/arch/riscv/kernel/probes/opt.c

> @@ -24,7 +72,64 @@ int arch_check_optimized_kprobe(struct optimized_kprobe *op)
>  int arch_prepare_optimized_kprobe(struct optimized_kprobe *op,
>  				  struct kprobe *orig)
>  {
> -	return 0;
> +	long rel;
> +	int rd, ra, ret;
> +	kprobe_opcode_t *code = NULL, *slot = NULL;
> +
> +	if (!can_optimize((unsigned long)orig->addr, op))
> +		return -EILSEQ;
> +
> +	code = kzalloc(MAX_OPTINSN_SIZE, GFP_KERNEL);
> +	slot = get_optinsn_slot();
> +	if (!code || !slot) {
> +		ret = -ENOMEM;
> +		goto on_error;
> +	}
> +
> +	/*
> +	 * Verify if the address gap is within 4GB range, because this uses
> +	 * a auipc+jalr pair.

Try to be consistent. You're mixing "AUIPC/JALR" with "auipc+jalr".

> +	 */
> +	rel = (unsigned long)slot - (unsigned long)orig->addr;
> +	if (!in_auipc_jalr_range(rel)) {
> +		/*
> +		 * Different from x86, we free code buf directly instead
> of

Reword for readers that are not familiar with x86.


Björn

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ