From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796198193; b=xoDVXRy7/++7qVzSdzMl0v34HvtHlXH0F0nCUWRrX/miy6uRuqIMORuVyojcnnTaplqq uJGRnysJ7Is4jYsx1cSgjjqBH713c1TOlVjsNolmf3gpvc9FpCsSon5XJqxqRvQnsVNDS REKgi0qx0quccDbF1dXjrXNSV7fAgn4bM0JiObrjXdkPSGwOYs4co2k5kW6CdNwt1ZCwL /LqZUgitanPg5LQ+vniEMoMI+he7vICFNwShK4AtKJaJ2nNKMsSBD+Eegp0XmCiKISf5u 9s7UXgB9pwbrn6dF+njkIxsCcz4A4NrHev2Vb31EsatLy4IRwhwC4KCXs6ArklGcpEw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796198193; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=x4fIIeac1yH7Ogszg8encjImoLgy/RXjKKnqB6XbrhM=; b=IBiKdv5vhMjvn2hDcndg4ts8V0ZWMzFE2gKsv9zBppmpmz097hMcFdvM/RBRhqA1Ojn/ fj0V2i0yT/TSYQCzVVMINmQnOUmjJ2UbPzCR5RKJrOFV4JQRNuvnYXzPvbG6vrQCsoFaa 33joxCuPlQohIOXx4ciF3c8OjvBfVD20qeOdCiW+3jYc9b20PJBApFhKiK43A7RoENZkk DQ3/p+LW9l7io/8aRF9wjU2peIqPPRQTucA7/qEpssLlRkPnrR2BREqgLpeC7/D4MKn5k toxPTp/6LeBqJV1YxpU7Pr3UZ/l1as1rP5EiZbSHbUuqY69F88kb7OOIID6E24nr+NQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IY3DqbWt; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADA9D606A323 for ; Wed, 2 Dec 2026 07:56:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IY3DqbWt Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77C2F1F00896; Wed, 2 Dec 2026 07:56:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796198193; bh=x4fIIeac1yH7Ogszg8encjImoLgy/RXjKKnqB6XbrhM=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=IY3DqbWt3sJaGhc/S45kKwEAvWQiIP1C03Vd8qEFm5qigxJNl49HjE4miX9leJQ+9 PYjaWm4FT01PdzcHU/lXn4b5rVY/LiDufVETg2fvlQZmzlkCbgbZNKqkAy29LSjlc7 PzasLdtmbtDNqlPXXyzZTRxbFWFCITLpy+43es3j7IG6UfYp6KYz63qgBQwf0m7Xhe sQRgS7ZmyJtbF0ON+jGApblA2RLaG3E9tYQ8Tygl52ROz2gutzq4tq5v3s2J+8B6kJ LPdsJ2nj32qM7O2aVAm99z5KYOXC9ZHNaraFTU8MCMvbeNRnLzORniKMn6urT4Lsr+ YlrbIIE9agmeg== Date: Wed, 2 Dec 2026 08:56:27 +0100 From: Christian Brauner To: Thomas Gleixner Cc: Daniel Wade , Ingo Molnar , Peter Zijlstra , Darren Hart , Davidlohr Bueso , Andre Almeida , Sebastian Andrzej Siewior , Kyle Zeng , linux-kernel@vger.kernel.org Subject: Re: [PATCH] futex/pi: Reject owners that have no mm Message-ID: <20261202-bilden-mimik-absetzbar-9f6b714bb231@brauner> References: <20261116132622.34793-1-danjwade95@gmail.com> <87h5gyqv01.ffs@fw13> <20261201-fotoreporter-fastnacht-siegreich-312e2a63bbba@brauner> <87v75cofql.ffs@fw13> <87se0go9fa.ffs@fw13> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87se0go9fa.ffs@fw13> On Wed, Dec 02, 2026 at 12:42:01AM +0100, Thomas Gleixner wrote: > On Tue, Dec 01 2026 at 22:25, Thomas Gleixner wrote: > > On Tue, Dec 01 2026 at 21:31, Christian Brauner wrote: > >> I'm not sure. I found the same bug while working on cleaning up exec > >> again. Afaict, checking p->mm before the futex state check breaks exit > >> race handling. But I'm not an expert so double-check. An exiting task > >> drops its mm after its futex state went to FUTEX_STATE_DEAD: > >> > >> do_exit() > >> -> exit_mm() > >> -> mm_exit_exec_release() > >> -> futex_exit_exec_release() > >> -> futex_cleanup_end() // FUTEX_STATE_DEAD > >> -> current->mm = NULL > >> > >> and it can still be found by its TID until it's reaped. IOW, a task that > >> has just exited also has no mm, because exit_mm() sets current->mm = > >> NULL after the futex state went DEAD. So a dead owner hits the new check > >> and the waiter gets -EPERM which means glibc aborts. So I think this > >> breaks things. > > > > Fair enough. > > > >> Checking under pi_lock means a dead task returns at the state check and > >> never reaches it. Only state OK with no mm gets -EPERM which is a umh > >> tha that never exec'ed. > > > > But that really needs to be spelled out in the change log and comments. > > I just read it again and it was spelled out in the change log in passing > in the last sentence but then the comment in the patch really confused > me. > > But what really bothers me is the fact that the fix focusses on that > particular exit issue which makes the kernel go belly up. > > Though it does not address the actually underlying problem: > > task::futex::state is unconditionally initializied to FUTEX_STATE_OK > in copy_process(). > > That was "correct" before the private hash came around, but only if > "correct" is defined as "does not explode". > > So I rather go and make this very explicit and not focussed on the > potential exit/exec cleanup accessing current->mm. Sounds great.