Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5691328ybe; Tue, 17 Sep 2019 11:56:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzmeAj0tXaTCXtolqQjwEpojHNvTQblLXERLR9oQ2fZB/OgdDNf++mZLMVw0Cqyb4hbXGc/ X-Received: by 2002:a50:f152:: with SMTP id z18mr6097998edl.141.1568746588653; Tue, 17 Sep 2019 11:56:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568746588; cv=none; d=google.com; s=arc-20160816; b=VAGQlVevdKPMCWsVmb7WZ+E68rc+1bHkF69cRY/mBa48d8k8PCcPIp6iNqU9NJBjPT FxJtdxOJkIpgsZgEi7dYzrrUhrcEJdnDCKc169BkAJacQPmzcMg2msGf8bD6bLWJ9K9n yIg5Gyifb9LA3Hr/W4ReigwU8SgdlVbVpDcL2MuOfMX4yR7JAZxVXIF6iuMif1WhrdV9 niYQEI6O40lKFcVQFwxfLYVdxn9ADP3Sfr+rcDeHQVwP5unKCiVtQI/wvXFK5jx41qf6 phSD7uYtYH7H2xOJ2KMYnJfBwMXEWMyySnm84+N4zjN5ePDhU7IyYHpQNedZcJ2YICTR Y4Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=poQOZWYvMGS4hDUCACW3okeE4oNIVG7QCI6BEvAEUxw=; b=pHbxISHPM/4rJGSUyU6L/BQQN0QAzFd/0upCcgpOH0J5gNRk0MwV4ZMcG93sRk4but q8ZMqYhzrKIAE5BXU+R8cYcP2xApxxdcU/vI3RiFCtMtoFLa0Go+xanTtp+KjNICOu8l IxZ6EMAg3HC2dtDZ6zePCvkZZyBSyEOC1Keo1x9iA5uLGKtfUHn0h6MuNZD8NaDOXxyO /3iJTY5f1z0F/KyZd5bMriOex/085Cmeau2whK2scf8iwzXKYiyNRUqvCkxd4X+IylsY JGsR8j9/qMZtm2AlypxFMPU+96rJtbWCUb6ryWad58z1e2gjsnIxvR/gXuh6mlJMuX7W j9hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EHXpHfIS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6si1422911ejc.380.2019.09.17.11.56.04; Tue, 17 Sep 2019 11:56:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EHXpHfIS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730786AbfIQRHo (ORCPT + 99 others); Tue, 17 Sep 2019 13:07:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:55686 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727398AbfIQRHo (ORCPT ); Tue, 17 Sep 2019 13:07:44 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 539862067B; Tue, 17 Sep 2019 17:07:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568740063; bh=Cx46LOGv4BNjTSei9LWwlF4X6Up/WnaZBoHwti+KXHA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EHXpHfISM0cj8rSRrHKB9Ji1mZQyNgSpSoRF3W/iJc8AKBXvEAi9fg+vhWIqc101g KmEe0D0zX4/kwUr2ppTKtYRksZTNnNJ7nnQJA1s2nPV5DGOyuoE8ov2JC93TUCrmr4 KsIKiK4o/MwvTJJmVVwhKmOm+brcwDK/nQOv+u5o= Date: Tue, 17 Sep 2019 18:07:38 +0100 From: Will Deacon To: KeMeng Shi Cc: akpm@linux-foundation.org, james.morris@microsoft.com, gregkh@linuxfoundation.org, mortonm@chromium.org, will.deacon@arm.com, kristina.martsenko@arm.com, yuehaibing@huawei.com, malat@debian.org, j.neuschaefer@gmx.net, linux-kernel@vger.kernel.org Subject: Re: Re: [PATCH] connector: report comm change event when modifying /proc/pid/task/tid/comm Message-ID: <20190917170737.dpchgliux4qi2qef@willie-the-truck> References: <20190916211008.ipqe3j7s22aannta@willie-the-truck> <20190917135628.3054-1-shikemeng@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190917135628.3054-1-shikemeng@huawei.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 17, 2019 at 09:56:28AM -0400, KeMeng Shi wrote: > on 2019/9/17 at 5:10, Will Deacon wrote: > >The rough idea looks ok to me but I have two concerns: > > > > (1) This looks like it will be visible to userspace, and this changes > > the behaviour after ~8 years of not reporting this event. > This do bother for users who only care the comm change via prctl, but it > also benefits users who want all comm changes. Maybe the best way is add > something like config or switch to meet the both conditions above. In my > opinion, users cares comm change event rather than how it change. I was really just looking for some intuition as to how this event is currently used and why extending it like this is unlikely to break those existing users. > >(2) What prevents proc_comm_connector(p) running concurrently with itself > > via the prctl()? The locking seems to be confined to set_task_comm(). > To be honest, I did not consider the concurrence problem at beginning. And > some comm change events may lost or are reported repeatly as follows: > set name via procfs set name via prctl > set_task_comm > set_task_comm > proc_comm_connector > proc_comm_connector > Comm change event belong to procfs losts and the fresh comm change belong > to prctl is reported twice. Actually, there is also concurrence problem > without this update as follows: > set name via procfs set name via prctl > set_task_comm > set_task_comm > proc_comm_connector > Comm change event from procfs is reported instead of prctl, this may > bothers user who only care the comm change via prctl. Perhaps, although given that proc_comm_connector() is currently only called on the prctl() path, then it does at least provide the comm from the most recent prctl() invocation. With your path, the calls can go out of order, so I think that probably needs fixing. Will