Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2254953ybv; Fri, 21 Feb 2020 11:52:16 -0800 (PST) X-Google-Smtp-Source: APXvYqzBXVFy6u7uDKSFxZIkHySmHbvWvcuXg7Ztin+1ti2JFr6pmY6UJ18ySbk9XYFxbcRS0Qd8 X-Received: by 2002:a9d:6452:: with SMTP id m18mr28803745otl.366.1582314736294; Fri, 21 Feb 2020 11:52:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582314736; cv=none; d=google.com; s=arc-20160816; b=VzDLcyxYamllKMPegmuMzbU4Qc7AhEBXYRt0h5Gu4s+NUwsElY3OetncNBNOUYHslj XLecHXX2c03RSGPk1Xugo63lOL4clQCojw8Yr1CBe8yRlzk2mBgV3B+WxcGhr/pMn70a QRjEHjw/J0xqzc9vCqD9CM5iFT01dQ6oj/3tlKSEZ7MKEFtwrQ6lDJGF7XRv4DzT+SFh 956rBg7WZn56Waq2DY9jsJ7UygmcGqI2UuMFd2GAYR3tLb6hEnXyo8RKdiNzOs707rPG iGxV9KoLThW9Q1+kpMe7vbnXO4bvxNydGxQ5aCTP2LJBv/F6rfaslkTpTPQOiRSkSrdA eiUg== 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=Unie+N+CR+ixt+b/4tM+0L7Mc0IBXa5zja9FG566mHU=; b=WlLNRy7tS0znb6EC4p2ufCIyNU4cRSzZ6IOsGxJfdviCCC6tq+oPB2e4whYNUPPWw5 qNG6RbzVVlf+YD5oLFJbG+aDGWYtx/XuP7+r7UqlPuIx/VsDUXPC11nblNr8D2Rurlj6 K3qlZ3SE/Uql0TYhKIE9mtr6wCqYIchI37Kt8VBCyTvyhR0cwI+F+k5RBqCi2g9r6wci A1wdypIgn54ax2S0NF7TrSqlg+lORSClYJideFv6i8T1L+2P4J0aM9KN0IgCNdRUI6zf KidjaSN6Rh0PVhjdxBOpuYYhUVJDOvNVjoltXvrJukK6BOOPotjnw1yN8SX87rqJ/zl5 PsDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WtkNbFF+; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p191si1192129oic.257.2020.02.21.11.52.04; Fri, 21 Feb 2020 11:52:16 -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=@redhat.com header.s=mimecast20190719 header.b=WtkNbFF+; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726989AbgBUTuy (ORCPT + 99 others); Fri, 21 Feb 2020 14:50:54 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:31112 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726160AbgBUTux (ORCPT ); Fri, 21 Feb 2020 14:50:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582314651; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Unie+N+CR+ixt+b/4tM+0L7Mc0IBXa5zja9FG566mHU=; b=WtkNbFF+ylcTUIVSPlpgLeOa9G5PgBTqX4RqkK68YIYaDhyTqe3hCBYrmT/4X42Z0Ss/3I 8nXa2Ca4oBw2fZ2GVDGqYJKafDCEWPLB8jeTNImWG9dTnGBltB9+1W13zfSZ+uhe/h8LlG PtTRrrWYStZU+i1zlbUXnaEtV7RaG7o= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-281--uOvEtZqPMmhiOqSvYd13A-1; Fri, 21 Feb 2020 14:50:47 -0500 X-MC-Unique: -uOvEtZqPMmhiOqSvYd13A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A4BBA800D48; Fri, 21 Feb 2020 19:50:44 +0000 (UTC) Received: from treble (ovpn-125-126.rdu2.redhat.com [10.10.125.126]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D637E5C28E; Fri, 21 Feb 2020 19:50:41 +0000 (UTC) Date: Fri, 21 Feb 2020 13:50:39 -0600 From: Josh Poimboeuf To: Arvind Sankar Cc: Arjan van de Ven , 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: <20200221195039.dptvoerfez4r76ay@treble> 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> <20200210163627.GA1829035@rani.riverdale.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200210163627.GA1829035@rani.riverdale.lan> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 11:36:29AM -0500, Arvind Sankar wrote: > 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. We should be careful about enabling -mbranches-within-32B-boundaries. It will hurt AMD, and presumably future Intel CPUs which don't need it. -- Josh