From mboxrd@z Thu Jan 1 00:00:00 1970 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 181D1C433EF for ; Mon, 29 Nov 2021 14:39:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7E6176B00A0; Mon, 29 Nov 2021 09:39:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 795B46B00A2; Mon, 29 Nov 2021 09:39:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 636136B00A3; Mon, 29 Nov 2021 09:39:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0120.hostedemail.com [216.40.44.120]) by kanga.kvack.org (Postfix) with ESMTP id 56A506B00A0 for ; Mon, 29 Nov 2021 09:39:26 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 15D04182CA8F3 for ; Mon, 29 Nov 2021 14:39:16 +0000 (UTC) X-FDA: 78862225470.02.A9671E5 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf12.hostedemail.com (Postfix) with ESMTP id 7D14210000AF for ; Mon, 29 Nov 2021 14:39:15 +0000 (UTC) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1ATELQk5004373; Mon, 29 Nov 2021 14:38:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : references : date : in-reply-to : message-id : content-type : mime-version; s=pp1; bh=psXxLdwgVEfnMFpvXcmOhsuzbnixwOwpECiDllB2p2s=; b=UrUjl8gxrQqUiuM9ig65LsK8IPLa9BMrdxtleUAK4SgasupVKzbLE94r022+ZnjMGu7i nqBkSuKlF9kZXMpDW8Fw14NsV6oqYZSyQtG6rim+p43Q8/gjbqY0AFnp2du4mOOCFwWS D1UdtOn49Y/IcLKhW40JUsTcHg8Ii/DMwbVXECqrrW172FbGL1Z8zRBQSSndvvyW3yyA BK1OjUopyF3GSexF1rLfB4wayFAdZ8YQWt3e2qUxB0tRe3hVfEA8mPSjS5QelBe2AMBm 2VhOwceKNO+qPTGGWixhqY6xZU/mqr+4S7po081C7eMhMUwkhudu1SZTFlH6jEPRUOKd vw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3cn0j8rdyf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 29 Nov 2021 14:38:49 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1ATEMXKM008522; Mon, 29 Nov 2021 14:38:49 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 3cn0j8rdxt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 29 Nov 2021 14:38:49 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1ATESIiO020879; Mon, 29 Nov 2021 14:38:46 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06ams.nl.ibm.com with ESMTP id 3ckbxjnx71-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 29 Nov 2021 14:38:46 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1ATEVIQE36504026 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 29 Nov 2021 14:31:18 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4A25252052; Mon, 29 Nov 2021 14:38:44 +0000 (GMT) Received: from tuxmaker.linux.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id ABFAF52059; Mon, 29 Nov 2021 14:38:43 +0000 (GMT) From: Sven Schnelle To: David Hildenbrand Cc: Yafang Shao , Andrew Morton , netdev , bpf , "linux-perf-use." , linux-fsdevel@vger.kernel.org, Linux MM , LKML , kernel test robot , kbuild test robot , Andrii Nakryiko , Mathieu Desnoyers , Arnaldo Carvalho de Melo , Andrii Nakryiko , Michal Miroslaw , Peter Zijlstra , Steven Rostedt , Matthew Wilcox , Al Viro , Kees Cook , Petr Mladek Subject: Re: [PATCH v2 7/7] tools/testing/selftests/bpf: replace open-coded 16 with TASK_COMM_LEN References: <20211120112738.45980-1-laoar.shao@gmail.com> <20211120112738.45980-8-laoar.shao@gmail.com> <54e1b56c-e424-a4b3-4d61-3018aa095f36@redhat.com> Date: Mon, 29 Nov 2021 15:38:43 +0100 In-Reply-To: <54e1b56c-e424-a4b3-4d61-3018aa095f36@redhat.com> (David Hildenbrand's message of "Mon, 29 Nov 2021 15:32:26 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ETDg9BFbTme7HiDfY2tb_B3LhNdBNEJU X-Proofpoint-GUID: UY2W4q60_I3lDZdKPxr3dXpyNLCmd1d5 X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-29_08,2021-11-28_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 clxscore=1015 bulkscore=0 mlxscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2111290073 X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 7D14210000AF X-Stat-Signature: cxf4d8i7cu5r439sfmmgjh4393egsj1k Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=UrUjl8gx; spf=pass (imf12.hostedemail.com: domain of svens@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=svens@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com X-HE-Tag: 1638196755-346871 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: Hi, David Hildenbrand writes: > On 29.11.21 15:21, Sven Schnelle wrote: >> Yafang Shao writes: >>> Thanks for the report and debugging! >>> Seems we should explicitly define it as signed ? >>> Could you pls. help verify it? >>> >>> diff --git a/include/linux/sched.h b/include/linux/sched.h >>> index cecd4806edc6..44d36c6af3e1 100644 >>> --- a/include/linux/sched.h >>> +++ b/include/linux/sched.h >>> @@ -278,7 +278,7 @@ struct task_group; >>> * Define the task command name length as enum, then it can be visible to >>> * BPF programs. >>> */ >>> -enum { >>> +enum SignedEnum { >>> TASK_COMM_LEN = 16, >>> }; >> >> Umm no. What you're doing here is to define the name of the enum as >> 'SignedEnum'. This doesn't change the type. I think before C++0x you >> couldn't force an enum type. > > I think there are only some "hacks" to modify the type with GCC. For > example, with "__attribute__((packed))" we can instruct GCC to use the > smallest type possible for the defined enum values. Yes, i meant no way that the standard defines. You could force it to signed by having a negative member. > I think with some fake entries one can eventually instruct GCC to use an > unsigned type in some cases: > > https://stackoverflow.com/questions/14635833/is-there-a-way-to-make-an-enum-unsigned-in-the-c90-standard-misra-c-2004-compl > > enum { > TASK_COMM_LEN = 16, > TASK_FORCE_UNSIGNED = 0x80000000, > }; > > Haven't tested it, though, and I'm not sure if we should really do that > ... :) TBH, i would vote for reverting the change. defining an array size as enum feels really odd. Regards Sven