Linux-mm Archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Allen Pais <apais@linux.microsoft.com>, linux-fsdevel@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz,
	ebiederm@xmission.com, keescook@chromium.org, mcgrof@kernel.org,
	j.granados@samsung.com, allen.lkml@gmail.com
Subject: Re: [PATCH v3] fs/coredump: Enable dynamic configuration of max file note size
Date: Sat, 4 May 2024 09:30:58 +0800	[thread overview]
Message-ID: <202405040817.bJeHlwXS-lkp@intel.com> (raw)
In-Reply-To: <20240502235603.19290-1-apais@linux.microsoft.com>

Hi Allen,

kernel test robot noticed the following build errors:

[auto build test ERROR on kees/for-next/execve]
[also build test ERROR on brauner-vfs/vfs.all linus/master v6.9-rc6 next-20240503]
[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/Allen-Pais/fs-coredump-Enable-dynamic-configuration-of-max-file-note-size/20240503-075758
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/execve
patch link:    https://lore.kernel.org/r/20240502235603.19290-1-apais%40linux.microsoft.com
patch subject: [PATCH v3] fs/coredump: Enable dynamic configuration of max file note size
config: powerpc64-randconfig-001-20240504 (https://download.01.org/0day-ci/archive/20240504/202405040817.bJeHlwXS-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 37ae4ad0eef338776c7e2cffb3896153d43dcd90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240504/202405040817.bJeHlwXS-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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405040817.bJeHlwXS-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from fs/compat_binfmt_elf.c:17:
   In file included from include/linux/elfcore-compat.h:6:
   In file included from include/linux/elfcore.h:11:
   In file included from include/linux/ptrace.h:10:
   In file included from include/linux/pid_namespace.h:7:
   In file included from include/linux/mm.h:2208:
   include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     522 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   In file included from fs/compat_binfmt_elf.c:144:
>> fs/binfmt_elf.c:1598:14: error: use of undeclared identifier 'core_file_note_size_max'
    1598 |         if (size >= core_file_note_size_max) {
         |                     ^
   1 warning and 1 error generated.


vim +/core_file_note_size_max +1598 fs/binfmt_elf.c

  1569	
  1570	/*
  1571	 * Format of NT_FILE note:
  1572	 *
  1573	 * long count     -- how many files are mapped
  1574	 * long page_size -- units for file_ofs
  1575	 * array of [COUNT] elements of
  1576	 *   long start
  1577	 *   long end
  1578	 *   long file_ofs
  1579	 * followed by COUNT filenames in ASCII: "FILE1" NUL "FILE2" NUL...
  1580	 */
  1581	static int fill_files_note(struct memelfnote *note, struct coredump_params *cprm)
  1582	{
  1583		unsigned count, size, names_ofs, remaining, n;
  1584		user_long_t *data;
  1585		user_long_t *start_end_ofs;
  1586		char *name_base, *name_curpos;
  1587		int i;
  1588	
  1589		/* *Estimated* file count and total data size needed */
  1590		count = cprm->vma_count;
  1591		if (count > UINT_MAX / 64)
  1592			return -EINVAL;
  1593		size = count * 64;
  1594	
  1595		names_ofs = (2 + 3 * count) * sizeof(data[0]);
  1596	 alloc:
  1597		/* paranoia check */
> 1598		if (size >= core_file_note_size_max) {
  1599			pr_warn_once("coredump Note size too large: %u "
  1600			"(does kernel.core_file_note_size_max sysctl need adjustment?)\n",
  1601			size);
  1602			return -EINVAL;
  1603		}
  1604		size = round_up(size, PAGE_SIZE);
  1605		/*
  1606		 * "size" can be 0 here legitimately.
  1607		 * Let it ENOMEM and omit NT_FILE section which will be empty anyway.
  1608		 */
  1609		data = kvmalloc(size, GFP_KERNEL);
  1610		if (ZERO_OR_NULL_PTR(data))
  1611			return -ENOMEM;
  1612	
  1613		start_end_ofs = data + 2;
  1614		name_base = name_curpos = ((char *)data) + names_ofs;
  1615		remaining = size - names_ofs;
  1616		count = 0;
  1617		for (i = 0; i < cprm->vma_count; i++) {
  1618			struct core_vma_metadata *m = &cprm->vma_meta[i];
  1619			struct file *file;
  1620			const char *filename;
  1621	
  1622			file = m->file;
  1623			if (!file)
  1624				continue;
  1625			filename = file_path(file, name_curpos, remaining);
  1626			if (IS_ERR(filename)) {
  1627				if (PTR_ERR(filename) == -ENAMETOOLONG) {
  1628					kvfree(data);
  1629					size = size * 5 / 4;
  1630					goto alloc;
  1631				}
  1632				continue;
  1633			}
  1634	
  1635			/* file_path() fills at the end, move name down */
  1636			/* n = strlen(filename) + 1: */
  1637			n = (name_curpos + remaining) - filename;
  1638			remaining = filename - name_curpos;
  1639			memmove(name_curpos, filename, n);
  1640			name_curpos += n;
  1641	
  1642			*start_end_ofs++ = m->start;
  1643			*start_end_ofs++ = m->end;
  1644			*start_end_ofs++ = m->pgoff;
  1645			count++;
  1646		}
  1647	
  1648		/* Now we know exact count of files, can store it */
  1649		data[0] = count;
  1650		data[1] = PAGE_SIZE;
  1651		/*
  1652		 * Count usually is less than mm->map_count,
  1653		 * we need to move filenames down.
  1654		 */
  1655		n = cprm->vma_count - count;
  1656		if (n != 0) {
  1657			unsigned shift_bytes = n * 3 * sizeof(data[0]);
  1658			memmove(name_base - shift_bytes, name_base,
  1659				name_curpos - name_base);
  1660			name_curpos -= shift_bytes;
  1661		}
  1662	
  1663		size = name_curpos - (char *)data;
  1664		fill_note(note, "CORE", NT_FILE, size, data);
  1665		return 0;
  1666	}
  1667	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


      parent reply	other threads:[~2024-05-04  1:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02 23:56 [PATCH v3] fs/coredump: Enable dynamic configuration of max file note size Allen Pais
     [not found] ` <202405021743.D06C96516@keescook>
2024-05-03  1:10   ` Allen
2024-05-03  1:40     ` Allen
2024-05-03 23:31       ` Kees Cook
2024-05-03 19:51 ` Luis Chamberlain
2024-05-03 23:43   ` Kees Cook
2024-05-04  1:30 ` kernel test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202405040817.bJeHlwXS-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=allen.lkml@gmail.com \
    --cc=apais@linux.microsoft.com \
    --cc=brauner@kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=j.granados@samsung.com \
    --cc=jack@suse.cz \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=llvm@lists.linux.dev \
    --cc=mcgrof@kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).