Re: [PATCH bpf-next 1/6] bpf: btf: Avoid WARN_ON when CONFIG_REFCOUNT_FULL=y

2018-05-08 Thread Song Liu
> On May 4, 2018, at 2:49 PM, Martin KaFai Lau wrote: > > If CONFIG_REFCOUNT_FULL=y, refcount_inc() WARN when refcount is 0. > When creating a new btf, the initial btf->refcnt is 0 and > triggered the following: > > [ 34.855452] refcount_t: increment on 0; use-after-free. > [ 34.856252] WA

[PATCH bpf-next 1/6] bpf: btf: Avoid WARN_ON when CONFIG_REFCOUNT_FULL=y

2018-05-04 Thread Martin KaFai Lau
If CONFIG_REFCOUNT_FULL=y, refcount_inc() WARN when refcount is 0. When creating a new btf, the initial btf->refcnt is 0 and triggered the following: [ 34.855452] refcount_t: increment on 0; use-after-free. [ 34.856252] WARNING: CPU: 6 PID: 1857 at lib/refcount.c:153 refcount_inc+0x26/0x30 ..