From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Kees Cook To: Linus Torvalds Cc: Kees Cook , Andy Lutomirski , David Howells , Serge Hallyn , John Johansen , Casey Schaufler , "Eric W. Biederman" , Michal Hocko , Ben Hutchings , Hugh Dickins , Oleg Nesterov , "Jason A. Donenfeld" , Rik van Riel , Alexander Viro , James Morris , Greg Ungerer , Ingo Molnar , Nicolas Pitre , Stephen Smalley , Paul Moore , Vivek Goyal , =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Tetsuo Handa , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org Subject: [PATCH 0/2] exec: Use sane stack rlimit for setuid exec Date: Fri, 7 Jul 2017 12:56:58 -0700 Message-Id: <1499457420-83038-1-git-send-email-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: As discussed with Linus and Andy, we need to reset the stack rlimit before we do memory layouts when execing a privilege-gaining (e.g. setuid) program. This moves security_bprm_secureexec() earlier (with required changes), and then lowers the stack limit when appropriate. As a side-effect, dumpability is expanded to cover capabilities and other LSM definitions of secureexec, and Smack can drop its special handler for pdeath_signal clearing. I'd appreciate some extra eyes on this to make sure this isn't broken in some special way. I couldn't find anything that _depended_ on security_bprm_secureexec() being called late. Thanks! -Kees