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:   Wed, 4 Jan 2023 16:34:35 +0800
From:   "liaochang (A)" <liaochang1@...wei.com>
To:     Björn Töpel <bjorn@...nel.org>,
        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>
Subject: Re: [PATCH v5 3/9] riscv/kprobe: Prepare the skeleton to prepare
 optimized kprobe



在 2023/1/3 2:03, Björn Töpel 写道:
> 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".

OK,i will use AUIPC/JALR in all commit messages and comments of this series.

> 
>> +	 */
>> +	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.

OK, BTW, i think the code following tag on_error is fairly self-explanatoty,
perhaps this comment is no need anymore.

> 
> 
> Björn

-- 
BR,
Liao, Chang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ