Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751825AbdFGMhX (ORCPT ); Wed, 7 Jun 2017 08:37:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49766 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751203AbdFGMhH (ORCPT ); Wed, 7 Jun 2017 08:37:07 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C431AC04B316 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=oleg@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C431AC04B316 Date: Wed, 7 Jun 2017 14:36:57 +0200 From: Oleg Nesterov To: "Eric W. Biederman" Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Linus Torvalds , Ingo Molnar , Thomas Gleixner , Kees Cook , Roland McGrath , Al Viro , David Howells , "Michael Kerrisk (man-pages)" Subject: Re: [PATCH 06/26] rlimit: Remove unnecessary grab of tasklist_lock Message-ID: <20170607123657.GA22199@redhat.com> References: <877f0pym71.fsf@xmission.com> <20170606190338.28347-1-ebiederm@xmission.com> <20170606190338.28347-6-ebiederm@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170606190338.28347-6-ebiederm@xmission.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 07 Jun 2017 12:37:02 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 714 Lines: 27 Hi Eric, I'll try very much to read this series tomorrow, can't do this today... On 06/06, Eric W. Biederman wrote: > > @@ -1380,13 +1380,6 @@ int do_prlimit(struct task_struct *tsk, unsigned int resource, > return -EPERM; > } > > - /* protect tsk->signal and tsk->sighand from disappearing */ > - read_lock(&tasklist_lock); > - if (!tsk->sighand) { > - retval = -ESRCH; > - goto out; > - } Yes, the comment is wrong. However we do need read_lock(tasklist_lock) to access ->group_leader. And the ->sighand != NULL check ensures that ->group_leader is the valid pointer. Also, update_rlimit_cpu() is not safe without tasklist / sighand-check. We can probably change this code to rely on rcu. Oleg.