From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 934372FDC5B for ; Wed, 12 Nov 2025 09:52:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762941169; cv=none; b=aEAq+1Hf7SjRn7zXy4PaSCyjX5gPDKM6KWZjmEiR7k1RqkYKlSkT4/LjRLDu6+HLHM/n1aIRr27zf7a1sNz5YTF9/I9tSkhvq6Cq3hNGKhLP7LuQ4PGrDkpCK5K2BsVEPqkF6dshyUaPso2gdWXIApYzjbPTy4Xrv+/5ahvPeLs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762941169; c=relaxed/simple; bh=qieoI6be/NucVGDXoIOFCAFq9yqK2SgJwSK5f9zar58=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=E0aCBuoC8yRHl9qmdgj1cpWAklQVHLmKVaG8v8ChiM9D9Few7hLdyPKKKxMbc9Pf4+N6LHFG6CO5V3IcSmLGANj/tyGqvYWHdf2GaOZGLA80BFWMPuC0ClX6j25bdQNUlbts5UD16H6K/PU8hRYkVrQ95ljaCdB0NDkjJR4JABI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Qx+reW0v; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Qx+reW0v" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762941166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NhHDG/RYOkgjp1iTZiVveFurISFNmM/HJtxHwxRJDf8=; b=Qx+reW0vrhJmkf6ybZN4Ko1CcJLOVr/pMVjQ2m0GU+zaxPqbrHEjFkkN6WK8jZaXywe4NA Bml7u5jR9fVvlktTd96f0klHWonWarWAB7dxBl0CgQe13QS0qmvqSm5aS2fRISxp0FWD23 i4xC3DPaDBE0XoWe6IGdCCYMQlheteY= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-151-thKX29d8MDyDCSuebjYMpA-1; Wed, 12 Nov 2025 04:52:43 -0500 X-MC-Unique: thKX29d8MDyDCSuebjYMpA-1 X-Mimecast-MFC-AGG-ID: thKX29d8MDyDCSuebjYMpA_1762941158 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9FED31800650; Wed, 12 Nov 2025 09:52:35 +0000 (UTC) Received: from fedora (unknown [10.44.34.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 8BECE1800451; Wed, 12 Nov 2025 09:52:14 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 12 Nov 2025 10:52:35 +0100 (CET) Date: Wed, 12 Nov 2025 10:52:13 +0100 From: Oleg Nesterov To: Bernd Edlinger Cc: Christian Brauner , Alexander Viro , Alexey Dobriyan , Kees Cook , Andy Lutomirski , Will Drewry , Andrew Morton , Michal Hocko , Serge Hallyn , James Morris , Randy Dunlap , Suren Baghdasaryan , Yafang Shao , Helge Deller , "Eric W. Biederman" , Adrian Reber , Thomas Gleixner , Jens Axboe , Alexei Starovoitov , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, tiozhang , Luis Chamberlain , "Paulo Alcantara (SUSE)" , Sergey Senozhatsky , Frederic Weisbecker , YueHaibing , Paul Moore , Aleksa Sarai , Stefan Roesch , Chao Yu , xu xin , Jeff Layton , Jan Kara , David Hildenbrand , Dave Chinner , Shuah Khan , Elena Reshetova , David Windsor , Mateusz Guzik , Ard Biesheuvel , "Joel Fernandes (Google)" , "Matthew Wilcox (Oracle)" , Hans Liljestrand , Penglei Jiang , Lorenzo Stoakes , Adrian Ratiu , Ingo Molnar , "Peter Zijlstra (Intel)" , Cyrill Gorcunov , Eric Dumazet Subject: Re: [PATCH v17] exec: Fix dead-lock in de_thread with ptrace_attach Message-ID: References: <20251105143210.GA25535@redhat.com> <20251111-ankreiden-augen-eadcf9bbdfaa@brauner> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 On 11/11, Bernd Edlinger wrote: > > On 11/11/25 14:12, Oleg Nesterov wrote: > > On 11/11, Bernd Edlinger wrote: > >> > >> Well when this is absolutely not acceptable then I would have to change > >> all security engines to be aware of the current and the new credentials. > > > > Hmm... even if we find another way to avoid the deadlock? Say, the patches > > I sent... > > > > Maybe, but it looks almost too simple ;-) > > 164 sleep(2); > 165 /* deadlock may happen here */ > 166 k = ptrace(PTRACE_ATTACH, thread2_tid, 0L, 0L); > > what happens if you change the test expectation here, that the > ptrace may fail instead of succeed? > > What signals does the debugger receive after that point? > Is the debugger notified that the debugged process continues, > has the same PID, and is no longer ptraced? Ah, but this is another thing... OK, you dislike 3/3 and I have to agree. Yes, de_thread() silently untraces/reaps the old leader and after 3/3 debugger can't rely on PTRACE_EVENT_EXIT, so unless the debugger has already attached to all sub-threads (at least to execing thread) it looks as if the leader was just untraced somehow. OK, this is probably too bad, we need another solution... Oleg.