From: Jason Baron Date: Fri, 04 Dec 2015 17:11:05 +0000 Subject: Re: use-after-free in sctp_do_sm Message-Id: <5661C929.7030200@akamai.com> List-Id: References: <20151203130525.GB4164@mrl.redhat.com> <566098BD.6010803@akamai.com> <1449172984.12092.0.camel@perches.com> <5660A1A7.3080301@akamai.com> <1449174246.12092.8.camel@perches.com> <5660A951.4000808@akamai.com> <1449175884.17296.2.camel@perches.com> <5661C3B8.2030902@akamai.com> <1449248589.8611.10.camel@perches.com> In-Reply-To: <1449248589.8611.10.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Joe Perches , Dmitry Vyukov Cc: Aaron Conole , Andrew Morton , LKML , Eric Dumazet , syzkaller , Vladislav Yasevich , linux-sctp@vger.kernel.org, netdev , Kostya Serebryany , Alexander Potapenko , Sasha Levin On 12/04/2015 12:03 PM, Joe Perches wrote: > On Fri, 2015-12-04 at 11:47 -0500, Jason Baron wrote: >> When DYNAMIC_DEBUG is enabled we have this wrapper from >> include/linux/dynamic_debug.h: >> >> if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) >> >> >> So the compiler is not emitting the side-effects in this >> case. > > Huh? Do I misunderstand what you are writing? Yes, I wasn't terribly clear - I was trying to say that the 'side-effects', in this case the debug code and use-after-free, are hidden behind the branch. They aren't invoked unless we enable the debug statement. Thanks, -Jason > > You are testing a variable that is not generally set > so the call is not being performed in the general case, > but the compiler can not elide the code. > > If the variable was enabled via the control file, the > __dynamic_pr_debug would be performed with the > use-after-free. >