From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47827E77184 for ; Thu, 19 Dec 2024 21:59:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6379A6B007B; Thu, 19 Dec 2024 16:59:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E7B96B0082; Thu, 19 Dec 2024 16:59:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D5796B0083; Thu, 19 Dec 2024 16:59:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 2F0C16B007B for ; Thu, 19 Dec 2024 16:59:57 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D136A803F9 for ; Thu, 19 Dec 2024 21:59:56 +0000 (UTC) X-FDA: 82913075238.08.B0A46FC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf28.hostedemail.com (Postfix) with ESMTP id EE16BC0009 for ; Thu, 19 Dec 2024 21:59:17 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=R7Dzv76A; spf=pass (imf28.hostedemail.com: domain of audra@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=audra@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734645579; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=q1xMEZnNo8PFiPeIpe/15DPzqgF6h45Agb+SYSElZfQ=; b=GBaPx3hKW/9ZQvVMlqoEF9wpI34fYPc0A5O3OH4ibPRIFPKxcnEJv48ly3xMsK22LvXtnz rqI2f6krJEj+qZm/RKMfj025mEQJiOq/lJwvmWxCijsAsdSnYCtB6ng9qGHSuSsTgCSEb/ XbwGwnSo7zkMHG/2vzoIi2EDqAKfrpQ= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=R7Dzv76A; spf=pass (imf28.hostedemail.com: domain of audra@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=audra@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734645579; a=rsa-sha256; cv=none; b=f/ndG91NXEHdmkyEA9PI7MtyAGSpaA06CLd8BeYUaZLCT2cME3ez3S1zuBmw9GH3P8RFgz pW4bXL+GOFaJLB12J+oSi8CwK0iz2RtIuC8xACMceS289ki9JRbLu1dzsMRxmY6KZPOa1l ttFGwOoNn3bpyI5dzyP5d+HtQIKPwtk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734645594; 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=q1xMEZnNo8PFiPeIpe/15DPzqgF6h45Agb+SYSElZfQ=; b=R7Dzv76A9NXjzEkxzqRPlRlCvG4bnE2Tb5szvKkHTSZtmUmnV7ynWu9Hk99Oylwb0KTqOj pnksMsYSOZ3Ctr00VSGGsPathzH3S3yS75YIaMVBXDMk+Hh64B853xBYklYGyUJlCAitE8 SLvMfXkOOxrSkfu+M3HKUddAqxUxdto= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-393-WJZxlzfBOgKh1bjxEUeJRQ-1; Thu, 19 Dec 2024 16:59:52 -0500 X-MC-Unique: WJZxlzfBOgKh1bjxEUeJRQ-1 X-Mimecast-MFC-AGG-ID: WJZxlzfBOgKh1bjxEUeJRQ Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 330151955F3E; Thu, 19 Dec 2024 21:59:51 +0000 (UTC) Received: from fedora (unknown [10.22.80.160]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CEC6D300F9B5; Thu, 19 Dec 2024 21:59:48 +0000 (UTC) Date: Thu, 19 Dec 2024 16:59:46 -0500 From: Audra Mitchell To: Matthew Wilcox Cc: linux-mm@kvack.org, raquini@redhat.com, aris@redhat.com, akpm@linux-foundation.org, william.kucharski@oracle.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: Stop PMD alignment for PIE shared objects Message-ID: References: <20241219211552.1450226-1-audra@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Rspamd-Queue-Id: EE16BC0009 X-Stat-Signature: p1uzkfrozmhqd1dwon9bc91emund55ee X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1734645557-95982 X-HE-Meta: U2FsdGVkX1/IPIMnmbvkiyWoMARCSozv40lLfFRIRRnNJPm8NNYHDFxInW3T2Pgze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YLtf/wT5Q3S7RoFep6bOc74hjWpPhFRSl1DaKkPYSdzOMqcke7lMYmifXvDkNeRUT3UGAtOrKJLO/x1311MZ2egBRrvF58QFSAojMhPaPz38V3tGi0Via+cjwW7RgSdF4jt9KkU2mig7yCfbxSCebUhIF+ThWxTCRyLf/HMDfgcerkfCe0duv17q1Vj4HIisg4xR1zzC+cO X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Dec 19, 2024 at 09:30:58PM +0000, Matthew Wilcox wrote: > On Thu, Dec 19, 2024 at 04:15:52PM -0500, Audra Mitchell wrote: > > After commit 1854bc6e2420 ("mm/readahead: Align file mappings for non-DAX") > > any request through thp_get_unmapped_area would align to a PMD_SIZE, > > causing shared objects to have less randomization than previously (9 less > > bits for 2MB PMDs). As these lower 9 bits are the most impactful for > > ASLR, this change could be argued to have an impact on security. > > Yes, very tiresome people have been making that argument for a long > time. Do you have anything further to add to the discussion that > happened here: > > https://lore.kernel.org/linux-mm/20240118133504.2910955-1-shy828301@gmail.com/ > > particularly in light of 3afb76a66b55 existing. Hey all, Happy Holidays! I was not aware of this discussion, so thank you for bringing it to my attention. I've read over it and I'll take a closer look after the holidays. Respectfully, I'm trying to understand your view of this problem given your feedback - can you clarify for me what you mean by "particularly in light of" regarding 3afb76a66b55... it looks to me like this was reverted with 14d7c92f8df9 and there does appear to be some room for improvement for this topic based on linus' commit message there. I did play around with the idea of checking to see if kaslr was enabled and only doing the return in that case, as users then could opt-in to the solution or not.. Thanks in advance for your insight! > > Fix this issue by checking that the request is aligned to the PMD_SIZE, > > otherwise fall back to mm_get_unmapped_area_vmflags(). > > NAK this version anyway. Even if the executable is, say, 2.1MB in size, > we still want the first 2MB of the file to be covered with a PMD > mapping. >