Re: GCC-BPF triggers double free in libbpf Error: failed to link 'linked_maps2.bpf.o': Cannot allocate memory (12)

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

 



On Mon, Mar 27, 2023 at 4:13 PM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote:
>
> On Mon, 2023-03-27 at 15:50 -0700, Andrii Nakryiko wrote:
> [...]
> > >
> > > I finally got back to this and have a question which I should have
> > > asked on Thursday, sorry. Why do you want to preserve a call to
> > > realloc() when dst_final_sz is 0?
> >
> > Because it's supposed to work correctly. Why is it weird? realloc API
> > is supposed to work with zeros, so I'd rather have one code path that
> > handles all the cases instead of avoiding calling realloc().
>
> Having two ways to encode effectively identical state feels weird.

It's weird on the realloc() side. But from libbpf's side, we always
call realloc(), always use its results, always pass it into free().
It's one way: consistently use realloc()+free() API.

> Ok, thank you, I'll send the patch the way you suggest shortly.
>
> [...]




[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