From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753818AbdHUUFa (ORCPT ); Mon, 21 Aug 2017 16:05:30 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:34720 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753548AbdHUUF3 (ORCPT ); Mon, 21 Aug 2017 16:05:29 -0400 Date: Mon, 21 Aug 2017 22:05:20 +0200 From: Peter Zijlstra To: Oleg Nesterov Cc: Linus Torvalds , Kees Cook , Troy Kensinger , "security@kernel.org" , Paul McKenney , Josh Triplett , linux-kernel@vger.kernel.org, "Eric W. Biederman" , Andrew Morton Subject: Re: [PATCH] pids: make task_tgid_nr_ns() safe Message-ID: <20170821200520.GB32112@worktop.programming.kicks-ass.net> References: <20170820142953.GA3767@redhat.com> <20170821153502.GA652@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170821153502.GA652@redhat.com> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 21, 2017 at 05:35:02PM +0200, Oleg Nesterov wrote: > This was reported many times, and this was even mentioned in commit > 52ee2dfdd4f5 "pids: refactor vnr/nr_ns helpers to make them safe" but > somehow nobody bothered to fix the obvious problem: task_tgid_nr_ns() > is not safe because task->group_leader points to nowhere after the > exiting task passes exit_notify(), rcu_read_lock() can not help. > > We really need to change __unhash_process() to nullify group_leader, > parent, and real_parent, but this needs some cleanups. Until then we > can turn task_tgid_nr_ns() into another user of __task_pid_nr_ns() and > fix the problem. > > Reported-by: Troy Kensinger > Signed-off-by: Oleg Nesterov Acked-by: Peter Zijlstra (Intel)