From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753719AbdGJIo2 (ORCPT ); Mon, 10 Jul 2017 04:44:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:55138 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753696AbdGJIoZ (ORCPT ); Mon, 10 Jul 2017 04:44:25 -0400 Date: Mon, 10 Jul 2017 10:44:15 +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: <20170710084415.GE19185@dhcp22.suse.cz> References: <20170706043235.GA36170@beast> 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 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 -- Michal Hocko SUSE Labs