Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2559998imu; Thu, 29 Nov 2018 06:55:08 -0800 (PST) X-Google-Smtp-Source: AFSGD/U+GW4RZz4HggrxGziKUSHtMmOojUNj/6bsA7dJfw8IweO7GqH1vaFIcJqJq3N8ZyhRxtOp X-Received: by 2002:a63:413:: with SMTP id 19mr307054pge.7.1543503308895; Thu, 29 Nov 2018 06:55:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543503308; cv=none; d=google.com; s=arc-20160816; b=JKmiY8OBeX88H0CtaSfb9a8Utg0Thwe84iEA+UF9W2sIG0o495BjQM8v4nGBfEXgql 73a+eP9rzXrbCDGeRv8WZI7J8gKFmmPP5A7v1L4rGqwICoGCgAw3cisP0BWeS1psAEfB bUPpTIHEsZtoPsAZgGaXbTQL0vZg0bYn0FrTHaNFIkHxa/6yoNIX8cuQ3k0yZvB6u26I HAZom4d5+T8eRdbAA6qkghp4q2aOFEJHvAAKow02YHdatIfx/Pxu1KIAJk5Ub8tluxrU yRV6RsMXgW9coZ19VluaOvwOdu8gs9MJ0zA3Eg+wIt04BaFScEeGexKxYOfAAd7QSMqi 8Qyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=+qsJewzI5I1Y8HlIrTY58Bya3o8RluLbadYMxJucfEA=; b=Y8LY7T5Yu1jcjBQ3qERa2l0etEFJPu+QFVWt38kr9JiHnCWa8RMqE4leYbTGdPH860 7l/ytMNOYHP/iLmzxr3EcU+sonwbJ7pwsje7RdOpxXIIYIvDp6QWtuaCfaL12Phd2n5q zm0I23zcpSisLmKYSCUlmnKD04/05X4+2S7Gmd5WdNEe7Qb8G0vr3tSU5RhfV5ckusJc oAmr3HoMSwz0Q+edWCLzFp5HF4mYW/8Ieg6WqVP2x14Wmel8rNcxaL+9s2+9D2O/iAmh uTO+nyIwLHfs/ARf4uq6UmuDH/tjFwv/FMhNCeIIn12zBoB4Jgzrn8j1hE5zSDS57T5b 4XWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g34si2398363pld.15.2018.11.29.06.54.54; Thu, 29 Nov 2018 06:55:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732252AbeK3B2r (ORCPT + 99 others); Thu, 29 Nov 2018 20:28:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35772 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732242AbeK3B2q (ORCPT ); Thu, 29 Nov 2018 20:28:46 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC5517F6C8; Thu, 29 Nov 2018 14:23:15 +0000 (UTC) Received: from treble (ovpn-123-4.rdu2.redhat.com [10.10.123.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7EC661019637; Thu, 29 Nov 2018 14:23:14 +0000 (UTC) Date: Thu, 29 Nov 2018 08:23:12 -0600 From: Josh Poimboeuf To: Artem Savkov Cc: x86@kernel.org, Thomas Gleixner , "Eric W . Biederman" , linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/tools/relocs: fix big section header tables Message-ID: <20181129142312.kz2l5gm33yeaglnn@treble> References: <20181129135133.31369-1-asavkov@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181129135133.31369-1-asavkov@redhat.com> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 29 Nov 2018 14:23:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 29, 2018 at 02:51:33PM +0100, Artem Savkov wrote: > In case when the number of entries in the section header table is larger > then or equal to SHN_LORESERVE the size of the table is held in the sh_size > member of the initial entry in section header table instead of e_shnum. > Same with the string table index which is located in sh_link instead of > e_shstrndx. > > This case is easily reproducible with KCFLAGS="-ffunction-sections", > bzImage build fails with "String table index out of bounds" error. > > Signed-off-by: Artem Savkov > --- > arch/x86/tools/relocs.c | 58 +++++++++++++++++++++++++++++------------ > 1 file changed, 41 insertions(+), 17 deletions(-) > > diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c > index b629f6992d9f..5275ea0a0d13 100644 > --- a/arch/x86/tools/relocs.c > +++ b/arch/x86/tools/relocs.c > @@ -11,7 +11,9 @@ > #define Elf_Shdr ElfW(Shdr) > #define Elf_Sym ElfW(Sym) > > -static Elf_Ehdr ehdr; > +static Elf_Ehdr ehdr; I think there's a tab missing here, it doesn't line up with the other variables. > +static unsigned long shnum; > +static unsigned int shstrndx; Otherwise the patch looks good to me. Reviewed-by: Josh Poimboeuf -- Josh