From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 CC1FE111A8 for ; Thu, 19 Dec 2024 21:31:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734643867; cv=none; b=R0Ri43kYO3w+l7RcySiShN9NVd0Z4tUPOQZvjVxC/w1hSjgqF/Szas+9DAteqCk34PMK76QnNY7dbytxrC65EP2KLsgac2YtA0ldDYMCzyxqzHfsMZIEvaC6Y65kssPHnLY+snMOac9rN8h3TrrWhNNUinplYL5cBjdC0hsSH2A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734643867; c=relaxed/simple; bh=1RvSv1CuNI1r0jU+vnoXCcxi8W2hZih+MMD6tCRGJys=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=J37laE10ZyZv+6uy95BRTjLPK+mlxu6w4954EsptCnKw22ZVFgaxlr79s1OK4vWuQJBq//h6EhLkOCfW4tl8afo01firubVgCpVUiDX1b3HlSov2AkL9kOIWwKZy/SIADFtjl2oNMz4oH8OUroh/am7/kNVPG+r7Q8Sy3r48pzM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=sC15HflV; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="sC15HflV" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=a+18tRI9mv3ZAUPywZ8L8kq4Hcw/gQZfJkwo1/aFm1U=; b=sC15HflVCitXYjckDE+sGU6ChI 8UDFF6/MMG4v0kL5lrnB5Q+H98VDjupHiY0zOC9z4oAybapFPgjDANbY7TZp4Qc8dlXCzD+AXZAqC dSUako1W0l2S75ytZlBQowUI/nhSQpKdRLcepmg8IOqRHU1cFsqPbrdACf431LEX6+IKin7cjBw3T qfF7b6NwxFmAX/FCoq75IFtknaahiSZTKzqLFx0JrqOu3tqBWh3Q67QOk17vCfRslojyCrNpXGntX LAplmTBmsC202JR9xtxLP/wmlaCN1Fq0pP+8Doqb5cBhlU+8kGIDduSi2cdWFrNAClZXPXM9h2Oiq Abu5jZXw==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tOO6k-00000005VVQ-3FHt; Thu, 19 Dec 2024 21:30:58 +0000 Date: Thu, 19 Dec 2024 21:30:58 +0000 From: Matthew Wilcox To: Audra Mitchell 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: <20241219211552.1450226-1-audra@redhat.com> 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. > 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.