Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp518687ybe; Wed, 18 Sep 2019 22:34:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+56mracJMD/K7CpNhRrj4U03Natgk+NwY3joleknXtQMqDm1j15jPqB5BFijJNrQj0WWf X-Received: by 2002:a17:906:f259:: with SMTP id gy25mr12980055ejb.2.1568871295280; Wed, 18 Sep 2019 22:34:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568871295; cv=none; d=google.com; s=arc-20160816; b=blMbSql7KRZwHwQ2mcrL4h0iGA1Y65QHGl5YyqhHjPmosEWx3/lAOrQRkbrpAXnOgw 4V4L6Nm7soHPVrFbnWbSMIZRO+WTVybtnPtvIvF6f6M+KNtDfOXyq+6AbyjtRuMnv645 JuefsGqbWFE0WSjrle2bkPbyjzkaqunWLmuKloE8CO2Sgbp6KqsEw3Ft0UeaOlMyk0FA hTJ3k4bhOgsU7Yy7wXPC+zKkeHUsKNJ2a8BpeERWYNKYloibouZv7aBIVcshdhZwEcB9 K5KPLdJSpWhLHrCd8RL2YedrO/KLmgxrIgr9g8bv91Ep2x8Dp4KkUW9D2l1ZG0RzwovD hVIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=L52h6MyzLfaJy+cUqtcSwmOW8dPdOfzbybRan9oIhf0=; b=x5RDB5mfBs+wze8FZYohXNzI5lAYOBHr0qNPaEFew4wikGStCYB2gd0xLPPcq1pu0o Ry5bQ8L1PKb4ZpeOCEwqxOT6fRqoD+ECRjswXhHRcabaSegL4lODNj7VpX3RjVwENhwl R8zo2EYw8rI71/Y7jI628uh7rYJfvQNfpS/LYbyr1e+iyZRQhLQN6dtsJEWH4ZYFKPo9 gu2L9nj7H37+rVU1ek10B6Qp9HysTxgPYucu4e+H2qkBlL+OxvGr9AQa8UrmnPVZYFHf pCDC3ccdhk0pRRQ/rOinSYw03t3off6K1qQtJGGs1+jnzS+4P/+Qwtn+mRdpqmkBN9tO BXJw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a16si4027634ejb.54.2019.09.18.22.34.31; Wed, 18 Sep 2019 22:34:55 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388365AbfISCnf (ORCPT + 99 others); Wed, 18 Sep 2019 22:43:35 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:2676 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388339AbfISCnf (ORCPT ); Wed, 18 Sep 2019 22:43:35 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 49F46466824EFB1C211D; Thu, 19 Sep 2019 10:43:33 +0800 (CST) Received: from huawei.com (10.175.104.232) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Thu, 19 Sep 2019 10:43:27 +0800 From: KeMeng Shi To: CC: , , , , , , , , , Subject: Re: Re: Re: [PATCH] connector: report comm change event when modifying /proc/pid/task/tid/comm Date: Wed, 18 Sep 2019 22:43:21 -0400 Message-ID: <20190919024321.2675-1-shikemeng@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190917170737.dpchgliux4qi2qef@willie-the-truck> References: <20190917170737.dpchgliux4qi2qef@willie-the-truck> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.232] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/9/18 at 1:08, Will Deacon wrote: >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. By listening these comm change events, user is able to monitor and control specific threads that they are interested. For instance, a process control daemon listening to proc connector and following comm value policies can place specific threads to assigned cgroup partitions (quota from commit f786ecba415888 ("connector: add comm change event report to proc connector")). It's harmless as user ignore the threads with names that they are not interested. >>>(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. It's indeed necessary to fix the concurrence problem. I will submit a v2 patch when I fix this. Thanks for your review and advise. KeMeng Shi