From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752340AbdF0IAd (ORCPT ); Tue, 27 Jun 2017 04:00:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:41681 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751492AbdF0IAZ (ORCPT ); Tue, 27 Jun 2017 04:00:25 -0400 Date: Tue, 27 Jun 2017 10:00:23 +0200 (CEST) From: Jiri Kosina X-X-Sender: jkosina@pobox.suse.cz To: Oleg Nesterov cc: tip-bot for Michal Hocko , linux-tip-commits@vger.kernel.org, torvalds@linux-foundation.org, mingo@kernel.org, hpa@zytor.com, mhocko@suse.com, tglx@linutronix.de, davej@codemonkey.org.uk, peterz@infradead.org, linux-kernel@vger.kernel.org Subject: Re: [tip:x86/mm] x86/mmap, ASLR: Do not treat unlimited-stack tasks as legacy mmap In-Reply-To: <20170623145441.GB9388@redhat.com> Message-ID: References: <20170614082218.12450-1-mhocko@kernel.org> <20170623145441.GB9388@redhat.com> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 23 Jun 2017, Oleg Nesterov wrote: > > We added a heuristics to treat applications with RLIMIT_STACK configured > > to unlimited as legacy. This means: > > To me this also means a minor security problem. The comment above > PER_CLEAR_ON_SETID says "must be cleared upon setuid or setgid exec", > but if you do "ulimit -s unlimited" before suid exec then > ADDR_COMPAT_LAYOUT set by security checks will be ignored. Could you please be a bit more specific here? mmap_is_legacy() *first* checks for the ADDR_COMPAT_LAYOUT in the personality flags, and only then, if it's unset, RLIMIT_STACK comes to play. Thanks, -- Jiri Kosina SUSE Labs