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: <YiZNNQB727Il+EVN@tc2>
Date:   Mon, 7 Mar 2022 19:21:41 +0100
From:   Andrea Claudi <aclaudi@...hat.com>
To:     David Ahern <dsahern@...nel.org>
Cc:     netdev@...r.kernel.org, stephen@...workplumber.org,
        markzhang@...dia.com, leonro@...dia.com
Subject: Re: [PATCH iproute2 v2 1/2] lib/fs: fix memory leak in
 get_task_name()

On Mon, Mar 07, 2022 at 10:58:37AM -0700, David Ahern wrote:
> On 3/2/22 5:28 AM, Andrea Claudi wrote:
> > diff --git a/include/utils.h b/include/utils.h
> > index b6c468e9..81294488 100644
> > --- a/include/utils.h
> > +++ b/include/utils.h
> > @@ -307,7 +307,7 @@ char *find_cgroup2_mount(bool do_mount);
> >  __u64 get_cgroup2_id(const char *path);
> >  char *get_cgroup2_path(__u64 id, bool full);
> >  int get_command_name(const char *pid, char *comm, size_t len);
> > -char *get_task_name(pid_t pid);
> > +int get_task_name(pid_t pid, char *name);
> >  
> 
> changing to an API with an assumed length is not better than the current
> situation. Why not just fixup the callers as needed to free the allocation?
>

I actually did that on v1. After Stephen's comment about asprintf(), I
got the idea to make get_task_name() similar to get_command_name() and
a bit more "user-friendly", so that callers do not need a free().

If you think this is not ideal, I can post a v3 with the necessary fixes
to the callers.

Thanks,
Andrea

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ