lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210702135641.GA22592@leoy-ThinkPad-X240s>
Date:   Fri, 2 Jul 2021 21:56:41 +0800
From:   Leo Yan <leo.yan@...aro.org>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     gushengxian <gushengxian507419@...il.com>, will@...nel.org,
        mathieu.poirier@...aro.org, peterz@...radead.org, mingo@...hat.com,
        mark.rutland@....com, alexander.shishkin@...ux.intel.com,
        jolsa@...hat.com, namhyung@...nel.org,
        linux-arm-kernel@...ts.infradead.org,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        gushengxian <gushengxian@...ong.com>
Subject: Re: [PATCH] perf: tests: fix some mmemory leak issues

Hi Arnaldo,

On Fri, Jul 02, 2021 at 09:58:52AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Jul 01, 2021 at 09:09:55PM -0700, gushengxian escreveu:
> > From: gushengxian <gushengxian@...ong.com>
> > 
> > Some memory leak issues should be fixed by free().
> > Reported by cppcheck.

I don't think this patch does the right thing.  You could see that the
memory is allocated in arch specific function sample_ustack(), and the
"buf" pointer is assigned to sample->user_stack.data; and the memory
actually is released in the caller function test_dwarf_unwind__thread:

noinline int test_dwarf_unwind__thread(struct thread *thread)
{
        struct perf_sample sample;
        unsigned long cnt = 0;
        int err = -1;

        memset(&sample, 0, sizeof(sample));

        if (test__arch_unwind_sample(&sample, thread)) {
                pr_debug("failed to get unwind sample\n");
                goto out;
        } 

        [...]

 out:
        zfree(&sample.user_stack.data);
        zfree(&sample.user_regs.regs);
        return err;
}

So this patch will break the testing and doesn't fix any memory leak
issue.

Thanks,
Leo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ