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 6ADEBC54E65 for ; Thu, 22 May 2025 19:46:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE9B26B007B; Thu, 22 May 2025 15:46:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D99D06B0083; Thu, 22 May 2025 15:46:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C89576B0085; Thu, 22 May 2025 15:46:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A808F6B007B for ; Thu, 22 May 2025 15:46:47 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 594F2C039F for ; Thu, 22 May 2025 19:46:47 +0000 (UTC) X-FDA: 83471576454.07.507F4E3 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by imf15.hostedemail.com (Postfix) with ESMTP id 97493A0008 for ; Thu, 22 May 2025 19:46:45 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=Cll4vntr; spf=pass (imf15.hostedemail.com: domain of bhsharma@igalia.com designates 213.97.179.56 as permitted sender) smtp.mailfrom=bhsharma@igalia.com; dmarc=pass (policy=none) header.from=igalia.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1747943205; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qeZlnXYF3mBRhpPdC9Jj7FrmO4B5jYVsug5/mB2ATrk=; b=UoLVGLnx9ffAOWcWX+vOIIsU1MjOw1OpcaPXg3DYjhdBnMd2lj14/UFc274QFegMOUaEyN 09utQ7xn7FhQg1myN1g5j530eScMEhw4OOqY53nh98JE7rHywI454gkSveD7CGfcjy/AS7 tkWZO4OvF+BLIvbRsIurMUHSMc0CVTU= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=Cll4vntr; spf=pass (imf15.hostedemail.com: domain of bhsharma@igalia.com designates 213.97.179.56 as permitted sender) smtp.mailfrom=bhsharma@igalia.com; dmarc=pass (policy=none) header.from=igalia.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1747943205; a=rsa-sha256; cv=none; b=PKTAXCJ1pjo8apfX5yRf7J/+igHe5IzfUO1ylQcojvzqEu37q4H/3oNzGK1zXcMnq58ij6 6NSCcFkCSLMS0FizM5kbLY+WcENg3cy5ENwMGTgYC/IP4/W+gqH4pHx+I2bI/+/7tIcDLL PrYEYMWNy4CFXma6crkDvQQoMaAesTA= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=qeZlnXYF3mBRhpPdC9Jj7FrmO4B5jYVsug5/mB2ATrk=; b=Cll4vntrWxDQHGd06wM/5/FPon d/xHRk/fvEtuUYRc6hg8+jQOGB/wQa4NEPh8TtKTEEnD8JI8UKykDQkvNNqg9Ar01RtAFWBHlmHRd o69Saiy5TK1TRu77be7AvDco+WSd5iszqybMsZU6wMcJil9CpM+F4RJvOrZh8vdAeSm1nPbuNrJG/ nMfJTosrIPc45cS5N2xeGCNE/JDUeq6Hyo0BiVtO2sPbcN3SwdOw+6qlhAVB9LN6q0ww43EK1DoBF SJ4Ltp7uoeVb3MPzhJp/wcfm9jI0G8wMiHg5EEzMLu79hdRHvG/5fpl4Pj30Ej2FFCwr2xUD/CMfw HP1hjY0A==; Received: from [223.233.76.245] (helo=[192.168.1.12]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1uIBsF-00Bryb-K6; Thu, 22 May 2025 21:46:39 +0200 Message-ID: <24840570-913e-1603-eb92-baefd4758784@igalia.com> Date: Fri, 23 May 2025 01:16:31 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH v4 2/3] treewide: Switch memcpy() users of 'task->comm' to a more safer implementation Content-Language: en-US To: kernel test robot , Bhupesh , akpm@linux-foundation.org Cc: oe-kbuild-all@lists.linux.dev, kernel-dev@igalia.com, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, oliver.sang@intel.com, laoar.shao@gmail.com, pmladek@suse.com, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, arnaldo.melo@gmail.com, alexei.starovoitov@gmail.com, andrii.nakryiko@gmail.com, mirq-linux@rere.qmqm.pl, peterz@infradead.org, willy@infradead.org, david@redhat.com, viro@zeniv.linux.org.uk, keescook@chromium.org, ebiederm@xmission.com, brauner@kernel.org, jack@suse.cz, mingo@redhat.com, juri.lelli@redhat.com, bsegall@google.com, mgorman@suse.de References: <20250521062337.53262-3-bhupesh@igalia.com> <202505220326.5yDQHjnt-lkp@intel.com> From: Bhupesh Sharma In-Reply-To: <202505220326.5yDQHjnt-lkp@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 97493A0008 X-Stat-Signature: mgxa851ibgbzpq4gxjgqb37ieg4uemof X-Rspam-User: X-HE-Tag: 1747943205-940785 X-HE-Meta: U2FsdGVkX1+AkRWO8lOdserjRuIu0FQGrs+403t7UfwCpXKRbl+5Bfk0IzG0X5KnHjZMln5U76E+dMk5To7xkZP4lrZMTH4n/kA9tqOop6aEavGe0lZltERlM2HfxaGNoGw7/WYTnD3MGIV4m7iQMkWTXN4GOKvNaubjyz3VV34FgDhlljvidF3dxGhGY6Ayy6661tKy1Vj79WOUU0FnGxXIl5eH4h3GEmWTfHVX2qynCl4yGMzHA9s5tCTCAU9mnzxH2YTnMKvJPvgOHEQlazFfE4BFVp2/gMaDvRbhQ0jSRo0mpdz1TYIqOI/i4hhYfx2iPRWq1AT5pxxhJxsEGQBNdSvVQirknmECMovhq458P1hoKO4LTHBmKinQ01PKH6oEYhU9biXEm0sY/HT4Zjrh0gtCLt6hCjEHiUAQzoFVx034gYnGTM+7z1UWJadhJUn6fsZu6ETbFI9wZBKEwvdSGD/R9o5Y3VgqQo+c6IQotS60eOtETPL4wmT58C6R6P6SZeRJ521ZmDixCvnsP+S8emXYQLKYHJj+bp8qmwgt3QsRFuprZKuw2KRBnK8dh2Icmqs17pKT6jbkuOadqc8EbYQ8VISsOqRING1GwwiCMpS8Ei8g8Dxvli8CGTWQp7MohZEOEE5Wdk8z6LKR0nIDNvmROmm3hmcn9ZzlV9VwfNo7FVFQekir4SEVrzDrM49zZey/dWBMcQgX1h7hW6c8RBqJOPo8favEg5o/8T3n2KzGAD5Sph5aO/CrnN01ThcC/Z69onpGzhPags4kviRBVEFYxOn4HpUFPKTQtFO7c/wv2VHYJvUI9grDkaKHZD3hNJkwCLgpyKiETlG3qWaq9IWbFTAGyTKPMYdEJaJYaVoQt7ijxYjKRpXkvdYCW2aBLHDYCfGS9u5J7sp+ueqr0tq4VK8yOfs8GY73EYgjulglGidHMngjiUBk2/3O23aTAoZ33K9DAycSffh p96XEYaT ed2b2 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: List-Subscribe: List-Unsubscribe: Hi, On 5/22/25 1:32 AM, kernel test robot wrote: > Hi Bhupesh, > > kernel test robot noticed the following build warnings: > > [auto build test WARNING on trace/for-next] > [also build test WARNING on tip/sched/core akpm-mm/mm-everything linus/master v6.15-rc7 next-20250521] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: https://github.com/intel-lab-lkp/linux/commits/Bhupesh/exec-Remove-obsolete-comments/20250521-142443 > base: https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next > patch link: https://lore.kernel.org/r/20250521062337.53262-3-bhupesh%40igalia.com > patch subject: [PATCH v4 2/3] treewide: Switch memcpy() users of 'task->comm' to a more safer implementation > config: arc-randconfig-002-20250522 (https://download.01.org/0day-ci/archive/20250522/202505220326.5yDQHjnt-lkp@intel.com/config) > compiler: arc-linux-gcc (GCC) 8.5.0 > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250522/202505220326.5yDQHjnt-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot > | Closes: https://lore.kernel.org/oe-kbuild-all/202505220326.5yDQHjnt-lkp@intel.com/ > > All warnings (new ones prefixed by >>): > > In file included from fs/coredump.c:20: > fs/coredump.c: In function 'do_coredump': >>> include/linux/coredump.h:57:7: warning: array subscript 16 is above array bounds of 'char[16]' [-Warray-bounds] > comm[TASK_COMM_LEN] = '\0'; \ > ~~~~^~~~~~~~~~~~~~~ > include/linux/coredump.h:63:43: note: in expansion of macro '__COREDUMP_PRINTK' > #define coredump_report_failure(fmt, ...) __COREDUMP_PRINTK(KERN_WARNING, fmt, ##__VA_ARGS__) > ^~~~~~~~~~~~~~~~~ > fs/coredump.c:655:4: note: in expansion of macro 'coredump_report_failure' > coredump_report_failure( > ^~~~~~~~~~~~~~~~~~~~~~~ >>> include/linux/coredump.h:57:7: warning: array subscript 16 is above array bounds of 'char[16]' [-Warray-bounds] > comm[TASK_COMM_LEN] = '\0'; \ > ~~~~^~~~~~~~~~~~~~~ > include/linux/coredump.h:63:43: note: in expansion of macro '__COREDUMP_PRINTK' > #define coredump_report_failure(fmt, ...) __COREDUMP_PRINTK(KERN_WARNING, fmt, ##__VA_ARGS__) > ^~~~~~~~~~~~~~~~~ > fs/coredump.c:730:4: note: in expansion of macro 'coredump_report_failure' > coredump_report_failure("Core dump to %s aborted: " > ^~~~~~~~~~~~~~~~~~~~~~~ >>> include/linux/coredump.h:57:7: warning: array subscript 16 is above array bounds of 'char[16]' [-Warray-bounds] > comm[TASK_COMM_LEN] = '\0'; \ > ~~~~^~~~~~~~~~~~~~~ > include/linux/coredump.h:63:43: note: in expansion of macro '__COREDUMP_PRINTK' > #define coredump_report_failure(fmt, ...) __COREDUMP_PRINTK(KERN_WARNING, fmt, ##__VA_ARGS__) > ^~~~~~~~~~~~~~~~~ > fs/coredump.c:725:4: note: in expansion of macro 'coredump_report_failure' > coredump_report_failure("Core dump to %s aborted: " > ^~~~~~~~~~~~~~~~~~~~~~~ >>> include/linux/coredump.h:57:7: warning: array subscript 16 is above array bounds of 'char[16]' [-Warray-bounds] > comm[TASK_COMM_LEN] = '\0'; \ > ~~~~^~~~~~~~~~~~~~~ > include/linux/coredump.h:63:43: note: in expansion of macro '__COREDUMP_PRINTK' > #define coredump_report_failure(fmt, ...) __COREDUMP_PRINTK(KERN_WARNING, fmt, ##__VA_ARGS__) > ^~~~~~~~~~~~~~~~~ > fs/coredump.c:618:4: note: in expansion of macro 'coredump_report_failure' > coredump_report_failure("over core_pipe_limit, skipping core dump"); > ^~~~~~~~~~~~~~~~~~~~~~~ >>> include/linux/coredump.h:57:7: warning: array subscript 16 is above array bounds of 'char[16]' [-Warray-bounds] > comm[TASK_COMM_LEN] = '\0'; \ > ~~~~^~~~~~~~~~~~~~~ > include/linux/coredump.h:63:43: note: in expansion of macro '__COREDUMP_PRINTK' > #define coredump_report_failure(fmt, ...) __COREDUMP_PRINTK(KERN_WARNING, fmt, ##__VA_ARGS__) > ^~~~~~~~~~~~~~~~~ > fs/coredump.c:642:4: note: in expansion of macro 'coredump_report_failure' > coredump_report_failure("|%s pipe failed", cn.corename); > ^~~~~~~~~~~~~~~~~~~~~~~ >>> include/linux/coredump.h:57:7: warning: array subscript 16 is above array bounds of 'char[16]' [-Warray-bounds] > comm[TASK_COMM_LEN] = '\0'; \ > ~~~~^~~~~~~~~~~~~~~ > include/linux/coredump.h:63:43: note: in expansion of macro '__COREDUMP_PRINTK' > #define coredump_report_failure(fmt, ...) __COREDUMP_PRINTK(KERN_WARNING, fmt, ##__VA_ARGS__) > ^~~~~~~~~~~~~~~~~ > fs/coredump.c:625:4: note: in expansion of macro 'coredump_report_failure' > coredump_report_failure("%s failed to allocate memory", __func__); > ^~~~~~~~~~~~~~~~~~~~~~~ >>> include/linux/coredump.h:57:7: warning: array subscript 16 is above array bounds of 'char[16]' [-Warray-bounds] > comm[TASK_COMM_LEN] = '\0'; \ > ~~~~^~~~~~~~~~~~~~~ > include/linux/coredump.h:63:43: note: in expansion of macro '__COREDUMP_PRINTK' > #define coredump_report_failure(fmt, ...) __COREDUMP_PRINTK(KERN_WARNING, fmt, ##__VA_ARGS__) > ^~~~~~~~~~~~~~~~~ > fs/coredump.c:611:4: note: in expansion of macro 'coredump_report_failure' > coredump_report_failure("RLIMIT_CORE is set to 1, aborting core"); > ^~~~~~~~~~~~~~~~~~~~~~~ >>> include/linux/coredump.h:57:7: warning: array subscript 16 is above array bounds of 'char[16]' [-Warray-bounds] > comm[TASK_COMM_LEN] = '\0'; \ > ~~~~^~~~~~~~~~~~~~~ > include/linux/coredump.h:63:43: note: in expansion of macro '__COREDUMP_PRINTK' > #define coredump_report_failure(fmt, ...) __COREDUMP_PRINTK(KERN_WARNING, fmt, ##__VA_ARGS__) > ^~~~~~~~~~~~~~~~~ > fs/coredump.c:591:4: note: in expansion of macro 'coredump_report_failure' > coredump_report_failure("format_corename failed, aborting core"); > ^~~~~~~~~~~~~~~~~~~~~~~ >>> include/linux/coredump.h:57:7: warning: array subscript 16 is above array bounds of 'char[16]' [-Warray-bounds] > comm[TASK_COMM_LEN] = '\0'; \ > ~~~~^~~~~~~~~~~~~~~ > include/linux/coredump.h:63:43: note: in expansion of macro '__COREDUMP_PRINTK' > #define coredump_report_failure(fmt, ...) __COREDUMP_PRINTK(KERN_WARNING, fmt, ##__VA_ARGS__) > ^~~~~~~~~~~~~~~~~ > fs/coredump.c:752:4: note: in expansion of macro 'coredump_report_failure' > coredump_report_failure("Core dump to |%s disabled", cn.corename); > ^~~~~~~~~~~~~~~~~~~~~~~ > fs/coredump.c: In function 'validate_coredump_safety': >>> include/linux/coredump.h:57:7: warning: array subscript 16 is above array bounds of 'char[16]' [-Warray-bounds] > comm[TASK_COMM_LEN] = '\0'; \ > ~~~~^~~~~~~~~~~~~~~ > include/linux/coredump.h:63:43: note: in expansion of macro '__COREDUMP_PRINTK' > #define coredump_report_failure(fmt, ...) __COREDUMP_PRINTK(KERN_WARNING, fmt, ##__VA_ARGS__) > ^~~~~~~~~~~~~~~~~ > fs/coredump.c:1006:3: note: in expansion of macro 'coredump_report_failure' > coredump_report_failure("Unsafe core_pattern used with fs.suid_dumpable=2: " > ^~~~~~~~~~~~~~~~~~~~~~~ > > > vim +57 include/linux/coredump.h > > 46 > 47 /* > 48 * Logging for the coredump code, ratelimited. > 49 * The TGID and comm fields are added to the message. > 50 */ > 51 > 52 #define __COREDUMP_PRINTK(Level, Format, ...) \ > 53 do { \ > 54 char comm[TASK_COMM_LEN]; \ > 55 /* This will always be NUL terminated. */ \ > 56 memcpy(comm, current->comm, TASK_COMM_LEN); \ > > 57 comm[TASK_COMM_LEN] = '\0'; \ > 58 printk_ratelimited(Level "coredump: %d(%*pE): " Format "\n", \ > 59 task_tgid_vnr(current), (int)strlen(comm), comm, ##__VA_ARGS__); \ > 60 } while (0) \ > 61 > Thanks, I will fix these in v5. Regards, Bhupesh