Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1507524ybv; Thu, 6 Feb 2020 05:23:14 -0800 (PST) X-Google-Smtp-Source: APXvYqyV2r2kdkzjUBcTtUViAhg9OI9hfHJnWLatjatsTHZn5G7GU3KdEwr/3ndASASLf5Cmy2cO X-Received: by 2002:a9d:6e14:: with SMTP id e20mr31747757otr.283.1580995394473; Thu, 06 Feb 2020 05:23:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580995394; cv=none; d=google.com; s=arc-20160816; b=geDv3Xl8Ft/XR+hMjqHZREUjgL1VDofIURU80JRabAO+2HiVEmx+fJFZktsExSIB7N o9sTxEzJ+qcyUsPOMyUyBi19IIOLuHLZpTfc378AXfTX3r+YQvg+sLd0Tzz2mTjOLlHy y2D9fB98d2ngCgQeuWkkZi7PDVMQPR3+DLE39FMhbdFxEp2GLd2q8OkT1Y7ediiLkz6G 725PWg4bwW46wImbfoA/G9tjrP9Kr1FBeApL4aH4bRLjlo+c791HkQs64e9l7iG0+hpP 9PyHWm9OZuACoGXjiFH8L3udgF8hrraN/B7+fRIFAHaBPMqmlwZhFDUf5wvjkeFE5WxA GVaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=0yCsXDZ7Hq3Ej7Od8dbrQEEhSu2aGFReqoIYO2djUlc=; b=vHH8pP7PVzd9niIMGvvSPfdGVdgKqX4tJLmPXj9btJOm7iEDkckbw9WOSnmr+WB5ak kCfc3brXdzhquQ+DDgi1OI7xagSpw4ej2422MPDjEF0JpTQ+swCjtnUJGrPqz53/YD4c k3AQWZ6ffpW1+uyIT9+ngM5QoLW+c/EOlq6Zz258jXe6XO/PMyipfDIIEkOoUENZ4plt vvyQZQAGHGY6egLqkY0+oRvVdGehIvrnQKlxU1yk02iC2GIEPR6UREDp4q7JBKe7ePfG P+BA9kmnSCw5+Eo8NLE4WY+oA7DELhqkgdRgkfzB3G/dyhxteppkuFNdo4BGajb6/dbt 7DyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QKfLxKf+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i15si1670880oik.46.2020.02.06.05.23.01; Thu, 06 Feb 2020 05:23:14 -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; dkim=pass header.i=@chromium.org header.s=google header.b=QKfLxKf+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727986AbgBFMiz (ORCPT + 99 others); Thu, 6 Feb 2020 07:38:55 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:34168 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727456AbgBFMiz (ORCPT ); Thu, 6 Feb 2020 07:38:55 -0500 Received: by mail-ot1-f65.google.com with SMTP id a15so5327838otf.1 for ; Thu, 06 Feb 2020 04:38:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0yCsXDZ7Hq3Ej7Od8dbrQEEhSu2aGFReqoIYO2djUlc=; b=QKfLxKf+NoFm4DBjWkoWWiW7eX2dRqD3gS03sqW2v3ztdidPcYvxnTJ0QoKe9UqRO+ o/jdO2CEZgQmKz+y8gJ47hiCcEIM82IGPom5ZNAFWuZ9886t6iz8A8vuo6BPFxwInoJb bV6TQsivro3RT8xFE/8oWapetPU7B7vg22Vys= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0yCsXDZ7Hq3Ej7Od8dbrQEEhSu2aGFReqoIYO2djUlc=; b=E3qopL10aoiosEiKJQepxXvXTFk/aWQ+gae5BcKlVeyfERxLd1TjoX1KMtcdfhtKOX AD0yGHFcQolfbURu16XBObNuJnASGRD5Ldis94qGrapvPQr5AWSjDLG4Phdu9SxShxat KRi5fPsKLf2RguUNpHhglQkSUh95Mg9i5MXfMZwop28lrYKXQ0dHca6lmSLghYzs5HpK tWPGxIyFCNon8cEm5ljwAYxpC1lCEgu3wjGJof8zR5niheM6ycTt5IYiQpczIxsJoGlg LFm3Hj9e0VOqv2BP+sm9BD33GSMj+3C7e48FFtC+G8NfpIlCr3Cn7eaidvuybBWeFuQJ sXeQ== X-Gm-Message-State: APjAAAWTTJ0aJKKbWuDRWv0EMWmH8v9zN2/XqXfFpk58tP0TADqXZp8O AJdu1SSoAWxcGYgoEz3PgDoWbA== X-Received: by 2002:a05:6830:1251:: with SMTP id s17mr30044739otp.108.1580992735002; Thu, 06 Feb 2020 04:38:55 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id e206sm873200oia.24.2020.02.06.04.38.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 04:38:54 -0800 (PST) Date: Thu, 6 Feb 2020 04:38:52 -0800 From: Kees Cook To: Kristen Carlson Accardi Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, arjan@linux.intel.com, rick.p.edgecombe@intel.com, x86@kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: Re: [RFC PATCH 01/11] modpost: Support >64K sections Message-ID: <202002060438.C2C977F8@keescook> References: <20200205223950.1212394-1-kristen@linux.intel.com> <20200205223950.1212394-2-kristen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200205223950.1212394-2-kristen@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 05, 2020 at 02:39:40PM -0800, Kristen Carlson Accardi wrote: > According to the ELF specification, if the value of st_shndx > contains SH_XINDEX, the actual section header index is too > large to fit in the st_shndx field and you should use the > value out of the SHT_SYMTAB_SHNDX section instead. This table > was already being parsed and saved into symtab_shndx_start, however > it was not being used, causing segfaults when the number of > sections is greater than 64K. Check the st_shndx field for > SHN_XINDEX prior to using. > > Signed-off-by: Kristen Carlson Accardi Looking at "readelf" output continues to make me laugh. :) Reviewed-by: Kees Cook -Kees -- Kees Cook