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]
Date:   Tue, 22 Mar 2022 23:21:27 -0400
From:   David Vernet <void@...ifault.com>
To:     Tom Rix <trix@...hat.com>
Cc:     Joe Lawrence <joe.lawrence@...hat.com>, jpoimboe@...hat.com,
        jikos@...nel.org, mbenes@...e.cz, pmladek@...e.com,
        nathan@...nel.org, ndesaulniers@...gle.com,
        live-patching@...r.kernel.org, linux-kernel@...r.kernel.org,
        llvm@...ts.linux.dev
Subject: Re: [PATCH v2] livepatch: Reorder to use before freeing a pointer

> > On 3/19/22 9:51 PM, trix@...hat.com wrote:
> > > From: Tom Rix <trix@...hat.com>
> > > 
> > > Clang static analysis reports this issue
> > > livepatch-shadow-fix1.c:113:2: warning: Use of
> > >    memory after it is freed
> > >    pr_info("%s: dummy @ %p, prevented leak @ %p\n",
> > >    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > 
> > > The pointer is freed in the previous statement.
> > > Reorder the pr_info to report before the free.
> > > 
> > > Similar issue in livepatch-shadow-fix2.c
> > > 
> > > Signed-off-by: Tom Rix <trix@...hat.com>
> > > ---
> > > v2: Fix similar issue in livepatch-shadow-fix2.c
> > > 
> > >   samples/livepatch/livepatch-shadow-fix1.c | 2 +-
> > >   samples/livepatch/livepatch-shadow-fix2.c | 2 +-
> > >   2 files changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/samples/livepatch/livepatch-shadow-fix1.c b/samples/livepatch/livepatch-shadow-fix1.c
> > > index 918ce17b43fda..6701641bf12d4 100644
> > > --- a/samples/livepatch/livepatch-shadow-fix1.c
> > > +++ b/samples/livepatch/livepatch-shadow-fix1.c
> > > @@ -109,9 +109,9 @@ static void livepatch_fix1_dummy_leak_dtor(void *obj, void *shadow_data)
> > >   	void *d = obj;
> > >   	int **shadow_leak = shadow_data;
> > > -	kfree(*shadow_leak);
> > >   	pr_info("%s: dummy @ %p, prevented leak @ %p\n",
> > >   			 __func__, d, *shadow_leak);
> > > +	kfree(*shadow_leak);
> > >   }
> > >   static void livepatch_fix1_dummy_free(struct dummy *d)
> > > diff --git a/samples/livepatch/livepatch-shadow-fix2.c b/samples/livepatch/livepatch-shadow-fix2.c
> > > index 29fe5cd420472..361046a4f10cf 100644
> > > --- a/samples/livepatch/livepatch-shadow-fix2.c
> > > +++ b/samples/livepatch/livepatch-shadow-fix2.c
> > > @@ -61,9 +61,9 @@ static void livepatch_fix2_dummy_leak_dtor(void *obj, void *shadow_data)
> > >   	void *d = obj;
> > >   	int **shadow_leak = shadow_data;
> > > -	kfree(*shadow_leak);
> > >   	pr_info("%s: dummy @ %p, prevented leak @ %p\n",
> > >   			 __func__, d, *shadow_leak);
> > > +	kfree(*shadow_leak);
> > >   }
> > >   static void livepatch_fix2_dummy_free(struct dummy *d)

Acked-by: David Vernet <void@...ifault.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ