Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753492AbbGUICO (ORCPT ); Tue, 21 Jul 2015 04:02:14 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:36357 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753431AbbGUICJ (ORCPT ); Tue, 21 Jul 2015 04:02:09 -0400 Date: Tue, 21 Jul 2015 10:02:03 +0200 From: Ingo Molnar To: Josh Poimboeuf Cc: Namhyung Kim , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Michal Marek , Peter Zijlstra , Andy Lutomirski , Borislav Petkov , Linus Torvalds , Andi Kleen , Pedro Alves , x86@kernel.org, live-patching@vger.kernel.org, LKML Subject: Re: [PATCH v7 2/4] x86/stackvalidate: Compile-time stack validation Message-ID: <20150721080203.GB26811@gmail.com> References: <20150720175026.GC28075@treble.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150720175026.GC28075@treble.redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1499 Lines: 51 * Josh Poimboeuf 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/