From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754504AbdGJQ2A (ORCPT ); Mon, 10 Jul 2017 12:28:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:37174 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754159AbdGJQ17 (ORCPT ); Mon, 10 Jul 2017 12:27:59 -0400 Date: Mon, 10 Jul 2017 18:27:52 +0200 From: Michal Hocko To: Kees Cook Cc: Linus Torvalds , Andy Lutomirski , Ben Hutchings , Willy Tarreau , Hugh Dickins , Oleg Nesterov , "Jason A. Donenfeld" , Rik van Riel , Larry Woodman , "Kirill A. Shutemov" , Tony Luck , "James E.J. Bottomley" , Helge Diller , James Hogan , Laura Abbott , Greg KH , "security@kernel.org" , Qualys Security Advisory , LKML , Ximin Luo Subject: Re: [RFC][PATCH] exec: Use init rlimits for setuid exec Message-ID: <20170710162751.GC7071@dhcp22.suse.cz> References: <20170706043235.GA36170@beast> <20170710084415.GE19185@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 10-07-17 09:12:11, Kees Cook wrote: > On Mon, Jul 10, 2017 at 1:44 AM, Michal Hocko wrote: > > On Thu 06-07-17 12:12:55, Kees Cook wrote: > >> On Thu, Jul 6, 2017 at 10:52 AM, Linus Torvalds > >> wrote: > >> > On Thu, Jul 6, 2017 at 10:29 AM, Kees Cook wrote: > >> >>> > >> >>> (a) minimal: just use our existing default stack (and stack _only_) > >> >>> limit value for suid binaries that actually get extra permissions: { > >> >>> _STK_LIM, RLIM_INFINITY }. > >> >> > >> >> This would look a lot like the existing patch; it'd just not copy the > >> >> init process rlimits. > >> > > >> > Can't we just do the final rlimit setting so late in execve that we > >> > don't need that whole "saved_rlimit" thing? > >> > >> The stack rlimit defines the mmap layout too: > >> > >> do_execveat_common() -> > >> exec_binprm() -> > >> search_binary_handler() -> > >> fmt->load_binary (load_elf_binary()) -> > >> setup_new_exec() -> > >> arch_pick_mmap_layout() -> > >> mmap_is_legacy() -> > >> rlimit(RLIMIT_STACK) == RLIM_INFINITY > > > > FWIW this is gone in tip tree. See > > lkml.kernel.org/r/20170614082218.12450-1-mhocko@kernel.org > > Sounds good to me, but won't large-memory users in 32-bit get annoyed? Why would they? 32b do bottom up layouts by default. -- Michal Hocko SUSE Labs