From patchwork Sat Dec 4 09:52:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 12656399 X-Patchwork-Delegate: bpf@iogearbox.net 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF5E1C43217 for ; Sat, 4 Dec 2021 09:53:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384550AbhLDJ4g (ORCPT ); Sat, 4 Dec 2021 04:56:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244915AbhLDJ4e (ORCPT ); Sat, 4 Dec 2021 04:56:34 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A49AC061751; Sat, 4 Dec 2021 01:53:08 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id j5-20020a17090a318500b001a6c749e697so6617200pjb.1; Sat, 04 Dec 2021 01:53:08 -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=GW6b3sF6GwXHhqR55kptdOe2KtH0uXmQ535WwxRDhsU=; b=eX8Wa48ra4eTAbUzCOJnNU1tZ8LQ+5YwkjMF4cC9JNp6JnMctLCfNTRZ7InZ0I+Qgw FVfECKW4F52lrzjt3vh137DZkIUoY7hB47gSfr/K9H2QoqO7465U7lEdZiIizj/JYnFk bRoRZO41cYRH7VnyoUgkvvtsKAQWU5ZI23WV9EZiRrldtZERlW98OTwXF+tHGZgWjmMX VZ8ZbEgTX590IeapTCgsueZoPBhgDl+0oMTt7QfPhE5JvJ06Zi4kfRFyaSkQQ/Ajklu3 uz1hArULEkefVEcgnMPS3o8gHsHiWGlBc4of8r6zd0yOpf6s9sWt4D2fMJk6/PdQTdMu e0yg== 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=GW6b3sF6GwXHhqR55kptdOe2KtH0uXmQ535WwxRDhsU=; b=IHSusJ8GRLwrwVxCP2Xd+eBdkshxcH5YbO12hNGUURRhiMOwocHRsDjebRmfBSCLHW dRsTSQGZ/BE/l7PSWQJcZ0M4ge60ijyLnTL/HVy/SAS/2Xq0BSBNzd5Q1q0E4ii+Yijv +lTSQ8wX9BAcYsyLBIIMAMzB+ZVBcPk4+dOUXyrYkEwTETbfeGkppHVtyCAG+uAMl5dF zuf+1eR+M2+RtK8jdFgoz55IG14S6NvqIq6XMiAPI/S7UH517qilQJ60MVAMRraLcP4p x6oMv+oRFoCtmAKoGzG51/OKlUxE8GLPSMBJd6hQiI47aFxSgtpCzLgRlfeyHoPNhyOX f8kA== X-Gm-Message-State: AOAM532+pYFK6n+NCJ+qxDRi/Aq+zHqDGUu6wL3ttu/ze3WjqipIoKv1 rTsK0j7YcH+hRjj9mErWz0I= X-Google-Smtp-Source: ABdhPJw12fabYSRxUnXmqlFx9H8BClcqkjFEXyD2Xgc+LCeTuaPuNjEU+nngQzdL92YKIn8kJzo0XA== X-Received: by 2002:a17:903:18d:b0:142:8ab:d11f with SMTP id z13-20020a170903018d00b0014208abd11fmr29233302plg.47.1638611588164; Sat, 04 Dec 2021 01:53:08 -0800 (PST) Received: from vultr.guest ([45.76.74.237]) by smtp.gmail.com with ESMTPSA id ms15sm4343198pjb.26.2021.12.04.01.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Dec 2021 01:53:07 -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 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 , Alexei Starovoitov , Michal Miroslaw , Peter Zijlstra , Matthew Wilcox , Al Viro Subject: [PATCH -mm 1/5] elfcore: replace old hard-code 16 with TASK_COMM_LEN_16 Date: Sat, 4 Dec 2021 09:52:52 +0000 Message-Id: <20211204095256.78042-2-laoar.shao@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211204095256.78042-1-laoar.shao@gmail.com> References: <20211204095256.78042-1-laoar.shao@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org 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. 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 4 09:52:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 12656401 X-Patchwork-Delegate: bpf@iogearbox.net 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04FFAC433FE for ; Sat, 4 Dec 2021 09:53:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384556AbhLDJ4h (ORCPT ); Sat, 4 Dec 2021 04:56:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384546AbhLDJ4f (ORCPT ); Sat, 4 Dec 2021 04:56:35 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2F85C061751; Sat, 4 Dec 2021 01:53:09 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id w33-20020a17090a6ba400b001a722a06212so6643676pjj.0; Sat, 04 Dec 2021 01:53:09 -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=y/3OH0dv1UtiAFVROi6oJBNv875tsxlRHeEufUcGAE8=; b=SarWfOANlxY+W1wqzZLUdID9Fc3MKFpV03tydsm+v0n8XUl+dcwUDrvIiMoajZcN/8 VygHDL+xUCD/1rvmo4SnyP2WVPTJltzUxeDFRhWIJHSlIvbTENzg7A49yvMRspqt5kk8 GWVUqC9U/qbUiBA4LeT7O45VG2yDScE5EQzmMgDgJMB5jqBMFmaal7UuUJ8u5dmPdTGJ 83XteKkH/SE6b6jtPaiEtlYD5dVEae4/oo0qaR3E0V++A3XlLVER+QRX6/53iexk+IaZ enzhxKb+F6Nw1Uik2BMvUPFslykGrZv3WzczdX1dvZ252t/S6+BIi0RphSKjA3DDhb8S sXlw== 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=y/3OH0dv1UtiAFVROi6oJBNv875tsxlRHeEufUcGAE8=; b=bCinzKASWFp4yi3giURS1s6tv4PQvvnOYlAq+bkMap6jbQLVFzPMa+LYaEs1RTS6n3 MJGH0vqw9aVudU1FCKOXjDgSiSwqXYZbVErpEJJ6kW29knobpe+vwlE/qy4xmOKkV/7G jl8qwOJp4w4gwxGTUVXR/dFJ69pixxwvnbop66ujQ6KrcjFLBRBwyVHiUOfduyl/pV2N KFP7kenr5qNb+UWJJbGKirFMfcIpPxUpo887dePNOyjWsxwKmgOkh8vRFLi89EYJ+XcW BhTAqSruA1ai07MBv0EVzEs2R8HOP6rsJMRHOO9xAuKgUlIbbUMpmHzimcQdXs5CStJj S7hw== X-Gm-Message-State: AOAM532ZR+4IQCwGfOnwJmsKd6ByOcgMDv4ampJG6E6Zy7AN2vx4sc4O RAF/Gx/O527chihgW+ZZECo= X-Google-Smtp-Source: ABdhPJyWUyZ8FNI0GA/R20IXskf5Z9SPmJGG1ragdsZ42JEvCLKUvt/9eoB/AkMYg6APTu6I88aWLA== X-Received: by 2002:a17:902:e806:b0:142:830:eaa4 with SMTP id u6-20020a170902e80600b001420830eaa4mr28670068plg.16.1638611589538; Sat, 04 Dec 2021 01:53:09 -0800 (PST) Received: from vultr.guest ([45.76.74.237]) by smtp.gmail.com with ESMTPSA id ms15sm4343198pjb.26.2021.12.04.01.53.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Dec 2021 01:53:09 -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 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 , Alexei Starovoitov , Michal Miroslaw , Peter Zijlstra , Matthew Wilcox , Al Viro Subject: [PATCH -mm 2/5] cn_proc: replaced old hard-coded 16 with TASK_COMM_LEN_16 Date: Sat, 4 Dec 2021 09:52:53 +0000 Message-Id: <20211204095256.78042-3-laoar.shao@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211204095256.78042-1-laoar.shao@gmail.com> References: <20211204095256.78042-1-laoar.shao@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org 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 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 Acked-by: Steven Rostedt (VMware) --- 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 4 09:52:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 12656403 X-Patchwork-Delegate: bpf@iogearbox.net 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A899C433FE for ; Sat, 4 Dec 2021 09:53:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384594AbhLDJ4o (ORCPT ); Sat, 4 Dec 2021 04:56:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384552AbhLDJ4g (ORCPT ); Sat, 4 Dec 2021 04:56:36 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42A2CC061354; Sat, 4 Dec 2021 01:53:11 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id q17so3760108plr.11; Sat, 04 Dec 2021 01:53:11 -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=7KNky9vHErqn9OL9wm+gliP7fCGte3KeREk90aKC+mg=; b=qsHK5Wp3DDnxrHGKr78oHp3IvG22FXMQ6WLWibND/E4BbWM4VRjvkAOOeDurq/WY2z fOAeQgN/6YWcrKHrMoT2GS3f/Mc7fS1YBcI7oD9q/GKw3m0e4Gr7c3s5n9lB2VkrNMed UtdMn06egm/MpTXviwqTxAIO6ehe3o5MT9YHEmmQK93GlVRGSN/qnBnuwpCcK3S2inJR sNVFHTPd4HdI4Szm8nxVoxpw6iVU0r3IcOYsT4R/5ZyjNtEvX64EtfZ9S8u1M/a9WdG0 7yz9zKW0X0SDPHB1FlCbkCy7K4rbSCIL3m6c7UPYgDAJtWjwtq1TMgbS7AcjwwbYPHSl mbpQ== 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=7KNky9vHErqn9OL9wm+gliP7fCGte3KeREk90aKC+mg=; b=zSEZHAhQHQpZKUaHANXO/F9I8zQi+amMr6JWTrJIdO6XvpdUSYkosnXXmxYKCL3bLB Sruont0ReO2xUeXdTjFsReJ18D82xjh88kxxEs93hQbesTQJ6N4oJfFTLHnRjp5eFqyp 4EyufUQjfytPKcHMmz0cAN54483gJgl45AyBe1adzzRcqY2r1kRnNOhubi5C4NNo8wfC 9437Z/agu5q3ghymwruuX3ckumBzYzJ1Nd/U/SUtMk7HeeYbo50hfavFm5WfZZoD08tF paL+CMcFdUwSXpHUurYVOjUkAIFSvceMUeznOpguUKpJuW/v9Zgbl7BZDuAxCZAdxiLu 9LSg== X-Gm-Message-State: AOAM530Bh3+bKkpusFCGI0fMaabMRn5g3ikBdk0iC4sGOQIjrwiQz2Vi GK+GoqohntpqdY4vzotyOx0= X-Google-Smtp-Source: ABdhPJwqg6pKyGYMoMdlo2j7xJDfBIjTYhK1gMRW2j6TUtLmctuFv3TisafzMoi0MWS2K97dkPcYqQ== X-Received: by 2002:a17:902:bcc4:b0:141:bfc4:ada with SMTP id o4-20020a170902bcc400b00141bfc40adamr28918047pls.20.1638611590852; Sat, 04 Dec 2021 01:53:10 -0800 (PST) Received: from vultr.guest ([45.76.74.237]) by smtp.gmail.com with ESMTPSA id ms15sm4343198pjb.26.2021.12.04.01.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Dec 2021 01:53:10 -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 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 , Alexei Starovoitov , Michal Miroslaw , Peter Zijlstra , Matthew Wilcox , Al Viro Subject: [PATCH -mm 3/5] samples/bpf/tracex2: replace hard-coded 16 with TASK_COMM_LEN Date: Sat, 4 Dec 2021 09:52:54 +0000 Message-Id: <20211204095256.78042-4-laoar.shao@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211204095256.78042-1-laoar.shao@gmail.com> References: <20211204095256.78042-1-laoar.shao@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net The comm used in tracex2 should have the same size with the comm in task_struct, we'd better define the size of it as TASK_COMM_LEN to make it more grepable. linux/sched.h can be included in tracex2 kernel code, but it can't be included in tracex2 userspace code. So a new marco TASK_COMM_LEN is defined in tracex2 userspace code. 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 --- samples/bpf/tracex2_kern.c | 3 ++- samples/bpf/tracex2_user.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/samples/bpf/tracex2_kern.c b/samples/bpf/tracex2_kern.c index 5bc696bac27d..51dbaf765cd5 100644 --- a/samples/bpf/tracex2_kern.c +++ b/samples/bpf/tracex2_kern.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -65,7 +66,7 @@ static unsigned int log2l(unsigned long v) } struct hist_key { - char comm[16]; + char comm[TASK_COMM_LEN]; u64 pid_tgid; u64 uid_gid; u64 index; diff --git a/samples/bpf/tracex2_user.c b/samples/bpf/tracex2_user.c index 1626d51dfffd..b728a946d83d 100644 --- a/samples/bpf/tracex2_user.c +++ b/samples/bpf/tracex2_user.c @@ -12,6 +12,7 @@ #define MAX_INDEX 64 #define MAX_STARS 38 +#define TASK_COMM_LEN 16 /* my_map, my_hist_map */ static int map_fd[2]; @@ -28,7 +29,7 @@ static void stars(char *str, long val, long max, int width) } struct task { - char comm[16]; + char comm[TASK_COMM_LEN]; __u64 pid_tgid; __u64 uid_gid; }; From patchwork Sat Dec 4 09:52:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 12656405 X-Patchwork-Delegate: bpf@iogearbox.net 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD12BC433F5 for ; Sat, 4 Dec 2021 09:53:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384585AbhLDJ4n (ORCPT ); Sat, 4 Dec 2021 04:56:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384558AbhLDJ4h (ORCPT ); Sat, 4 Dec 2021 04:56:37 -0500 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D1BDC061751; Sat, 4 Dec 2021 01:53:12 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id g19so5295915pfb.8; Sat, 04 Dec 2021 01:53:12 -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=jc/1UqX6dBziNJTgW2IO/F7rtsTi2nR5UyyzWa0yaTY=; b=OPS6Tq0grzniAtkhVxBUnYGlNHe2LHenEl9GBTJUtoQpFmZ4NpGLdXZjKUgC7IZqdL ZKWU9aSUkUqHoSXlb9199RCCbprlEwAz/eREA8MLQnnkIgsEEY3qPvF/NMesCapvpCTL CDJI0dUFjTdXdtPWz0FFQdAtRz26RuQoiQvkBRzKFySMAH48+WOoxFj1q+RcM1mq8PJA 4HpF89d8G613VAWp+7lBQWZzOShQCn6ZJ9mRR7ESbX0eCDt7rNkgILW7w1PQEFJhi3gT yF3ugmTHCdttEto30CCqoAPVMIpMK7h+XNAJYJWgzLuqIe2i7V6I3L23Amzdh+sY9Pc8 tOmw== 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=jc/1UqX6dBziNJTgW2IO/F7rtsTi2nR5UyyzWa0yaTY=; b=3hUN/Fb0jkawNHT+khD9Rs1Fef00KawgSg9os2tNzpqWK+LqKdmHgljzBAl1vD2+AM XOpcdmhiy3nl336PnDoNJP7D5xffW2aDYc/q3ab05gKNfeQ1JEHe4/huTsbq7Ot5JoVV NWHNwLvmdhbmok4O0CWIH1ly9/mMRwgfABC5XUTSViuLipLZM/HLd4qiwcQqQw09bPt2 nARBLI/Moz7y5JP3JnTy2QM28yHjzhKFu5AakTBDIMHdKaact3uy+PYlgbtdPkDuljw/ Bwl8BIPr251cUgOJ3qSAJyVO3By3+wACjDh5wmTJ2pxWb2CnCDF4RXJMG+iwe28mUt3w Pniw== X-Gm-Message-State: AOAM532sUXFWgSVuuxHP5iWoyEDf7WBaQaFpdFFXyr5aacfWMTs9dJII COJr/TyUNdInrxtlq4U2nRk= X-Google-Smtp-Source: ABdhPJxOtpMKrYAZBUYRY5WFF9PUZ3+zcvLt12isc0/o9+IZvyummoBi6CX2Z881q/Ptmt968HlHTw== X-Received: by 2002:a63:1107:: with SMTP id g7mr8918770pgl.108.1638611592149; Sat, 04 Dec 2021 01:53:12 -0800 (PST) Received: from vultr.guest ([45.76.74.237]) by smtp.gmail.com with ESMTPSA id ms15sm4343198pjb.26.2021.12.04.01.53.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Dec 2021 01:53:11 -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 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 , Alexei Starovoitov , Michal Miroslaw , Peter Zijlstra , Matthew Wilcox , Al Viro Subject: [PATCH -mm 4/5] tools/perf: replace hard-coded 16 with TASK_COMM_LEN Date: Sat, 4 Dec 2021 09:52:55 +0000 Message-Id: <20211204095256.78042-5-laoar.shao@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211204095256.78042-1-laoar.shao@gmail.com> References: <20211204095256.78042-1-laoar.shao@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org evsel-tp-sched will verify the task comm len in sched:sched_switch and sched:sched_wakeup tracepoints. The len must be same with TASK_COMM_LEN defined in linux/sched.h. In order to make it grepable, we'd better replace the hard-coded 16 with TASK_COMM_LEN. 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..83e0ce2e676f 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 + 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, 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, 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, false)) ret = -1; if (evsel__test_field(evsel, "pid", 4, true)) From patchwork Sat Dec 4 09:52:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 12656407 X-Patchwork-Delegate: bpf@iogearbox.net 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49A9DC43217 for ; Sat, 4 Dec 2021 09:53:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384607AbhLDJ4q (ORCPT ); Sat, 4 Dec 2021 04:56:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384564AbhLDJ4j (ORCPT ); Sat, 4 Dec 2021 04:56:39 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09B02C061A83; Sat, 4 Dec 2021 01:53:14 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id f125so5605749pgc.0; Sat, 04 Dec 2021 01:53:14 -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=czJoVryBJuRcT/ehuX/TDIeW+lRJT86wq9/OvXnh70g=; b=E6qLZya8+ifZxNJOIPiTCTofzYjJThBlfeuM51/2mqfsnjW5NtrNTz/6a0nEh7jmKU VGTTs3/RbA7s8syhuDBh+k70qRK3hetMq9n8itSkvFJ+mtTIN0Uc+WJOANDPdKHwH8vs k8udbqT/eL9Tzpjtsu+6e9o/SLIkzrLwPCDSvquIL+N5FwmpTXeP1wqnmE7nQK/1dJZO ksP728T5KeU42m8NPGDNz1UCB83nn0OrhifZgrDL+dypJQ5KxuroJ3f30wEMYdTajgp1 tA72KBktvSwUiATQBi7Hc+gb1PlQJIXCz0eUPuwixg5JmBdOEYIRfpkwowmfkmIn30dq VNVw== 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=czJoVryBJuRcT/ehuX/TDIeW+lRJT86wq9/OvXnh70g=; b=KN0cAaCvFMtL9uhNfN9W6wPZotL0glCFfEQGFDqthn+N2v6LMTUqTUOvbwyKhw3fEs QRgOew7yEGuOASD+t6Hi3W5F14xm+KUlTrvGjo/6lHx/WlFz+ysEYWRjfxIa+BfkeO8i aESEtAXF4Rf1cSji95NHolZY/TI4RZzImrN5uRLEBmVt4kyFwqy0vmeSH2VNjk48qHdB 1Nx+P0QHcl6ohImJgTgEHbezpW8yscCsng1mhIVQrbefXQieKdSFndzx0U6KKbXJl/7Y BNRDQrSzbg+6FccbHulfv/NMEn+MdfCuHJ9MRpDFJGJDtRdJwtXLOH8bvkJaRrZUiLTA LjLg== X-Gm-Message-State: AOAM53300BVZIi/DEJ3OY307FecX0/xCLirwSu4SJSHwPpZIsAwrT2rx nxle5PBYVMs5T73r2yuK9S8= X-Google-Smtp-Source: ABdhPJxzLifxgl4vQbzEDYn+z7ENKxXxDFCDs3LmIROFaOViZ6d6BbSiRJPdAV7fU9k00bDw17QoEA== X-Received: by 2002:a65:6790:: with SMTP id e16mr8839078pgr.112.1638611593497; Sat, 04 Dec 2021 01:53:13 -0800 (PST) Received: from vultr.guest ([45.76.74.237]) by smtp.gmail.com with ESMTPSA id ms15sm4343198pjb.26.2021.12.04.01.53.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Dec 2021 01:53:13 -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 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 , Alexei Starovoitov , Michal Miroslaw , Peter Zijlstra , Matthew Wilcox , Al Viro Subject: [PATCH -mm 5/5] bpf/progs: replace hard-coded 16 with TASK_COMM_LEN Date: Sat, 4 Dec 2021 09:52:56 +0000 Message-Id: <20211204095256.78042-6-laoar.shao@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211204095256.78042-1-laoar.shao@gmail.com> References: <20211204095256.78042-1-laoar.shao@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net The comm used in these bpf progs should have the same size with the comm field in struct task_struct defined in linux/sched.h. We'd better define the size as TASK_COMM_LEN to make it more grepable. The bpf progs kernel code can inlcude vmlinux.h generated by BTF CO-RE to use TASK_COMM_LEN, while the userspace code can't include it so TASK_COMM_LEN is specifically defined in the userspace code. In order to fix redefinitions caused by the new included vmlinux.h, some headers are removed and some structs are renamed. 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/testing/selftests/bpf/prog_tests/ringbuf.c | 9 +++++---- .../testing/selftests/bpf/prog_tests/ringbuf_multi.c | 8 +++++--- .../selftests/bpf/prog_tests/sk_storage_tracing.c | 3 ++- .../testing/selftests/bpf/prog_tests/test_overhead.c | 3 ++- .../selftests/bpf/prog_tests/trampoline_count.c | 3 ++- .../selftests/bpf/progs/test_core_reloc_kernel.c | 11 +++++------ tools/testing/selftests/bpf/progs/test_ringbuf.c | 8 ++++---- .../testing/selftests/bpf/progs/test_ringbuf_multi.c | 8 ++++---- .../selftests/bpf/progs/test_sk_storage_tracing.c | 4 ++-- 9 files changed, 31 insertions(+), 26 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/ringbuf.c b/tools/testing/selftests/bpf/prog_tests/ringbuf.c index 9a80fe8a6427..39e43245db0a 100644 --- a/tools/testing/selftests/bpf/prog_tests/ringbuf.c +++ b/tools/testing/selftests/bpf/prog_tests/ringbuf.c @@ -15,14 +15,15 @@ #include "test_ringbuf.lskel.h" #define EDONE 7777 +#define TASK_COMM_LEN 16 static int duration = 0; -struct sample { +struct sample_ringbuf { int pid; int seq; long value; - char comm[16]; + char comm[TASK_COMM_LEN]; }; static int sample_cnt; @@ -39,7 +40,7 @@ static int atomic_xchg(int *cnt, int val) static int process_sample(void *ctx, void *data, size_t len) { - struct sample *s = data; + struct sample_ringbuf *s = data; atomic_inc(&sample_cnt); @@ -83,7 +84,7 @@ static void *poll_thread(void *input) void test_ringbuf(void) { - const size_t rec_sz = BPF_RINGBUF_HDR_SZ + sizeof(struct sample); + const size_t rec_sz = BPF_RINGBUF_HDR_SZ + sizeof(struct sample_ringbuf); pthread_t thread; long bg_ret = -1; int err, cnt, rb_fd; diff --git a/tools/testing/selftests/bpf/prog_tests/ringbuf_multi.c b/tools/testing/selftests/bpf/prog_tests/ringbuf_multi.c index e945195b24c9..cb592555513f 100644 --- a/tools/testing/selftests/bpf/prog_tests/ringbuf_multi.c +++ b/tools/testing/selftests/bpf/prog_tests/ringbuf_multi.c @@ -4,19 +4,21 @@ #include #include "test_ringbuf_multi.skel.h" +#define TASK_COMM_LEN 16 + static int duration = 0; -struct sample { +struct sample_ringbuf { int pid; int seq; long value; - char comm[16]; + char comm[TASK_COMM_LEN]; }; static int process_sample(void *ctx, void *data, size_t len) { int ring = (unsigned long)ctx; - struct sample *s = data; + struct sample_ringbuf *s = data; switch (s->seq) { case 0: diff --git a/tools/testing/selftests/bpf/prog_tests/sk_storage_tracing.c b/tools/testing/selftests/bpf/prog_tests/sk_storage_tracing.c index 547ae53cde74..dbbdbf4400d7 100644 --- a/tools/testing/selftests/bpf/prog_tests/sk_storage_tracing.c +++ b/tools/testing/selftests/bpf/prog_tests/sk_storage_tracing.c @@ -11,11 +11,12 @@ #define LO_ADDR6 "::1" #define TEST_COMM "test_progs" +#define TASK_COMM_LEN 16 struct sk_stg { __u32 pid; __u32 last_notclose_state; - char comm[16]; + char comm[TASK_COMM_LEN]; }; static struct test_sk_storage_tracing *skel; diff --git a/tools/testing/selftests/bpf/prog_tests/test_overhead.c b/tools/testing/selftests/bpf/prog_tests/test_overhead.c index 123c68c1917d..7fe60ec12fc4 100644 --- a/tools/testing/selftests/bpf/prog_tests/test_overhead.c +++ b/tools/testing/selftests/bpf/prog_tests/test_overhead.c @@ -6,6 +6,7 @@ #include #define MAX_CNT 100000 +#define TASK_COMM_LEN 16 static __u64 time_get_ns(void) { @@ -67,7 +68,7 @@ void test_test_overhead(void) struct bpf_object *obj; struct bpf_link *link; int err, duration = 0; - char comm[16] = {}; + char comm[TASK_COMM_LEN] = {}; if (CHECK_FAIL(prctl(PR_GET_NAME, comm, 0L, 0L, 0L))) return; diff --git a/tools/testing/selftests/bpf/prog_tests/trampoline_count.c b/tools/testing/selftests/bpf/prog_tests/trampoline_count.c index fc146671b20a..da83f7408aa8 100644 --- a/tools/testing/selftests/bpf/prog_tests/trampoline_count.c +++ b/tools/testing/selftests/bpf/prog_tests/trampoline_count.c @@ -5,6 +5,7 @@ #include #define MAX_TRAMP_PROGS 38 +#define TASK_COMM_LEN 16 struct inst { struct bpf_object *obj; @@ -51,7 +52,7 @@ void serial_test_trampoline_count(void) int err, i = 0, duration = 0; struct bpf_object *obj; struct bpf_link *link; - char comm[16] = {}; + char comm[TASK_COMM_LEN] = {}; /* attach 'allowed' trampoline programs */ for (i = 0; i < MAX_TRAMP_PROGS; i++) { diff --git a/tools/testing/selftests/bpf/progs/test_core_reloc_kernel.c b/tools/testing/selftests/bpf/progs/test_core_reloc_kernel.c index 145028b52ad8..7b1bb73c3501 100644 --- a/tools/testing/selftests/bpf/progs/test_core_reloc_kernel.c +++ b/tools/testing/selftests/bpf/progs/test_core_reloc_kernel.c @@ -1,8 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook -#include -#include +#include #include #include #include @@ -23,11 +22,11 @@ struct core_reloc_kernel_output { int comm_len; }; -struct task_struct { +struct task_struct_reloc { int pid; int tgid; - char comm[16]; - struct task_struct *group_leader; + char comm[TASK_COMM_LEN]; + struct task_struct_reloc *group_leader; }; #define CORE_READ(dst, src) bpf_core_read(dst, sizeof(*(dst)), src) @@ -35,7 +34,7 @@ struct task_struct { SEC("raw_tracepoint/sys_enter") int test_core_kernel(void *ctx) { - struct task_struct *task = (void *)bpf_get_current_task(); + struct task_struct_reloc *task = (void *)bpf_get_current_task(); struct core_reloc_kernel_output *out = (void *)&data.out; uint64_t pid_tgid = bpf_get_current_pid_tgid(); uint32_t real_tgid = (uint32_t)pid_tgid; diff --git a/tools/testing/selftests/bpf/progs/test_ringbuf.c b/tools/testing/selftests/bpf/progs/test_ringbuf.c index eaa7d9dba0be..45b28965f3a5 100644 --- a/tools/testing/selftests/bpf/progs/test_ringbuf.c +++ b/tools/testing/selftests/bpf/progs/test_ringbuf.c @@ -1,16 +1,16 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Facebook -#include +#include #include char _license[] SEC("license") = "GPL"; -struct sample { +struct sample_ringbuf { int pid; int seq; long value; - char comm[16]; + char comm[TASK_COMM_LEN]; }; struct { @@ -39,7 +39,7 @@ SEC("fentry/__x64_sys_getpgid") int test_ringbuf(void *ctx) { int cur_pid = bpf_get_current_pid_tgid() >> 32; - struct sample *sample; + struct sample_ringbuf *sample; int zero = 0; if (cur_pid != pid) diff --git a/tools/testing/selftests/bpf/progs/test_ringbuf_multi.c b/tools/testing/selftests/bpf/progs/test_ringbuf_multi.c index 197b86546dca..7c9db148f168 100644 --- a/tools/testing/selftests/bpf/progs/test_ringbuf_multi.c +++ b/tools/testing/selftests/bpf/progs/test_ringbuf_multi.c @@ -1,16 +1,16 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Facebook -#include +#include #include char _license[] SEC("license") = "GPL"; -struct sample { +struct sample_ringbuf { int pid; int seq; long value; - char comm[16]; + char comm[TASK_COMM_LEN]; }; struct ringbuf_map { @@ -55,7 +55,7 @@ SEC("tp/syscalls/sys_enter_getpgid") int test_ringbuf(void *ctx) { int cur_pid = bpf_get_current_pid_tgid() >> 32; - struct sample *sample; + struct sample_ringbuf *sample; void *rb; int zero = 0; diff --git a/tools/testing/selftests/bpf/progs/test_sk_storage_tracing.c b/tools/testing/selftests/bpf/progs/test_sk_storage_tracing.c index 6dc1f28fc4b6..cc41a09e3130 100644 --- a/tools/testing/selftests/bpf/progs/test_sk_storage_tracing.c +++ b/tools/testing/selftests/bpf/progs/test_sk_storage_tracing.c @@ -9,7 +9,7 @@ struct sk_stg { __u32 pid; __u32 last_notclose_state; - char comm[16]; + char comm[TASK_COMM_LEN]; }; struct { @@ -27,7 +27,7 @@ struct { __type(value, int); } del_sk_stg_map SEC(".maps"); -char task_comm[16] = ""; +char task_comm[TASK_COMM_LEN] = ""; SEC("tp_btf/inet_sock_set_state") int BPF_PROG(trace_inet_sock_set_state, struct sock *sk, int oldstate,