Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1595658ybv; Thu, 6 Feb 2020 06:40:55 -0800 (PST) X-Google-Smtp-Source: APXvYqzd5S+FYETUMeFvrqd8VT+Cq9Cv/ff2nkQutbZd+K/yfddjqYwt7tJpxkpEf0h/M3OHo6vI X-Received: by 2002:a05:6830:1d8b:: with SMTP id y11mr22642299oti.4.1581000055188; Thu, 06 Feb 2020 06:40:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581000055; cv=none; d=google.com; s=arc-20160816; b=PQXhOremlKijc3mPPLiwSXamWLRUgftn81CVKhcJD00/0nEECNGsJPoFGHxMKBVebv Z+d/0dwG06RvswEyW9LYGKb5kZq3sULcD/gsRePD0UWuGC00ifGorIAqmin7JHCbbgPJ X1Jyq49PdSVWQ7vgOqlpuRfdnCThXPIKb3T0GfMzC2SZ5mzsaGRNX/iZROVg4VSTOC2F zey7AG2GKk4ZPZSvUouxp4dz2HPIAIiS47L5cWs7VttO5BI8a8MYB5HTsQEqNKBkn58q g03MCD3t/ps5koddF4YaDF/WGoy1WkuD9PXhysHZyQDQAPqJNI9joLsAWgg8wqe/3Kov vj/A== 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:date:from:dkim-signature; bh=i8ZXRcb1q1ZSxQ8Q/mjcQROT9/CmLPHcpBtDmaBy1Do=; b=Wep0nHNkFj6GoMdT+n81ZCyfges9ymeFT6FTaS2Wtn1V7pox544iRso0d4jCC2h0AN fId8DvTzcsQmgSvvqJql5xmwa6fC4PaqB4dEtiC9l/Xbbt8ffflLN5CPGP0kE3G8W/oe DkkpZH6M/MeLDo9RHaK3lN43VXdZjXdTpDsKGeiUyC2R9fJPKE9USXDmpoNsXLhc2ttT Hyt37/F3G7bfBvzfAGHuKfb0KEux6014l0h+nclsDM+IpmbDNtnQleI5UA/OePp5ru8p 2quH+Ehph/kfCNwi/UoNlZYnH8hVqhPwv+623UXQVfPJfJnV231LWgPst8FKg/zzjPHb i+5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="Ys8PYYc/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9si2051244oij.78.2020.02.06.06.40.42; Thu, 06 Feb 2020 06:40:55 -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=fail header.i=@gmail.com header.s=20161025 header.b="Ys8PYYc/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727951AbgBFOjq (ORCPT + 99 others); Thu, 6 Feb 2020 09:39:46 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:38869 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727828AbgBFOjq (ORCPT ); Thu, 6 Feb 2020 09:39:46 -0500 Received: by mail-qt1-f195.google.com with SMTP id c24so4636011qtp.5 for ; Thu, 06 Feb 2020 06:39:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=i8ZXRcb1q1ZSxQ8Q/mjcQROT9/CmLPHcpBtDmaBy1Do=; b=Ys8PYYc/0KffCBFLBHCfIiPTSWh7o1gs3pvRab778kYvcRem+EEiC9ArZsRPtdj/MU qz8rh87ZY4R8tPufcXRQ3WJZSBAv4EHo4oS6iNeaIewlyDE1i2lE1m5TCGmLzxJk3ol/ bIjLXlLTmfXIX3l79fRVQWu9wo+eXgVNQju9mZliLwvBZu35Br26tMCtk4f1h9HiFUjG sqkZpxTdi4r1pM8uPb/wfWgmgOrA4ZR86hVUtj42PSRmET8iDZsrhaJh7VaGFlhJOZE2 1/EHItqP5lbpohrYWipysvn41cif3BBCHN/jgOlcUgnUJFTodDjrrsqjuEC185sijP9c nJwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:date:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=i8ZXRcb1q1ZSxQ8Q/mjcQROT9/CmLPHcpBtDmaBy1Do=; b=UqpNyLlvY/Qs3Gchjd1t87Kndbh1V2Rwh0oms1NU+3gSdoMiYq2/TkqZWNlaL6azLZ P1hHuOVmGyardXFnBe5lDni/N7v64lFWX0NkIOjRLOp9YudMTbNL7bciDro/YHpQxOX6 m9x5dpxXi4+5EyxDmikUZIwQuPwKFnBFkVTL69Cqwmfe9t5stXWsEKjA+q0UmJV1iUE0 u/hYIzAWlNZgV6ylrQaZelZcTEO0RXiLaDN3hFDBnJXolPDUsxWlS9r+9wmP6RTXxpMJ IpV9lwlv61uj9ZJ7Cfv6nYt8jAs51Y3hJov9BZRHE54KNlGJ9sG6ytF3AJWPIDoPIzav iMDQ== X-Gm-Message-State: APjAAAUJEZoybR2NdpG+/VYzI6155lWTROKE3zh5wZf/wa+lTgUAhcOm m4ihM9lWg2C2kBtJ1h7VShc= X-Received: by 2002:ac8:75d8:: with SMTP id z24mr2850675qtq.193.1580999985259; Thu, 06 Feb 2020 06:39:45 -0800 (PST) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id c45sm1787163qtd.43.2020.02.06.06.39.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 06:39:45 -0800 (PST) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Thu, 6 Feb 2020 09:39:43 -0500 To: Kees Cook Cc: Kristen Carlson Accardi , 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 06/11] x86: make sure _etext includes function sections Message-ID: <20200206143941.GA3044151@rani.riverdale.lan> References: <20200205223950.1212394-1-kristen@linux.intel.com> <20200205223950.1212394-7-kristen@linux.intel.com> <202002060408.84005CEFFD@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <202002060408.84005CEFFD@keescook> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 06, 2020 at 04:26:23AM -0800, Kees Cook wrote: > I know x86_64 stack alignment is 16 bytes. I cannot find evidence for > what function start alignment should be. It seems the linker is 16 byte > aligning these functions, when I think no alignment is needed for > function starts, so we're wasting some memory (average 8 bytes per > function, at say 50,000 functions, so approaching 512KB) between > functions. If we can specify a 1 byte alignment for these orphan > sections, that would be nice, as mentioned in the cover letter: we lose > a 4 bits of entropy to this alignment, since all randomized function > addresses will have their low bits set to zero. > The default function alignment is 16-bytes for x64 at least with gcc. You can use -falign-functions to specify a different alignment. There was some old discussion on reducing it [1] but it doesn't seem to have been merged. [1] https://lore.kernel.org/lkml/tip-4874fe1eeb40b403a8c9d0ddeb4d166cab3f37ba@git.kernel.org/