From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F1488F6D for ; Thu, 19 Dec 2024 21:59:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734645598; cv=none; b=Nyc+2UTfydxr3ZriSypA3es61VV9t/fl2sY3cwtgkaZroweqbD4Ti145ps1U8cZk0/AVInn8bO5j2gPbl48PTGHeh3+C1AwE9wIHU5canqz0O7g4egQ/UWer7LOQIFzbUITYUdzPkUHbCUak6FKxnfFdZzS9keuZLgBUuG0xD2w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734645598; c=relaxed/simple; bh=p8i42j39ba78ybz3VPoYueDiAv+T3n+I2AB/vnU69kg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TYDymlpEDClVqDkvPUKjQJzjXYJVNV03C2DMsLtwoUjixTmZM2ulfg6fCbVGLHU81u1ijQcC10RkRYUQ+JbgP3AdZKRG338BPZ7kmpL4z90dsWvbyD+Gpknosjr4BeGirHm8I6/TJewpFRTenwAKNpfrvFoH892DabiJCdHkrtI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=WJG4BL9i; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WJG4BL9i" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734645596; 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=WJG4BL9iKbRdvSby4Rif+zFHkTsHpxJUS0bQqQ33f+UABcKNLSUo8LNyoEy4A8MwjkDzkh GH7OoMZBMsNDr9kjIIJuDC4Kf3qdYuxhddPwYi9QKlBaLNlcvqGhqoNTtUGto147fFwYYo liywCvwZtwxN4fNv5m9CuC57abQDFe4= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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. >