Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp271135ybt; Tue, 23 Jun 2020 21:54:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxe8AHxnwckA/F+0QoSmnsWdTo6/9fR/fjeod3IG4CC8IgYRY0cPhJ7BY5VzuRcG86XdGf X-Received: by 2002:a17:906:e294:: with SMTP id gg20mr5572000ejb.521.1592974480341; Tue, 23 Jun 2020 21:54:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592974480; cv=none; d=google.com; s=arc-20160816; b=XMVOqZFgepYw6qSQH7cRvhdwKqH6CasqA9UnCwtQ7SWFKBadVhVu6o0NNxVGSp4GlB ZuSaunvjAT8eyL3aJnIcput3i/2oNglyztoAKdIbWbxuvp7h0St2irIpZ0RdolGTs3y7 Wh8ru7/CQgcUk8gWxIonVf7ndlS+65ZV1zD2o/AEeBzf53X3dAS5rObqTWmfvVMDubH4 gRIz4E0KjgPHKfaTu/xtZWHtYOSrt1QVpbhfqHSGONBRosY5UMw5zj4x7UVzZxEz3PHE u3POPQxrkrrI8/Z1W1C8VWb6ceEwKx0kLlegVuP5DKDnNc3620duzVwDv9pw+Kj0Q8Jf J9jA== 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=6f53wfu9QNcdQT3ZJDSOeI3w2U50C/xG0fFlCdqBwh8=; b=t2mvUeLhZfQyNj4MG3LKsQU8ClVgLhmP7eocbY4xVyOZrvY8yubUjnhTQ9aeHoVJjw FCGYWvJm5dultUBi/y3ALXofIhy2AAdhAr3jZKKwGNhcgQICElNv7Uw4B1+BBJ5fk6wy 048fpy/yEcae2gTaQkXV+9sCZ0sxY9JPE6pe4Gud0TxDzNCcHvOad/kZB94V76n/7RHw RwdLKRbzrG8rFomlWVqJhzVLsHa5ltA1pzrJVkw5u64jGPqFPqys+J615vTwodUAar+0 wCFwUeWGzwTPy+LHZIu451nLfuRulYzPUhdvaWSjdqVbZXzaWd7i14FwBkXqrNtWqctG ITLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SOQtldw9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id s17si733030ejy.124.2020.06.23.21.54.16; Tue, 23 Jun 2020 21:54:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SOQtldw9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2388664AbgFXEwL (ORCPT + 99 others); Wed, 24 Jun 2020 00:52:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728766AbgFXEwL (ORCPT ); Wed, 24 Jun 2020 00:52:11 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44E1AC061573 for ; Tue, 23 Jun 2020 21:52:11 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id x207so574173pfc.5 for ; Tue, 23 Jun 2020 21:52:11 -0700 (PDT) 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=6f53wfu9QNcdQT3ZJDSOeI3w2U50C/xG0fFlCdqBwh8=; b=SOQtldw9KnegRbDuujQK6mSW72Ar+eCo9OL6sqQyLe4507FK6z15J0tVonL3ROJGKX jmUWzV1kGTM8ch5wLol9h8AUoGlp2vmbh9AfB5HB82Nf6nd9MDgTkfuVbQTqVcoi6m9O rflkv7LK/GEf+O4d4akCkHJ7Zge7ftnPwuhiE= 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=6f53wfu9QNcdQT3ZJDSOeI3w2U50C/xG0fFlCdqBwh8=; b=ECCoTIV8zJanspNYM83RyRBTDPLwxTsgBMjJ+XICEMsNQUTcu96FXulnmv7j4zVJ4I XRnYp7txlPDU+VGcWnC+7hw6EZp4N9nmcuFHosX+9D8fQMgNOZef3AnlD0Gt8ztK6huI 9lW456KSHILJJRoLfdVAcHvYM6g4ohl44CyRG5pHrwL4D1qa8iAhMorj99BMHF1twlK2 tiMiCr1pCPCQKizsvs5YYByDlzDbkdvTvR1xN0LdjA1N0bxNiS+8M2SaE53il3Dzsg16 jcbdKSbMBdLuHfjR9nheQbFL1wZhL70OH3uktR/riW3zUzTHcNwhQbQ+0sVxCsYLhppM rd4g== X-Gm-Message-State: AOAM5336DGwtZfD0J5cTaGwnBWCsa7D4hwXY4Je9s25WSSaP8ZNKK1ib Ymo+7CCeboc6OXB5gwnncDuevw== X-Received: by 2002:a65:6710:: with SMTP id u16mr14011070pgf.45.1592974330709; Tue, 23 Jun 2020 21:52:10 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id q92sm3895838pjh.12.2020.06.23.21.52.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 21:52:09 -0700 (PDT) Date: Tue, 23 Jun 2020 21:52:08 -0700 From: Kees Cook To: Kristen Carlson Accardi Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, "H. Peter Anvin" , Arnd Bergmann , arjan@linux.intel.com, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, rick.p.edgecombe@intel.com, Tony Luck , linux-arch@vger.kernel.org Subject: Re: [PATCH v3 05/10] x86: Make sure _etext includes function sections Message-ID: <202006232152.733212868D@keescook> References: <20200623172327.5701-1-kristen@linux.intel.com> <20200623172327.5701-6-kristen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200623172327.5701-6-kristen@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 23, 2020 at 10:23:22AM -0700, Kristen Carlson Accardi wrote: > When using -ffunction-sections to place each function in > it's own text section so it can be randomized at load time, the > linker considers these .text.* sections "orphaned sections", and > will place them after the first similar section (.text). In order > to accurately represent the end of the text section and the > orphaned sections, _etext must be moved so that it is after both > .text and .text.* The text size must also be calculated to > include .text AND .text.* > > Signed-off-by: Kristen Carlson Accardi Reviewed-by: Kees Cook -- Kees Cook