Re: [PATCH 4.19 000/264] 4.19.153-rc1 review

Greg Kroah-Hartman
2020-11-02T11:49:00Z

On Mon, Nov 02, 2020 at 12:36:48PM +0100, Pavel Machek wrote:
> Hi!
>
> > >>> perf failures are as usual. powerpc:
> > >
> > > Regarding the perf failures, do you plan to revert b801d568c7d8 ("perf
> > > cs-etm: Move definition of 'traceid_list' global variable from header
> > > file") included in 4.19.152 or is a bugfix underway?
> > >
> >
> > The problem is:
> >
> > In file included from util/evlist.h:15:0,
> > from util/evsel.c:30:
> > util/evsel.c: In function ‘perf_evsel__exit’:
> > util/util.h:25:28: error: passing argument 1 of ‘free’ discards ‘const’ qualifier from pointer target type
> > /usr/include/stdlib.h:563:13: note: expected ‘void *’ but argument is of type ‘const char *’
> > extern void free (void *__ptr) __THROW;
> >
> > This is seen with older versions of gcc (6.5.0 in my case). I have no idea why
> > newer versions of gcc/glibc accept this (afaics free() still expects a char *,
> > not a const char *). The underlying problem is that pmu_name should not be
> > declared const char *, but char *, since it is allocated. The upstream version
> > of perf no longer uses the same definition of zfree(). It was changed from
> > #define zfree(ptr) ({ free(*ptr); *ptr = NULL; })
> > to
> > #define zfree(ptr) __zfree((void **)(ptr))
> > which does the necessary typecast. The fix would be to either change the definition
> > of zfree to add the typecast, or to change the definition of pmu_name to drop the const.
> > Both would only apply to v4.19.y. I don't know if either would be acceptable.
>
> As the problem is already fixed in the mainline, either solution
> should be acceptable for -stable.
>
> Probably the one adjusting the zfree() is more suitable, as that is
> the way it was solved in the mainline.

If you can provide the proper patches backported to 4.19, I will gladly
take them. I tried to figure it out and couldn't, so good luck!

greg k-h