[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150721080203.GB26811@gmail.com>
Date: Tue, 21 Jul 2015 10:02:03 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Namhyung Kim <namhyung@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, Michal Marek <mmarek@...e.cz>,
Peter Zijlstra <peterz@...radead.org>,
Andy Lutomirski <luto@...nel.org>,
Borislav Petkov <bp@...en8.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andi Kleen <andi@...stfloor.org>,
Pedro Alves <palves@...hat.com>, x86@...nel.org,
live-patching@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v7 2/4] x86/stackvalidate: Compile-time stack validation
* Josh Poimboeuf <jpoimboe@...hat.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.
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists