lkml.org 
[lkml]   [2015]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v7 2/4] x86/stackvalidate: Compile-time stack validation
On Tue, Jul 21, 2015 at 10:02:03AM +0200, Ingo Molnar wrote:
>
> * Josh Poimboeuf <jpoimboe@redhat.com> wrote:
>
> > > > +int main(int argc, char *argv[])
> > > > +{
> > > > + struct elf *elf;
> > > > + int ret = 0, warnings = 0;
> > > > +
> > > > + argp_parse(&argp, argc, argv, 0, 0, &args);
> > > > +
> > > > + elf = elf_open(args.args[0]);
> > > > + if (!elf) {
> > > > + fprintf(stderr, "error reading elf file %s\n", args.args[0]);
> > > > + return 1;
> > > > + }
> > > > +
> > > > + ret = decode_sections(elf);
> > > > + if (ret < 0)
> > > > + goto out;
> > > > + warnings += ret;
> > > > +
> > > > + ret = validate_functions(elf);
> > > > + if (ret < 0)
> > > > + goto out;
> > > > + warnings += ret;
> > > > +
> > > > + ret = validate_uncallable_instructions(elf);
> > > > + if (ret < 0)
> > > > + goto out;
> > > > + warnings += ret;
> > > > +
> > > > +out:
> > >
> > > elf_close(elf); ??
> >
> > I intentionally left out the call to elf_close() here, since this is the
> > exit path and the kernel will free the memory anyway.
>
> OTOH it makes Valgrind runs harder to interpret, as real leaks won't be visible.
>
> So I'd only do intentional leaks only if it's truly, measurably improves
> performance.

Ok. I'll fix the leaks.

--
Josh


\
 
 \ /
  Last update: 2015-07-21 14:21    [W:0.222 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site