Message ID | 20240202131255.GA26025@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-49885-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp418780dyc; Fri, 2 Feb 2024 05:16:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IEUYmBAgvHmwV58uORvFsHa3P9MVZNxFX/kFezce4d2Nkarq/L3he1nyj5igUZIj9AXjn/w X-Received: by 2002:a17:903:11c8:b0:1d9:34ff:f807 with SMTP id q8-20020a17090311c800b001d934fff807mr2710309plh.31.1706879797614; Fri, 02 Feb 2024 05:16:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706879797; cv=pass; d=google.com; s=arc-20160816; b=cM06yPuTdL3enIDZRQ2M1keqClAFYFxrowdgtQh8CzdTR5NWIoWyZqujJLuotB5xcL OHtU8H/U6QaTzKDCJFlBCX/qL/A1Ob7nS4gUXpcxrKQQwdCHjkDLG2nAzBgvnQHGZRlq JymQo/8lZd5iR85hnIPvtmt+JQXXCE18go5zvQS45gWDFZ9xZQsTUsLQu2Qt5cFaupAu 3HqwwVeZlJkyDaCDHMqSJ69hbk8bV/ZsEyC+6Jjne/S7CcJtIHUhqon6sRediYKQhEyw RBPK0RFaIf2UvlJfo8ZesnK/5PfnU5AQ3IIUduDMEZs1ZAH0KtScZKqFZesWgO0N8uwM Ks7g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:message-id :subject:cc:to:from:date:dkim-signature; bh=SUcW1YhSjDQX7WeyM3q0JdmdY1LiP8oScsXALyNsO5g=; fh=BjQFsrmpAZdWSJ6EJUDNhx2WMP30+OqQDSCTm/yJ0as=; b=IqKz709HgEy882Kdops5Jpd9fZ0dYn7yPMfcvhRiwlnRHrEY3LA1T3gcjEYDqMF//0 OwZh1R/oOCh0RrTOMTemuYxtL272dCwkJGLGcgy7/1LrZ1W/i1Cm80dNjY4cn5FlGO1U RDJnpTWANw4ybwDo4Y1EP3WDshfUikACIbb60OdVjnXyIh47Jl++0vGGh+fVAxjtTVGC H1qVJeR+d3buMqhiMm2QsaBSgVfiHXUjfTXh74AYu4SJwZUanifFTCFf9w5FmtN2eJKC SdMXNr0CsXaCp0Glti8KrsEV4dMqpwEABN9Lhb+aP+6+Q+7XVVoHN3Rm5ZU5BmeKySE2 L5iQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IQh8y9jM; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-49885-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49885-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCXB2/ZwDNQEDcy/UyS3Hv6UoqLDTiu84hXnyrG1NwQMTHM1R+bXnHHSxPxJqCRMvIsQUHPgL73zl6kY6E1I2/0wwErcKQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i19-20020a170902eb5300b001d917fa8be8si1656336pli.257.2024.02.02.05.16.37 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 05:16:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49885-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IQh8y9jM; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-49885-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49885-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AE349290EFC for <ouuuleilei@gmail.com>; Fri, 2 Feb 2024 13:14:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 144F645BFC; Fri, 2 Feb 2024 13:14:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IQh8y9jM" 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 D82A946558 for <linux-kernel@vger.kernel.org>; Fri, 2 Feb 2024 13:14:22 +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=1706879664; cv=none; b=mgLDuuKnrZFEFVHt5ScUkfLULDFAMEvWV69W6osusFzrekX0JHc3ucGO92eXbQqf5U/uLZ1DDbS8JvKSYWmZdIgdVK7TAseWNCBNdgI+HO5jPqsU8IElB9x49cG5m8+HFs7Okim5jdxCL2En5Q63cBbp/jmeWgI5uvuqTuITSjk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706879664; c=relaxed/simple; bh=+4rrO1QV60it1fu/bNaIuzNzFnEVuH5GK9jcRGMYtQo=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=V/5c/3ZYJlQMLWlEFiwFBeyu1588Lfu7liCJj4TQNvRZj8csMJYdThJV2AoZbEMJkiAYOIwxJssEf3YE6HnfEb7xi/sJ5un4zO/kukTZurNC5orGEehinbDf1kPGKQ1gXelRziPpsRC+eKpqguRTEhPvGkyGQERsgUhkyiErdpM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=IQh8y9jM; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706879661; 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; bh=SUcW1YhSjDQX7WeyM3q0JdmdY1LiP8oScsXALyNsO5g=; b=IQh8y9jMFqNWCqGxzKcyIPOOWp+OzmEdOZCfzr697KU+izMYYRu330zCFPAPWx7ZOkJv9G 8rLWJgwwsCFCRzHSphMuPIFsWV51h/eLb8+Srezt0xSOqn9gevZXB4t59qLvvdNxPov9Nv gvj4TuN3cOs0W3aep0I6j4Vo/6Jac1s= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-106-1uvxbfj6Oq2VwfEIFpopTA-1; Fri, 02 Feb 2024 08:14:17 -0500 X-MC-Unique: 1uvxbfj6Oq2VwfEIFpopTA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id AE193383CCE0; Fri, 2 Feb 2024 13:14:16 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.226.76]) by smtp.corp.redhat.com (Postfix) with SMTP id 8A8C6111F9; Fri, 2 Feb 2024 13:14:15 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Fri, 2 Feb 2024 14:13:01 +0100 (CET) Date: Fri, 2 Feb 2024 14:12:55 +0100 From: Oleg Nesterov <oleg@redhat.com> To: Christian Brauner <brauner@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net>, "Eric W. Biederman" <ebiederm@xmission.com>, Tycho Andersen <tycho@tycho.pizza>, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] pid: kill the obsolete PIDTYPE_PID code in transfer_pid() Message-ID: <20240202131255.GA26025@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240202131147.GA25988@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789793190410970651 X-GMAIL-MSGID: 1789793190410970651 |
Series |
pidfd_poll: report POLLHUP when pid_task() == NULL
|
|
Commit Message
Oleg Nesterov
Feb. 2, 2024, 1:12 p.m. UTC
transfer_pid() must be never called with pid == PIDTYPE_PID,
new_leader->thread_pid should be changed by exchange_tids().
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/pid.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/pid.c b/kernel/pid.c index 62461c7c82b8..de0bf2f8d18b 100644 --- a/kernel/pid.c +++ b/kernel/pid.c @@ -396,8 +396,7 @@ void exchange_tids(struct task_struct *left, struct task_struct *right) void transfer_pid(struct task_struct *old, struct task_struct *new, enum pid_type type) { - if (type == PIDTYPE_PID) - new->thread_pid = old->thread_pid; + WARN_ON_ONCE(type == PIDTYPE_PID); hlist_replace_rcu(&old->pid_links[type], &new->pid_links[type]); }