From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754530AbdJSRTo (ORCPT ); Thu, 19 Oct 2017 13:19:44 -0400 Received: from mail-it0-f46.google.com ([209.85.214.46]:51939 "EHLO mail-it0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753388AbdJSRTm (ORCPT ); Thu, 19 Oct 2017 13:19:42 -0400 X-Google-Smtp-Source: ABhQp+TTk4KjwKZt7X3fB2rtWkWcc9NswJ1ovC+qOdgaYV9EXiqb8G4CoEbcHkhSiQB6wtuEnZroeqHZMgVjJCrIWcw= MIME-Version: 1.0 In-Reply-To: <20171019112001.fjqxazjb6sargrqa@dhcp22.suse.cz> References: <20171004075059.bbx7madwgwflb7ky@dhcp22.suse.cz> <20171016134446.19910-1-mhocko@kernel.org> <20171016134446.19910-3-mhocko@kernel.org> <20171016184335.hj6osq7su24e75jz@dhcp22.suse.cz> <20171017090424.hfw64zumekcavgug@dhcp22.suse.cz> <20171019112001.fjqxazjb6sargrqa@dhcp22.suse.cz> From: Kees Cook Date: Thu, 19 Oct 2017 10:19:40 -0700 X-Google-Sender-Auth: YPWy04CaHmiTPK9ADYbWnE_77kg Message-ID: Subject: Re: [PATCH 2/2] fs, elf: drop MAP_FIXED from initial ET_DYN segment To: Michal Hocko Cc: LKML , Linus Torvalds , Jiri Kosina , Al Viro , Oleg Nesterov , Ingo Molnar , Baoquan He Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 19, 2017 at 4:20 AM, Michal Hocko wrote: > On Tue 17-10-17 13:01:04, Kees Cook wrote: >> On Tue, Oct 17, 2017 at 2:04 AM, Michal Hocko wrote: > [...] >> > I am not insisting on this patch but it seems to me is just makes a >> > recoverable state a failure. >> >> Right, I understand you're trying to make it recoverable. I'm >> suggesting that making it recoverable provides a way for an attack to >> abuse it, and that what we'd be recovering from is a case we should >> never ever see. >> >> Consider the case where through some future bug/feature, it's possible >> to put the stack at an arbitrary location during an exec. (We've >> worked to fix that already, but who knows what the future holds either >> through misfeatures or bugs.) If an attacker maps the stack over a >> large portion of the PIE exec range, patch 2 will result in vmmap >> searching out a location that isn't already allocated. This means that >> instead of the PIE ASLR choosing from the entire possible range, it >> will get limited to only the area where something isn't already >> overlapping. This would give an attacker the ability to control the >> PIE ASLR, possibly forcing it into a fixed location. > > Yes, I guess I understand that part. What is not clear to me exactly is > why this matters as we have the mmap_base randomized and not under the > control of the attacker. mmap_base is separate from the PIE base, so patch 2 would allow for a reduction of the PIE ASLR entropy in the case of a novel overlap attack. -Kees -- Kees Cook Pixel Security