From patchwork Sat Dec 11 06:39:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 12671701 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BBCDC433EF for ; Sat, 11 Dec 2021 06:40:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 614406B0073; Sat, 11 Dec 2021 01:40:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C33A6B0074; Sat, 11 Dec 2021 01:40:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 463D16B0075; Sat, 11 Dec 2021 01:40:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay030.a.hostedemail.com [64.99.140.30]) by kanga.kvack.org (Postfix) with ESMTP id 3993A6B0073 for ; Sat, 11 Dec 2021 01:40:14 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0590421BF2 for ; Sat, 11 Dec 2021 06:40:03 +0000 (UTC) X-FDA: 78904563528.05.A51F136 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by imf23.hostedemail.com (Postfix) with ESMTP id CB0BA140007 for ; Sat, 11 Dec 2021 06:40:01 +0000 (UTC) Received: by mail-pj1-f51.google.com with SMTP id iq11so8315010pjb.3 for ; Fri, 10 Dec 2021 22:40:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TZV2akOfGkMYXOBRArbqbu6dxDYcT5+TVmROYOG16l0=; b=TkcDmDViXI57Xnv7ZLFQNtjrEPmhhun71oUPc9lDSvrkVqzpeqhOZtev3RPN6jjz0u N9zpX8zdcx/Osl7dswhaP8mJz7jndE8heKd0yCnPJVUgnVPlDnBsRgF3DfOYfEGQGWjK j7OjirVMTUYvgtv6+63tAOqtccuw+NpRilI57jL8hh/Fi+96GlSD5yBOG/Lehh1WCyOh ATmUaNxeO3jK62SlOJGR2sSGglUKQbrlJIXwJtlJGCMa9fTL9D/2Pcwsih+nP3ygM6QS CuSo4GuUIfvp4nYHT4rx6FW5qhvP+2jqZl1Dr45tHbNSRQlu4obh0xSpGacDXuQRQ2Lj NrxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TZV2akOfGkMYXOBRArbqbu6dxDYcT5+TVmROYOG16l0=; b=eWoBU8NmwCLWfdLCSIgjQdK1wqdMQ/uUALiLRS4rayJR0gM/zG0XVBjkCfnwOY3HUh 9asIgnm4OkLBPY+QhM94BCngKYjXse47ob8JQed9k97mx1saK8MJPeatqGs7ipQchNki 6z25sYqHFUgjL5Ni7x2npaWzsovGSAl15V9MVRFNK25ynDaIh6xa/fvWM29xbMRfFjmS k0XywsWYGUoH2sUGmbePCIFf3DIDsYqmC1YNgG+NGTDmr9M+0nBadIAqLlUQYoWyCEmf j+xTSBvzEGwdjj2FuJGC8+a+Z2Ab8XHfYaEtL1B4Mqi5m9DiOrzqE1qgs8Bb37xXNg/9 icGg== X-Gm-Message-State: AOAM530Bj7fNioM4ix5bnyVkroLF9TJ9HEofXn/TQQnURiUA9yUfnFZq J0lX4ZVlJ5yW4YnsnuW6aK0= X-Google-Smtp-Source: ABdhPJxLChN+ADVPJ6LFYKtwALt6CHN+EQPy/Y/OCNbJZ9hpnCuwbpT+ooSoB6bQWw3XkomJn6HDOQ== X-Received: by 2002:a17:902:e88a:b0:141:dfde:eed7 with SMTP id w10-20020a170902e88a00b00141dfdeeed7mr81576375plg.17.1639204802767; Fri, 10 Dec 2021 22:40:02 -0800 (PST) Received: from vultr.guest ([45.76.74.237]) by smtp.gmail.com with ESMTPSA id mr2sm869638pjb.25.2021.12.10.22.40.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 22:40:02 -0800 (PST) From: Yafang Shao To: akpm@linux-foundation.org, rostedt@goodmis.org, keescook@chromium.org, pmladek@suse.com, david@redhat.com, arnaldo.melo@gmail.com, andrii.nakryiko@gmail.com, alexei.starovoitov@gmail.com Cc: linux-mm@kvack.org, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Yafang Shao , Mathieu Desnoyers , Michal Miroslaw , Peter Zijlstra , Matthew Wilcox , Al Viro Subject: [PATCH -mm v2 1/3] elfcore: replace old hard-code 16 with TASK_COMM_LEN_16 Date: Sat, 11 Dec 2021 06:39:47 +0000 Message-Id: <20211211063949.49533-2-laoar.shao@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211211063949.49533-1-laoar.shao@gmail.com> References: <20211211063949.49533-1-laoar.shao@gmail.com> MIME-Version: 1.0 X-Stat-Signature: 7mbd6g66wjmk8doqhkr3x65b459wbrxj Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=TkcDmDVi; spf=pass (imf23.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.216.51 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: CB0BA140007 X-HE-Tag: 1639204801-311865 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: A new macro TASK_COMM_LEN_16 is introduced for the old hard-coded 16 to make it more grepable. As explained above this marco, the difference between TASK_COMM_LEN and TASK_COMM_LEN_16 is that TASK_COMM_LEN_16 must be a fixed size 16 and can't be changed. Suggested-by: Steven Rostedt (VMware) Signed-off-by: Yafang Shao Cc: Mathieu Desnoyers Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Michal Miroslaw Cc: Peter Zijlstra Cc: Steven Rostedt Cc: Matthew Wilcox Cc: David Hildenbrand Cc: Al Viro Cc: Kees Cook Cc: Petr Mladek --- include/linux/elfcore-compat.h | 8 ++------ include/linux/elfcore.h | 9 ++------- include/linux/sched.h | 5 +++++ 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/include/linux/elfcore-compat.h b/include/linux/elfcore-compat.h index 54feb64e9b5d..69fa1a728964 100644 --- a/include/linux/elfcore-compat.h +++ b/include/linux/elfcore-compat.h @@ -5,6 +5,7 @@ #include #include #include +#include /* * Make sure these layouts match the linux/elfcore.h native definitions. @@ -43,12 +44,7 @@ struct compat_elf_prpsinfo __compat_uid_t pr_uid; __compat_gid_t pr_gid; compat_pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; - /* - * The hard-coded 16 is derived from TASK_COMM_LEN, but it can't be - * changed as it is exposed to userspace. We'd better make it hard-coded - * here. - */ - char pr_fname[16]; + char pr_fname[TASK_COMM_LEN_16]; char pr_psargs[ELF_PRARGSZ]; }; diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h index 746e081879a5..d3bb4bd3c985 100644 --- a/include/linux/elfcore.h +++ b/include/linux/elfcore.h @@ -65,13 +65,8 @@ struct elf_prpsinfo __kernel_gid_t pr_gid; pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; /* Lots missing */ - /* - * The hard-coded 16 is derived from TASK_COMM_LEN, but it can't be - * changed as it is exposed to userspace. We'd better make it hard-coded - * here. - */ - char pr_fname[16]; /* filename of executable */ - char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ + char pr_fname[TASK_COMM_LEN_16]; /* filename of executable */ + char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ }; static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *regs) diff --git a/include/linux/sched.h b/include/linux/sched.h index c79bd7ee6029..8d963a50a2a8 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -279,6 +279,11 @@ struct task_group; * BPF programs. */ enum { + /* + * For the old hard-coded 16, which is exposed to userspace and can't + * be changed. + */ + TASK_COMM_LEN_16 = 16, TASK_COMM_LEN = 16, }; From patchwork Sat Dec 11 06:39:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 12671703 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F0AEC433F5 for ; Sat, 11 Dec 2021 06:41:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DDB686B0074; Sat, 11 Dec 2021 01:40:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D8A7A6B0075; Sat, 11 Dec 2021 01:40:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C52FF6B0078; Sat, 11 Dec 2021 01:40:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0181.hostedemail.com [216.40.44.181]) by kanga.kvack.org (Postfix) with ESMTP id B79E66B0074 for ; Sat, 11 Dec 2021 01:40:15 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7F227853F1 for ; Sat, 11 Dec 2021 06:40:05 +0000 (UTC) X-FDA: 78904563570.30.498F195 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf08.hostedemail.com (Postfix) with ESMTP id B194516000A for ; Sat, 11 Dec 2021 06:40:03 +0000 (UTC) Received: by mail-pj1-f41.google.com with SMTP id h24so8331766pjq.2 for ; Fri, 10 Dec 2021 22:40:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/I2CQOSPxPl3e4Yr2uDBAw9mvwLM+fXKuKYxA0ZrAYc=; b=VIOouOyVNGP8AMS7vH25R7ezTHIuVaLkOsH1g8p5QlmHTgcBJDKschh6e69WqeS5lg 1A+26/jKzb+DENoLnSfK/GkVY1ny5DfT8VcQfNhTXBj4n4Cx+tkzLOViWV04Zl2FZ+gY i56ke3Yog79crQ2m03IiInSJjf2DqTjTz/HO5dOHu33LzJmYCpsT02C2SeZRj5TBaQVQ y9aV+JJA33lbAA/0CqRqIdEnKMNrPSWeav3knE0MLSq6ln2gbFu7jRxL149TNAmm4X7Y ELabuPWamLYFojIGKpiAYr0Ef/CKj3V2RsEs/lJplEihtkM9YuMLB1w23mGqB7ZjcIfl SEKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/I2CQOSPxPl3e4Yr2uDBAw9mvwLM+fXKuKYxA0ZrAYc=; b=C4yeNym6JgtdWBn/iWpMJmNooreZMD+Y7BpFJwaXPSvo4zEkk+tk9Q5sG7ZNr9m0A/ xMk066WeTzkfoFTSYr2GkTzI8n/nwORcd0BaeeIzu22Nm4Vnfl1GbcfEoo7tiw3xJqZJ bbPzdFCGmv3BnYJkvv9m/l63zVP1cdh9uv5dp8R2nWnhpgwOYcLdo/WAGzmb/Sz7LuQs jdYhzHrzDgU4tlHKo6mvNuLAqzFaMlcq41cj17C5/3jy6jkiAe94rkc2a+bUNt2rw4c8 /tXen0BAKUy+/flQXo7eIQvn4s3j8R7q0oXihBxQAx3hSLcPyp4hesS1oX1KIJLJgw1j r1Tg== X-Gm-Message-State: AOAM533VpRoAiCSZFag4G/NBAcFXsnDv2rTq82qQY4W6AV27zbdoZArR l2dAkzmWhb3QowiHIs+6VY8= X-Google-Smtp-Source: ABdhPJwawVgqpJxNH0/hvqcqPlFrrhcBZidD0MqAaYCGD9tZ+aPQrl2q+kL/z2lm1d9TKwQ7RMOMaQ== X-Received: by 2002:a17:903:11c4:b0:141:da55:6158 with SMTP id q4-20020a17090311c400b00141da556158mr81495925plh.7.1639204804265; Fri, 10 Dec 2021 22:40:04 -0800 (PST) Received: from vultr.guest ([45.76.74.237]) by smtp.gmail.com with ESMTPSA id mr2sm869638pjb.25.2021.12.10.22.40.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 22:40:03 -0800 (PST) From: Yafang Shao To: akpm@linux-foundation.org, rostedt@goodmis.org, keescook@chromium.org, pmladek@suse.com, david@redhat.com, arnaldo.melo@gmail.com, andrii.nakryiko@gmail.com, alexei.starovoitov@gmail.com Cc: linux-mm@kvack.org, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Yafang Shao , Mathieu Desnoyers , Michal Miroslaw , Peter Zijlstra , Matthew Wilcox , Al Viro Subject: [PATCH -mm v2 2/3] cn_proc: replaced old hard-coded 16 with TASK_COMM_LEN_16 Date: Sat, 11 Dec 2021 06:39:48 +0000 Message-Id: <20211211063949.49533-3-laoar.shao@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211211063949.49533-1-laoar.shao@gmail.com> References: <20211211063949.49533-1-laoar.shao@gmail.com> MIME-Version: 1.0 X-Stat-Signature: sx9tsnw75ja3s3gjjuau7t4k849xbfkq Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=VIOouOyV; spf=pass (imf08.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: B194516000A X-HE-Tag: 1639204803-442078 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This TASK_COMM_LEN_16 has the same meaning with the macro defined in linux/sched.h, but we can't include linux/sched.h in a UAPI header, so we should specifically define it in the cn_proc.h. Signed-off-by: Yafang Shao Acked-by: Steven Rostedt (VMware) Cc: Mathieu Desnoyers Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Michal Miroslaw Cc: Peter Zijlstra Cc: Steven Rostedt Cc: Matthew Wilcox Cc: David Hildenbrand Cc: Al Viro Cc: Kees Cook Cc: Petr Mladek --- include/uapi/linux/cn_proc.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/cn_proc.h b/include/uapi/linux/cn_proc.h index db210625cee8..6dcccaed383f 100644 --- a/include/uapi/linux/cn_proc.h +++ b/include/uapi/linux/cn_proc.h @@ -21,6 +21,8 @@ #include +#define TASK_COMM_LEN_16 16 + /* * Userspace sends this enum to register with the kernel that it is listening * for events on the connector. @@ -110,7 +112,7 @@ struct proc_event { struct comm_proc_event { __kernel_pid_t process_pid; __kernel_pid_t process_tgid; - char comm[16]; + char comm[TASK_COMM_LEN_16]; } comm; struct coredump_proc_event { From patchwork Sat Dec 11 06:39:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 12671705 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C41C0C433EF for ; Sat, 11 Dec 2021 06:41:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3F0A86B0075; Sat, 11 Dec 2021 01:40:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A0366B0078; Sat, 11 Dec 2021 01:40:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2407F6B007B; Sat, 11 Dec 2021 01:40:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0066.hostedemail.com [216.40.44.66]) by kanga.kvack.org (Postfix) with ESMTP id 16E4F6B0075 for ; Sat, 11 Dec 2021 01:40:17 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id CD547180D32E4 for ; Sat, 11 Dec 2021 06:40:06 +0000 (UTC) X-FDA: 78904563612.25.EE03DE9 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by imf16.hostedemail.com (Postfix) with ESMTP id 6200A180004 for ; Sat, 11 Dec 2021 06:40:06 +0000 (UTC) Received: by mail-pj1-f43.google.com with SMTP id k6-20020a17090a7f0600b001ad9d73b20bso9270756pjl.3 for ; Fri, 10 Dec 2021 22:40:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YOmWgj2DxdohruN6t1jhLzVebqIDyQ6/9OEYQxNzBg0=; b=avF8g6XTx8SXtkscJO5GafrYodx7aduWYE3dYkSVMyLazEekKe1vVFk1AcFgyRBi6D KLtMP+qE/Amw1XwaQT/yoZ7FOpLwpBIsjgKmZHipCkgkLFNTE6AqlpV1aH5qy7E7MmSl Qm6JgY75X1B3qkf/H2k7QvWLl8G9yHb61vg4+ii+LxdBRZLuOVbmTGjafvriHmt9NNf2 C2Gdtyfny7jByIehwd+AyV30ha9OKEIw3yPh05v5AvFtaFqno5FojQ8vmgGFIAbxiGEE h9szKpnk6ljwBnYCjFwml3+o+AVuPYrMIgmExUuBfP4zdOzo4zP83bUHVEc1hawnKN1j 56yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YOmWgj2DxdohruN6t1jhLzVebqIDyQ6/9OEYQxNzBg0=; b=lnb4+hhpCN9F86wxGl2sXIR/SP4fAvtE3Qj35RWHSRqTtxvn6ut00omqPnY27tq7kS Ry5GoM8at73dor8zf/voV3TAwIUsvvc7soUBbpVlQyD9CvarX89Hu87P0mY/fbGya8ix d8fP57yH9KXwYQzfd2rhg/YGXLEFd8jnPIYDhvdVDaNhGlJcNw/HYawPcMy1x7K9xgLV b+e4s5gNqgxsOpVvdo/6kDUcG4rmYImhB2+s1S2rPjFIaRFqjx0lCRJ6pYnARQ+qiEOi JP6tnDjbDjCFw8y+UdIUris0o8UF9uHI1ttHQocqyrqRVCh5jmY0+UlozqmNtkkedhWQ UhcQ== X-Gm-Message-State: AOAM5306bS9Uszehy66THlyu1QK7c0LZHSF7BMkwZ1OnM4wc5x3s6IOL SlLiHgYwIucYZGlhVOvIsN4= X-Google-Smtp-Source: ABdhPJyBEqkEghuO8KOI7906KYxsqu3siKTh85eWa5YxoDkG4ZEkClWkFiRCnC3BaaN4x8agFkpY0w== X-Received: by 2002:a17:90b:1b45:: with SMTP id nv5mr29250796pjb.120.1639204805586; Fri, 10 Dec 2021 22:40:05 -0800 (PST) Received: from vultr.guest ([45.76.74.237]) by smtp.gmail.com with ESMTPSA id mr2sm869638pjb.25.2021.12.10.22.40.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 22:40:05 -0800 (PST) From: Yafang Shao To: akpm@linux-foundation.org, rostedt@goodmis.org, keescook@chromium.org, pmladek@suse.com, david@redhat.com, arnaldo.melo@gmail.com, andrii.nakryiko@gmail.com, alexei.starovoitov@gmail.com Cc: linux-mm@kvack.org, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Yafang Shao , Mathieu Desnoyers , Michal Miroslaw , Peter Zijlstra , Matthew Wilcox , Al Viro Subject: [PATCH -mm v2 3/3] tools/perf: replace old hard-coded 16 with TASK_COMM_LEN_16 Date: Sat, 11 Dec 2021 06:39:49 +0000 Message-Id: <20211211063949.49533-4-laoar.shao@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211211063949.49533-1-laoar.shao@gmail.com> References: <20211211063949.49533-1-laoar.shao@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 6200A180004 X-Stat-Signature: st5io11w4d5ez9zyzphf3gbsomgjjyyo Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=avF8g6XT; spf=pass (imf16.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.216.43 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1639204806-931733 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: evsel-tp-sched will verify the task comm len in sched:sched_switch and sched:sched_wakeup tracepoints. In order to make it grepable, we'd better replace the hard-coded 16 with TASK_COMM_LEN_16. Signed-off-by: Yafang Shao Cc: Mathieu Desnoyers Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Michal Miroslaw Cc: Peter Zijlstra Cc: Steven Rostedt Cc: Matthew Wilcox Cc: David Hildenbrand Cc: Al Viro Cc: Kees Cook Cc: Petr Mladek --- tools/perf/tests/evsel-tp-sched.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/perf/tests/evsel-tp-sched.c b/tools/perf/tests/evsel-tp-sched.c index cf4da3d748c2..8be44b8e2b9c 100644 --- a/tools/perf/tests/evsel-tp-sched.c +++ b/tools/perf/tests/evsel-tp-sched.c @@ -5,6 +5,8 @@ #include "tests.h" #include "debug.h" +#define TASK_COMM_LEN_16 16 + static int evsel__test_field(struct evsel *evsel, const char *name, int size, bool should_be_signed) { struct tep_format_field *field = evsel__field(evsel, name); @@ -43,7 +45,7 @@ static int test__perf_evsel__tp_sched_test(struct test_suite *test __maybe_unuse return -1; } - if (evsel__test_field(evsel, "prev_comm", 16, false)) + if (evsel__test_field(evsel, "prev_comm", TASK_COMM_LEN_16, false)) ret = -1; if (evsel__test_field(evsel, "prev_pid", 4, true)) @@ -55,7 +57,7 @@ static int test__perf_evsel__tp_sched_test(struct test_suite *test __maybe_unuse if (evsel__test_field(evsel, "prev_state", sizeof(long), true)) ret = -1; - if (evsel__test_field(evsel, "next_comm", 16, false)) + if (evsel__test_field(evsel, "next_comm", TASK_COMM_LEN_16, false)) ret = -1; if (evsel__test_field(evsel, "next_pid", 4, true)) @@ -73,7 +75,7 @@ static int test__perf_evsel__tp_sched_test(struct test_suite *test __maybe_unuse return -1; } - if (evsel__test_field(evsel, "comm", 16, false)) + if (evsel__test_field(evsel, "comm", TASK_COMM_LEN_16, false)) ret = -1; if (evsel__test_field(evsel, "pid", 4, true))