Re: [RFC PATCH 8/9] btf_encoder: introduce btf_encoding_context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2024-11-28 at 01:24 +0000, Ihor Solodrai wrote:

Note, after applying this patch I see the following report from
address sanitizer:

Direct leak of 3640 byte(s) in 1 object(s) allocated from:
    #0 0x7f12d2ac2290 in calloc (/lib64/libasan.so.8+0xc2290) (BuildId: ...)
    #1 0x478775 in btf_encoder__new /home/eddy/work/dwarves-fork/btf_encoder.c:2562
    #2 0x416f98 in pahole_stealer /home/eddy/work/dwarves-fork/pahole.c:3257
    #3 0x49f9b9 in cu__finalize /home/eddy/work/dwarves-fork/dwarf_loader.c:3263

Which points to line:

    encoder->secinfo = calloc(encoder->seccnt, sizeof(*encoder->secinfo));

(when compiled with the following flags:
 -fsanitize=undefined,address -fsanitize-recover=address -fno-omit-frame-pointer)


[...]

> @@ -1355,19 +1400,15 @@ int btf_encoder__add_saved_funcs(struct btf_encoder *encoder)

Nit: should probably remove 'encoder' parameter and replace it with
     bool skip_encoding_inconsistent_proto
     (in one of the earlier patches, just noticed this).

>  		list_for_each_entry(s, &e->func_states, node)
>  			nr_saved_fns++;
>  	}
> -	/* Another thread already did this work */
> -	if (nr_saved_fns == 0) {
> -		printf("nothing to do for encoder...\n");
> +
> +	if (nr_saved_fns == 0)
>  		return 0;
> -	}
>  
> -	printf("got %d saved functions...\n", nr_saved_fns);
>  	saved_fns = calloc(nr_saved_fns, sizeof(*saved_fns));
>  	btf_encoders__for_each_encoder(e) {
>  		list_for_each_entry(s, &e->func_states, node)
>  			saved_fns[i++] = s;
>  	}
> -	printf("added %d saved fns\n", i);
>  	qsort(saved_fns, nr_saved_fns, sizeof(*saved_fns), saved_functions_cmp);
>  
>  	for (i = 0; i < nr_saved_fns; i = j) {

[...]







[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux