Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3908537ybv; Mon, 10 Feb 2020 08:36:59 -0800 (PST) X-Google-Smtp-Source: APXvYqz2jhgvfCteCWF2cD6ilwjE2zt2NT3mljs4+OyASacS+ashMsbuaQUbglzxmoqYynzxuNj2 X-Received: by 2002:a9d:6251:: with SMTP id i17mr1761746otk.14.1581352614354; Mon, 10 Feb 2020 08:36:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581352614; cv=none; d=google.com; s=arc-20160816; b=O7giUe8f47V+SfeLAiCKJEej4L+UjD72QP5GIXbVfiy/OCygYfzv4WUxzP3wm4NQ1q CV8/hSK5Sg0fguuxtd1M4OIJHCZjtMoklJFk4usM2tZ6B4aJZlJ9CywwhfIMrNQIahw+ o2QO+h+WmQ8Cv6NLZQMRQrskikVaIPi0ycMhUaKS+0Idj8SSKdEclJSfyCpRYg/vK+2X QeKcFFNABkmy8emIfW7yRxniV5Dskew92Q8AieFUCxwkvWMJGmIMMHZ7IxkrH9ODDxFy xCzkD/hZ5ezBDqZkYmfYLBFy+FrpC6TLBSGaHHjB2Ii6MhTOGX0OIC8cM+d0IIskYxfL jalQ== 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=B82P8bR5ozDn3yo+U/Bu+4ns+QtyTtYccr3OgXM2Xto=; b=yC/nDZkOBJnsvBE+xlBuEIjjeP2PpNRlhF42cC9CmZf1ZQAWxUuFvKPo0lXWEWk/w6 mUI8bjtUv9yQhY7pdx9JIr4vO9+U2YKqUGmlROSwpq2dKLiWngquwJc/9a3VXg/roAwT YFBjVXs53TfqLyZRyL0Uyej+etrJxHR4YLSYx6OSSJYWp/AJXCTKoQylimnyOkXo12Ru veyjFfzgTYZH0LhePTuYtuiHEsgZIyaBUSXT8HHgQxiMAo62xs7AjUEGifAc8hI1BILz o2KMb7rYYkU6NGR+pxIIgzJMGgXz/5YFj4zaKzoIPR03HNnkYTf6IbiLJIhEaUP5WE4s NFPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="ng1G/VSw"; 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 t3si400157oth.247.2020.02.10.08.36.42; Mon, 10 Feb 2020 08:36:54 -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="ng1G/VSw"; 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 S1727923AbgBJQgc (ORCPT + 99 others); Mon, 10 Feb 2020 11:36:32 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:46196 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727840AbgBJQgc (ORCPT ); Mon, 10 Feb 2020 11:36:32 -0500 Received: by mail-qt1-f195.google.com with SMTP id e21so1572386qtp.13 for ; Mon, 10 Feb 2020 08:36:31 -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=B82P8bR5ozDn3yo+U/Bu+4ns+QtyTtYccr3OgXM2Xto=; b=ng1G/VSw9LRJOGQ1b6uRbkUgf37UT3j939mOC/5gYT9UUEFV3K9QbsTejURWL01vLe rmgHOjhlMXui4fo07OLbG88qSfkSbXMR0ti2l9a/Zu8qAtzhImtWAFOm4E9VCIcyf3ft +8VvpSZ7CXcUx/r+OE8G14NpzjP8nvDqR49PbWCEPFRMxE6MejJOT4VGgxdq5qSY31cL Tw9kxO4TfQ7bWh0xD9zJRZOpgUJe1D4j9zIxFSa9mHovxIAmZuVAdRfgHicFGiVwi4iU OUnL90cliCXC+I9LtanC8Q1JIFuXx5BdlxLeEX9DablDUFMfIS8auz1nJS4qx5bj6BA8 d3lA== 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=B82P8bR5ozDn3yo+U/Bu+4ns+QtyTtYccr3OgXM2Xto=; b=eapQsAuH6+dGuA+kdRuzsVMBRANsolo7xfGLR7zLZFxsdPwjh1D7nBreRhvZhsGNr7 ZmLsKyupkThDPnhVKJATVh7sBWlSEWu1uP4efYEA1pbhQtpKNT3OvcUGHelob2xm4/Iv aa99WlXuOuXRUg08vHOT7ywxVDL/78/p7uDP6JOkZpOBon/b8MfzenO9oMX5s+j9JRUZ KSY8lI+BIc5FywnNCEbLyQ9UdLKKhzordjfV82No0mb5b1q5wGJchm0aWoICMlcpn1BU 6um/CIIHmY2ItJpM/DWediNW3Q9LaWhoOatvZL/kMljF5HAaSFmLI+qEc7z65Ms+QldT 8pcg== X-Gm-Message-State: APjAAAU0boWp08Mxhb3Jj8pIT5bKyPLK4fNMDhQpMiItkr9XtgHOLHgi ilaHdRu5sUlEVZOAk2ikPXw= X-Received: by 2002:aed:234a:: with SMTP id i10mr10644028qtc.155.1581352591251; Mon, 10 Feb 2020 08:36:31 -0800 (PST) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id 24sm395392qka.32.2020.02.10.08.36.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 08:36:30 -0800 (PST) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Mon, 10 Feb 2020 11:36:29 -0500 To: Arjan van de Ven Cc: Peter Zijlstra , Kees Cook , Andy Lutomirski , Kristen Carlson Accardi , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.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: <20200210163627.GA1829035@rani.riverdale.lan> References: <75f0bd0365857ba4442ee69016b63764a8d2ad68.camel@linux.intel.com> <20200207092423.GC14914@hirez.programming.kicks-ass.net> <202002091742.7B1E6BF19@keescook> <20200210105117.GE14879@hirez.programming.kicks-ass.net> <43b7ba31-6dca-488b-8a0e-72d9fdfd1a6b@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <43b7ba31-6dca-488b-8a0e-72d9fdfd1a6b@linux.intel.com> 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 Mon, Feb 10, 2020 at 07:54:58AM -0800, Arjan van de Ven wrote: > > > > I'll leave it to others to figure out the exact details. But afaict it > > should be possible to have fine-grained-randomization and preserve the > > workaround in the end. > > > > the most obvious "solution" is to compile with an alignment of 4 bytes (so tight packing) > and then in the randomizer preserve the offset within 32 bytes, no matter what it is > > that would get you an average padding of 16 bytes which is a bit more than now but not too insane > (queue Kees' argument that tiny bits of padding are actually good) > With the patchset for adding the mbranches-within-32B-boundaries option, the section alignment gets forced to 32. With function-sections that means function alignment has to be 32 too.