From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751517AbdFGOPX (ORCPT ); Wed, 7 Jun 2017 10:15:23 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:50794 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750975AbdFGOPV (ORCPT ); Wed, 7 Jun 2017 10:15:21 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Oleg Nesterov 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\)" References: <877f0pym71.fsf@xmission.com> <20170606190338.28347-1-ebiederm@xmission.com> <20170606190338.28347-6-ebiederm@xmission.com> <20170607123657.GA22199@redhat.com> Date: Wed, 07 Jun 2017 09:08:30 -0500 In-Reply-To: <20170607123657.GA22199@redhat.com> (Oleg Nesterov's message of "Wed, 7 Jun 2017 14:36:57 +0200") Message-ID: <87vao7riu9.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1dIbjx-0003vM-To;;;mid=<87vao7riu9.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=97.121.81.159;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/yvOC89ASqEmFgRGkoggFEjof9BUGl9M4= X-SA-Exim-Connect-IP: 97.121.81.159 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa03 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa03 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Oleg Nesterov X-Spam-Relay-Country: X-Spam-Timing: total 1341 ms - load_scoreonly_sql: 0.09 (0.0%), signal_user_changed: 3.2 (0.2%), b_tie_ro: 2.2 (0.2%), parse: 1.27 (0.1%), extract_message_metadata: 4.7 (0.4%), get_uri_detail_list: 1.67 (0.1%), tests_pri_-1000: 23 (1.7%), tests_pri_-950: 2.3 (0.2%), tests_pri_-900: 1.92 (0.1%), tests_pri_-400: 76 (5.7%), check_bayes: 73 (5.5%), b_tokenize: 18 (1.3%), b_tok_get_all: 20 (1.5%), b_comp_prob: 3.6 (0.3%), b_tok_touch_all: 2.8 (0.2%), b_finish: 0.99 (0.1%), tests_pri_0: 1138 (84.9%), check_dkim_signature: 0.94 (0.1%), check_dkim_adsp: 18 (1.4%), tests_pri_500: 32 (2.4%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 06/26] rlimit: Remove unnecessary grab of tasklist_lock X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Oleg Nesterov writes: > 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. As of 4.12-rc1 The code does not access group_leader anymore. > Also, update_rlimit_cpu() is not safe without tasklist / sighand-check. > > We can probably change this code to rely on rcu. Good point a NULL sighand will cause update_rlimit_cpu to OOPS. Grr. There is a point in my tree where this is perfectly safe. But not at this point. Consider this patch dropped for the moment. Eric