Re: [PATCH v1] perf test cpumap: Avoid use-after-free following merge
From: Arnaldo Carvalho de Melo
Date: Wed Jan 08 2025 - 15:43:14 EST
On Wed, Jan 08, 2025 at 03:07:53PM +0000, James Clark wrote:
>
>
> On 08/01/2025 5:15 am, Ian Rogers wrote:
> > Previously cpu maps in the test weren't modified by calls to the cpu
> > map API, however, perf_cpu_map__merge was modified so the left hand
> > argument was updated. In the test this meant the maps copy of the
> > "two" map was put/deleted in the merge meaning when accessed via maps,
> > the pointer was stale and to the put/deleted memory. To fix this add
> > an extra layer of indirection to the maps array, so the updated value
> > of two is accessed.
> >
> > Fixes: a9d2217556f7 ("libperf cpumap: Refactor perf_cpu_map__merge()")
> > Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
>
> Reviewed-by: James Clark <james.clark@xxxxxxxxxx>
Thanks, applied to perf-tools-next,
- Arnaldo