From: kbuild test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH 1/3] kernel/sysctl: support setting sysctl parameters from kernel command line
Date: Tue, 31 Mar 2020 04:15:44 +0800 [thread overview]
Message-ID: <202003310441.rvGTgRBw%lkp@intel.com> (raw)
In-Reply-To: <20200330115535.3215-2-vbabka@suse.cz>
[-- Attachment #1: Type: text/plain, Size: 5287 bytes --]
Hi Vlastimil,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on kees/for-next/pstore]
[also build test WARNING on linus/master linux/master v5.6 next-20200330]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Vlastimil-Babka/support-setting-sysctl-parameters-from-kernel-command-line/20200331-023453
base: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/pstore
config: um-i386_defconfig (attached as .config)
compiler: gcc-7 (Debian 7.4.0-6) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=um SUBARCH=i386
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from include/linux/printk.h:7:0,
from include/linux/kernel.h:15,
from include/linux/list.h:9,
from include/linux/sysctl.h:25,
from fs/proc/proc_sysctl.c:6:
fs/proc/proc_sysctl.c: In function 'process_sysctl_arg':
include/linux/kern_levels.h:5:18: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'ssize_t {aka int}' [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH'
#define KERN_ERR KERN_SOH "3" /* error conditions */
^~~~~~~~
include/linux/printk.h:304:9: note: in expansion of macro 'KERN_ERR'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~
>> fs/proc/proc_sysctl.c:1798:3: note: in expansion of macro 'pr_err'
pr_err("Wrote only %ld bytes of %d writing to proc file %s to set sysctl parameter '%s=%s'",
^~~~~~
fs/proc/proc_sysctl.c:1798:24: note: format string is defined here
pr_err("Wrote only %ld bytes of %d writing to proc file %s to set sysctl parameter '%s=%s'",
~~^
%d
vim +/pr_err +1798 fs/proc/proc_sysctl.c
1729
1730 /* Set sysctl value passed on kernel command line. */
1731 static int process_sysctl_arg(char *param, char *val,
1732 const char *unused, void *arg)
1733 {
1734 char *path;
1735 struct vfsmount *proc_mnt = *((struct vfsmount **)arg);
1736 struct file_system_type *proc_fs_type;
1737 struct file *file;
1738 int len;
1739 int err;
1740 loff_t pos = 0;
1741 ssize_t wret;
1742
1743 if (strncmp(param, "sysctl", sizeof("sysctl") - 1))
1744 return 0;
1745
1746 param += sizeof("sysctl") - 1;
1747
1748 if (param[0] != '/' && param[0] != '.')
1749 return 0;
1750
1751 param++;
1752
1753 if (!proc_mnt) {
1754 proc_fs_type = get_fs_type("proc");
1755 if (!proc_fs_type) {
1756 pr_err("Failed to find procfs to set sysctl from command line");
1757 return 0;
1758 }
1759 proc_mnt = kern_mount(proc_fs_type);
1760 put_filesystem(proc_fs_type);
1761 if (IS_ERR(proc_mnt)) {
1762 pr_err("Failed to mount procfs to set sysctl from command line");
1763 return 0;
1764 }
1765 *((struct vfsmount **)arg) = proc_mnt;
1766 }
1767
1768 path = kasprintf(GFP_KERNEL, "sys/%s", param);
1769 if (!path)
1770 panic("%s: Failed to allocate path for %s\n", __func__, param);
1771 strreplace(path, '.', '/');
1772
1773 file = file_open_root(proc_mnt->mnt_root, proc_mnt, path, O_WRONLY, 0);
1774 if (IS_ERR(file)) {
1775 err = PTR_ERR(file);
1776 if (err == -ENOENT)
1777 pr_err("Failed to set sysctl parameter '%s=%s': parameter not found",
1778 param, val);
1779 else if (err == -EACCES)
1780 pr_err("Failed to set sysctl parameter '%s=%s': permission denied (read-only?)",
1781 param, val);
1782 else
1783 pr_err("Error %pe opening proc file to set sysctl parameter '%s=%s'",
1784 file, param, val);
1785 goto out;
1786 }
1787 len = strlen(val);
1788 wret = kernel_write(file, val, len, &pos);
1789 if (wret < 0) {
1790 err = wret;
1791 if (err == -EINVAL)
1792 pr_err("Failed to set sysctl parameter '%s=%s': invalid value",
1793 param, val);
1794 else
1795 pr_err("Error %pe writing to proc file to set sysctl parameter '%s=%s'",
1796 ERR_PTR(err), param, val);
1797 } else if (wret != len) {
> 1798 pr_err("Wrote only %ld bytes of %d writing to proc file %s to set sysctl parameter '%s=%s'",
1799 wret, len, path, param, val);
1800 }
1801
1802 err = filp_close(file, NULL);
1803 if (err)
1804 pr_err("Error %pe closing proc file to set sysctl parameter '%s=%s'",
1805 ERR_PTR(err), param, val);
1806 out:
1807 kfree(path);
1808 return 0;
1809 }
1810
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 8680 bytes --]
next prev parent reply other threads:[~2020-03-30 20:15 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-30 11:55 [PATCH 0/3] support setting sysctl parameters from kernel command line Vlastimil Babka
2020-03-30 11:55 ` [PATCH 1/3] kernel/sysctl: " Vlastimil Babka
2020-03-30 16:23 ` Vlastimil Babka
2020-03-30 17:40 ` Kees Cook
2020-03-30 17:39 ` Kees Cook
2020-03-30 20:15 ` kbuild test robot [this message]
2020-03-31 18:29 ` Kees Cook
2020-03-30 22:44 ` Luis Chamberlain
2020-03-31 7:42 ` Vlastimil Babka
2020-03-31 7:48 ` Michal Hocko
2020-03-31 18:26 ` Kees Cook
2020-03-31 14:31 ` Luis Chamberlain
2020-04-01 11:01 ` Vlastimil Babka
2020-04-02 16:04 ` Luis Chamberlain
2020-04-02 17:23 ` Kees Cook
2020-04-02 20:59 ` Luis Chamberlain
2020-04-03 23:57 ` Kees Cook
2020-04-06 14:08 ` Luis Chamberlain
2020-04-06 15:58 ` Kees Cook
2020-04-06 17:08 ` Luis Chamberlain
2020-04-14 11:25 ` Vlastimil Babka
2020-04-15 3:23 ` Masami Hiramatsu
2020-04-15 6:08 ` Luis Chamberlain
2020-03-30 11:55 ` [PATCH 2/3] kernel/sysctl: support handling command line aliases Vlastimil Babka
2020-03-30 17:41 ` Kees Cook
2020-03-31 14:35 ` Luis Chamberlain
2020-03-30 11:55 ` [PATCH 3/3] kernel/hung_task convert hung_task_panic boot parameter to sysctl Vlastimil Babka
2020-03-30 17:43 ` Kees Cook
2020-03-31 0:34 ` John Hubbard
2020-03-31 7:27 ` Vlastimil Babka
2020-03-31 15:49 ` John Hubbard
2020-03-31 23:12 ` Tetsuo Handa
2020-04-01 8:47 ` Vlastimil Babka
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=202003310441.rvGTgRBw%lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/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.