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.133.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 60507370AEC for ; Mon, 24 Aug 2026 15:57:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787587050; cv=none; b=u0ON90mdXAJRIeDzilH2fRjJQ9LbkgG1atgulSzUObC4MFkt67Vl6G9G/OgeU3xL15/5vQBu1Zemu38sf9vuGCLa5RqvCeOvBTwMGYDuciNQzVMbqAwAVXGHc0qAg3On+yAKK1+btP9zEzDsTophbtbuDXAf8jQSUJFKzd9sxtg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787587050; c=relaxed/simple; bh=WLDiteWIqF3m1z44XJzECGsDTBGJPPLigkS/d7vyfyk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ke+vu/weGk1WCI2uwot9m7O+MIXnWXisBLIdY6+FUSZQhT+sviPFZc/qR6uD3nlialTzrwV7KslqFIh7YNlJHq6Bebs6bA/RUrqfiDoSjRYE/jw2kg/lNQpGwLm62tXBMNFAyWZ+m93jwRA/MEPgLJAQ/K+yzDv9YFbIffxE1E0= 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=bw4+fmRQ; arc=none smtp.client-ip=170.10.133.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="bw4+fmRQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787587047; 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=Lt6JfU9N3TKmHx8nvPAdDqg71QI5DDY6kggznOpUqRc=; b=bw4+fmRQeTSibjAs708LyMMny1kcelrCFZBLnfHPbpyy9r6Fq6CjlxQ4c8jmk8totbbpps JjkqD91FvKfw+R+NCGH4YxTFM/tx5KNrpmWXjRYqS9rHjnwq0rRUGcgc0G8/g+/smQAdYr 2CdyEYe448iEK6fJcr0u+0mwY7SiMlc= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-670-Wb4jBxTKMfqBc15vuBl-vA-1; Mon, 24 Aug 2026 11:57:25 -0400 X-MC-Unique: Wb4jBxTKMfqBc15vuBl-vA-1 X-Mimecast-MFC-AGG-ID: Wb4jBxTKMfqBc15vuBl-vA_1787587042 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6E2D71977535; Mon, 24 Aug 2026 15:57:22 +0000 (UTC) Received: from fedora (unknown [10.44.32.9]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 3D9CB18005B4; Mon, 24 Aug 2026 15:57:18 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 24 Aug 2026 17:57:22 +0200 (CEST) Date: Mon, 24 Aug 2026 17:57:17 +0200 From: Oleg Nesterov To: Keke Ming Cc: Andrii Nakryiko , Jiri Olsa , Masami Hiramatsu , Peter Zijlstra , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH] uprobes: Free utask on dup_return_instance() failure Message-ID: References: <20260822054620.452262-1-ming.jvle@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@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.93 On 08/24, Keke Ming wrote: > > On 08/24, Oleg Nesterov wrote: > > > Hmm. It is not that I think "it is not enough", I think this is pointless > > whatever we do. > > Well, I didn't mean to insist on the cleanup, I also think it may > be redundant. If the child is bound to exit, manually calling > uprobe_free_utask(t) in dup_utask() is pointless, as the normal > exit path will handle it. Yes, but the same is true if the child is not bound to exit... IOW, I still can't understand your motivation for this patch... > > But this is only the first step to cleanup > > this logic. I'll try to write another email tomorrow. > > Of course, I'm all ears. You have already mentioned "Option B" below ;) that is what I meant. > Here is my current understanding. One thing I am not sure about > is the signal semantics. If the copied uprobe state is incomplete, > the child should not return to user mode with that state. Perhaps... But consider func_which_can_be_ret_probed(void) { if (!fork) { printf("CHILD\n"); exit(0); } } > Option A: ... > ... > kill_child: > // I was thinking about SIGKILL here because it cannot be ignored > // Of course, you can correct me > send_sig(SIGKILL, t, 1); force_exit_sig(SIGILL) can't be ignored too. But I am fine either way. So yes, perhaps this makes sense. Although IMO this all is not that important; GFP_KERNEL shouldn't fail "in practice" and at least uprobe_copy_process() warns in this case... > Option B: > > > Note that uprobe_copy_process() warns but returns "void", too late > > to abort copy_process(). > > Looking at copy_process(), uprobe_copy_process() is currently called > after the "No more failure paths" point and after the child has already > been made visible through the task list and pid links. > > Would the longer term fix be to move the uprobe state copy earlier, > before the "No more failure paths" point, and then add the needed > bad_fork cleanup for p->utask? Agreed, pronably better than Option A. But in therory dup_xol_work() can still fail after fork(). Oleg.