All of lore.kernel.org
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Paul Wise <pabs3@bonedaddy.net>
Cc: kbuild-all@01.org, Neil Horman <nhorman@tuxdriver.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Paul Wise <pabs3@bonedaddy.net>, Jakub Wilk <jwilk@jwilk.net>
Subject: Re: [PATCH] coredump: Split pipe command whitespace before expanding template
Date: Mon, 20 May 2019 23:14:22 +0800	[thread overview]
Message-ID: <201905202342.COVmaSLI%lkp@intel.com> (raw)
In-Reply-To: <20190520090115.11276-1-pabs3@bonedaddy.net>

[-- Attachment #1: Type: text/plain, Size: 5885 bytes --]

Hi Paul,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.2-rc1 next-20190520]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Paul-Wise/coredump-Split-pipe-command-whitespace-before-expanding-template/20190520-212130
config: riscv-defconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 8.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=8.1.0 make.cross ARCH=riscv 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   fs/coredump.c: In function 'format_corename':
>> fs/coredump.c:210:4: error: invalid type argument of unary '*' (have 'int')
      (*argvs) = kmalloc_array(argvs, sizeof(**argv), GFP_KERNEL);
       ^~~~~~

vim +210 fs/coredump.c

   186	
   187	/* format_corename will inspect the pattern parameter, and output a
   188	 * name into corename, which must have space for at least
   189	 * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator.
   190	 */
   191	static int format_corename(struct core_name *cn, struct coredump_params *cprm,
   192				   size_t **argv, int *argc)
   193	{
   194		const struct cred *cred = current_cred();
   195		const char *pat_ptr = core_pattern;
   196		int ispipe = (*pat_ptr == '|');
   197		bool was_space = false;
   198		int pid_in_pattern = 0;
   199		int err = 0;
   200	
   201		cn->used = 0;
   202		cn->corename = NULL;
   203		if (expand_corename(cn, core_name_size))
   204			return -ENOMEM;
   205		cn->corename[0] = '\0';
   206	
   207		if (ispipe) {
   208			/* sizeof(core_pattern) / 2 is the maximum number of args. */
   209			int argvs = sizeof(core_pattern) / 2;
 > 210			(*argvs) = kmalloc_array(argvs, sizeof(**argv), GFP_KERNEL);
   211			if (!(*argv))
   212				return -ENOMEM;
   213			(*argv)[(*argc)++] = 0;
   214			++pat_ptr;
   215		}
   216	
   217		/* Repeat as long as we have more pattern to process and more output
   218		   space */
   219		while (*pat_ptr) {
   220			/*
   221			 * Split on spaces before doing template expansion so that
   222			 * %e and %E don't get split if they have spaces in them
   223			 */
   224			if (ispipe) {
   225				if (isspace(*pat_ptr)) {
   226					was_space = true;
   227					pat_ptr++;
   228					continue;
   229				} else if (was_space) {
   230					was_space = false;
   231					err = cn_printf(cn, "%c", '\0');
   232					if (err)
   233						return err;
   234					(*argv)[(*argc)++] = cn->used;
   235				}
   236			}
   237			if (*pat_ptr != '%') {
   238				err = cn_printf(cn, "%c", *pat_ptr++);
   239			} else {
   240				switch (*++pat_ptr) {
   241				/* single % at the end, drop that */
   242				case 0:
   243					goto out;
   244				/* Double percent, output one percent */
   245				case '%':
   246					err = cn_printf(cn, "%c", '%');
   247					break;
   248				/* pid */
   249				case 'p':
   250					pid_in_pattern = 1;
   251					err = cn_printf(cn, "%d",
   252						      task_tgid_vnr(current));
   253					break;
   254				/* global pid */
   255				case 'P':
   256					err = cn_printf(cn, "%d",
   257						      task_tgid_nr(current));
   258					break;
   259				case 'i':
   260					err = cn_printf(cn, "%d",
   261						      task_pid_vnr(current));
   262					break;
   263				case 'I':
   264					err = cn_printf(cn, "%d",
   265						      task_pid_nr(current));
   266					break;
   267				/* uid */
   268				case 'u':
   269					err = cn_printf(cn, "%u",
   270							from_kuid(&init_user_ns,
   271								  cred->uid));
   272					break;
   273				/* gid */
   274				case 'g':
   275					err = cn_printf(cn, "%u",
   276							from_kgid(&init_user_ns,
   277								  cred->gid));
   278					break;
   279				case 'd':
   280					err = cn_printf(cn, "%d",
   281						__get_dumpable(cprm->mm_flags));
   282					break;
   283				/* signal that caused the coredump */
   284				case 's':
   285					err = cn_printf(cn, "%d",
   286							cprm->siginfo->si_signo);
   287					break;
   288				/* UNIX time of coredump */
   289				case 't': {
   290					time64_t time;
   291	
   292					time = ktime_get_real_seconds();
   293					err = cn_printf(cn, "%lld", time);
   294					break;
   295				}
   296				/* hostname */
   297				case 'h':
   298					down_read(&uts_sem);
   299					err = cn_esc_printf(cn, "%s",
   300						      utsname()->nodename);
   301					up_read(&uts_sem);
   302					break;
   303				/* executable */
   304				case 'e':
   305					err = cn_esc_printf(cn, "%s", current->comm);
   306					break;
   307				case 'E':
   308					err = cn_print_exe_file(cn);
   309					break;
   310				/* core limit size */
   311				case 'c':
   312					err = cn_printf(cn, "%lu",
   313						      rlimit(RLIMIT_CORE));
   314					break;
   315				default:
   316					break;
   317				}
   318				++pat_ptr;
   319			}
   320	
   321			if (err)
   322				return err;
   323		}
   324	
   325	out:
   326		/* Backward compatibility with core_uses_pid:
   327		 *
   328		 * If core_pattern does not include a %p (as is the default)
   329		 * and core_uses_pid is set, then .%pid will be appended to
   330		 * the filename. Do not do this for piped commands. */
   331		if (!ispipe && !pid_in_pattern && core_uses_pid) {
   332			err = cn_printf(cn, ".%d", task_tgid_vnr(current));
   333			if (err)
   334				return err;
   335		}
   336		return ispipe;
   337	}
   338	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 17610 bytes --]

  reply	other threads:[~2019-05-20 15:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19  6:06 PROBLEM: Linux kernel.core_pattern with pipes does argument splitting after template expansion Paul Wise
2019-05-20  9:01 ` [PATCH] coredump: Split pipe command whitespace before expanding template Paul Wise
2019-05-20 15:14   ` kbuild test robot [this message]
2019-05-21  0:37     ` Paul Wise
2019-05-28  5:11       ` [PATCH v3] " Paul Wise
2019-06-06 13:44         ` Neil Horman

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=201905202342.COVmaSLI%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=jwilk@jwilk.net \
    --cc=kbuild-all@01.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=pabs3@bonedaddy.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.