From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752552AbcGLQmP (ORCPT ); Tue, 12 Jul 2016 12:42:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36591 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750897AbcGLQmO (ORCPT ); Tue, 12 Jul 2016 12:42:14 -0400 Date: Tue, 12 Jul 2016 18:42:33 +0200 From: Oleg Nesterov To: Stanislav Kinsburskiy Cc: peterz@infradead.org, mingo@redhat.com, mhocko@suse.com, keescook@chromium.org, linux-kernel@vger.kernel.org, mguzik@redhat.com, bsegall@google.com, john.stultz@linaro.org, ebiederm@xmission.com, gorcunov@openvz.org, matthltc@us.ibm.com, akpm@linux-foundation.org, luto@amacapital.net, vbabka@suse.cz, xemul@virtuozzo.com Subject: Re: [PATCH] prctl: remove one-shot limitation for changing exe link Message-ID: <20160712164233.GA4557@redhat.com> References: <20160712152940.24895.61315.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160712152940.24895.61315.stgit@localhost.localdomain> User-Agent: Mutt/1.5.18 (2008-05-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 12 Jul 2016 16:42:13 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/12, Stanislav Kinsburskiy wrote: > > --- a/kernel/sys.c > +++ b/kernel/sys.c > @@ -1696,16 +1696,6 @@ static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) > fput(exe_file); > } > > - /* > - * The symlink can be changed only once, just to disallow arbitrary > - * transitions malicious software might bring in. This means one > - * could make a snapshot over all processes running and monitor > - * /proc/pid/exe changes to notice unusual activity if needed. > - */ > - err = -EPERM; > - if (test_and_set_bit(MMF_EXE_FILE_CHANGED, &mm->flags)) > - goto exit; > - I didn't even try to read the changelog so I do not know why do you want this change ;) But I would like to ack it in any case. I never understood why do we want/need this MMF_EXE_FILE_CHANGED check, I suggested to remove it many times. And can't resist, please note the xchg() below. Currently (before this patch) we do not need it. I was specially added to ensure that we can just remove this test_and_set_bit(MMF_EXE_FILE_CHANGED) without adding a race. Acked-by: Oleg Nesterov