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] [day] [month] [year] [list]
Message-ID: <268c5c53-10c9-2c01-20d6-327e19184fed@huawei.com>
Date: Sat, 19 Oct 2024 15:47:23 +0800
From: Li Huafei <lihuafei1@...wei.com>
To: Athira Rajeev <atrajeev@...ux.vnet.ibm.com>
CC: <namhyung@...nel.org>, <peterz@...radead.org>, <mingo@...hat.com>,
	<acme@...nel.org>, <mark.rutland@....com>,
	<alexander.shishkin@...ux.intel.com>, <jolsa@...nel.org>,
	<irogers@...gle.com>, <adrian.hunter@...el.com>, <kan.liang@...ux.intel.com>,
	<kjain@...ux.ibm.com>, <sesse@...gle.com>,
	<linux-perf-users@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/3] perf disasm: Use disasm_line__free() to properly free
 disasm_line



On 2024/10/15 21:55, Athira Rajeev wrote:
> 
> 
>> On 14 Oct 2024, at 5:12 PM, Li Huafei <lihuafei1@...wei.com> wrote:
>>
>> The structure disasm_line contains members that require dynamically
>> allocated memory and need to be freed correctly using
>> disasm_line__free().
>>
>> This patch fixes the incorrect freeing in
>> symbol__disassemble_capstone_powerpc().  Also, since cs_disasm is not
>> enabled, it does not need to handle the situation described in
>> symbol__disassemble_capstone() where "offset != len" may occur due to
>> unknown instructions.
>>
>> Fixes: c5d60de1813a ("perf annotate: Add support to use libcapstone in powerpc")
>> Signed-off-by: Li Huafei <lihuafei1@...wei.com>
> 
> For the patches
> 
> Tested-by: Athira Rajeev <atrajeev@...ux.vnet.ibm.com <mailto:atrajeev@...ux.vnet.ibm.com>>
> 

Thank you for the testing. As suggested by Namhyung in patch 3, the
patches need some modifications. I have sent v2, and if there are any
issues with v2, please let me know.

Thanks,
Huafei

> Thanks
> Athira
>> ---
>> tools/perf/util/disasm.c | 16 +---------------
>> 1 file changed, 1 insertion(+), 15 deletions(-)
>>
>> diff --git a/tools/perf/util/disasm.c b/tools/perf/util/disasm.c
>> index 42222d61ceb5..40d99f4d5cc7 100644
>> --- a/tools/perf/util/disasm.c
>> +++ b/tools/perf/util/disasm.c
>> @@ -1580,20 +1580,6 @@ static int symbol__disassemble_capstone_powerpc(char *filename, struct symbol *s
>> offset += 4;
>> }
>>
>> - /* It failed in the middle */
>> - if (offset != len) {
>> - struct list_head *list = &notes->src->source;
>> -
>> - /* Discard all lines and fallback to objdump */
>> - while (!list_empty(list)) {
>> - dl = list_first_entry(list, struct disasm_line, al.node);
>> -
>> - list_del_init(&dl->al.node);
>> - disasm_line__free(dl);
>> - }
>> - count = -1;
>> - }
>> -
>> out:
>> if (needs_cs_close)
>> cs_close(&handle);
>> @@ -1612,7 +1598,7 @@ static int symbol__disassemble_capstone_powerpc(char *filename, struct symbol *s
>> */
>> list_for_each_entry_safe(dl, tmp, &notes->src->source, al.node) {
>> list_del(&dl->al.node);
>> - free(dl);
>> + disasm_line__free(dl);
>> }
>> }
>> count = -1;
>> -- 
>> 2.25.1
>>
> 
> 
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ