From: kbuild test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH RFC v4 31/42] kmsan: hooks for copy_to_user() and friends
Date: Tue, 24 Dec 2019 12:50:58 +0800 [thread overview]
Message-ID: <201912241209.EnGLw5ed%lkp@intel.com> (raw)
In-Reply-To: <20191220184955.223741-32-glider@google.com>
[-- Attachment #1: Type: text/plain, Size: 13818 bytes --]
Hi,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on linus/master]
[also build test WARNING on v5.5-rc3]
[cannot apply to tip/x86/core tip/x86/mm efi/next next-20191220]
[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/glider-google-com/Add-KernelMemorySanitizer-infrastructure/20191224-024330
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 46cf053efec6a3a5f343fead837777efe8252a46
config: xtensa-common_defconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 7.5.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=7.5.0 make.cross ARCH=xtensa
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
drivers/char/hw_random/core.c: In function 'rng_dev_read':
>> drivers/char/hw_random/core.c:251:7: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(buf + ret, rng_buffer + data_avail,
^
--
In file included from include/linux/crypto.h:21:0,
from include/crypto/hash.h:11,
from include/linux/uio.h:10,
from include/linux/socket.h:8,
from include/linux/compat.h:15,
from include/linux/ethtool.h:17,
from net//core/ethtool.c:14:
include/linux/uaccess.h: In function '_copy_to_user':
include/linux/uaccess.h:155:9: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
return res;
^~~
net//core/ethtool.c: In function 'ethtool_get_per_queue_coalesce':
>> net//core/ethtool.c:2362:6: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr, &coalesce, sizeof(coalesce)))
^
net//core/ethtool.c: In function 'ethtool_get_value':
net//core/ethtool.c:2015:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr, &edata, sizeof(edata)))
^
net//core/ethtool.c: In function 'ethtool_get_channels':
net//core/ethtool.c:1675:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr, &channels, sizeof(channels)))
^
net//core/ethtool.c: In function 'ethtool_get_coalesce':
net//core/ethtool.c:1610:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr, &coalesce, sizeof(coalesce)))
^
net//core/ethtool.c: In function 'store_link_ksettings_for_user.constprop':
net//core/ethtool.c:603:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(to, &link_usettings, sizeof(link_usettings)))
^
net//core/ethtool.c: In function 'ethtool_get_drvinfo':
net//core/ethtool.c:810:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr, &info, sizeof(info)))
^
net//core/ethtool.c: In function 'ethtool_get_settings':
net//core/ethtool.c:727:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr, &cmd, sizeof(cmd)))
^
net//core/ethtool.c: In function 'ethtool_get_any_eeprom':
net//core/ethtool.c:1533:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr, &eeprom, sizeof(eeprom)))
^
net//core/ethtool.c:1522:6: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(userbuf, data, eeprom.len)) {
^
net//core/ethtool.c: In function 'ethtool_set_rxnfc':
net//core/ethtool.c:896:33: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (cmd == ETHTOOL_SRXCLSRLINS &&
~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
copy_to_user(useraddr, &info, info_size))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net//core/ethtool.c: In function 'ethtool_get_rxfh':
net//core/ethtool.c:1211:12: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
} else if (copy_to_user(useraddr +
^
net//core/ethtool.c:1208:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr + offsetof(struct ethtool_rxfh, hfunc),
^
net//core/ethtool.c:1180:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr, &rxfh, sizeof(rxfh)))
^
net//core/ethtool.c: In function 'ethtool_get_rxfh_indir':
net//core/ethtool.c:1071:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr +
^
net//core/ethtool.c:1052:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr + offsetof(struct ethtool_rxfh_indir, size),
^
net//core/ethtool.c: In function 'ethtool_set_rxfh':
net//core/ethtool.c:1318:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr + offsetof(struct ethtool_rxfh, rss_context),
^
net//core/ethtool.c: In function 'ethtool_get_sset_info':
net//core/ethtool.c:861:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr, info_buf, idx * sizeof(u32)))
^
net//core/ethtool.c:857:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr, &info, sizeof(info)))
^
net//core/ethtool.c: In function 'ethtool_get_rxnfc':
net//core/ethtool.c:963:6: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr, rule_buf,
^
net//core/ethtool.c:958:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr, &info, info_size))
^
net//core/ethtool.c: In function 'dev_ethtool':
net//core/ethtool.c:168:5: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr, &cmd, sizeof(cmd)))
^
In file included from include/linux/crypto.h:21:0,
from include/crypto/hash.h:11,
from include/linux/uio.h:10,
from include/linux/socket.h:8,
from include/linux/compat.h:15,
from include/linux/ethtool.h:17,
from net//core/ethtool.c:14:
include/linux/uaccess.h:147:16: note: 'res' was declared here
unsigned long res;
^~~
net//core/ethtool.c:639:6: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (copy_to_user(useraddr, &link_ksettings.base,
^
In file included from include/linux/crypto.h:21:0,
from include/crypto/hash.h:11,
from include/linux/uio.h:10,
from include/linux/socket.h:8,
from include/linux/compat.h:15,
from include/linux/ethtool.h:17,
from net//core/ethtool.c:14:
include/linux/uaccess.h:147:16: note: 'res' was declared here
unsigned long res;
vim +/res +251 drivers/char/hw_random/core.c
9996508b335306 Ian Molton 2009-12-01 204
844dd05fec172d Michael Buesch 2006-06-26 205 static ssize_t rng_dev_read(struct file *filp, char __user *buf,
844dd05fec172d Michael Buesch 2006-06-26 206 size_t size, loff_t *offp)
844dd05fec172d Michael Buesch 2006-06-26 207 {
844dd05fec172d Michael Buesch 2006-06-26 208 ssize_t ret = 0;
984e976f5382ff Patrick McHardy 2007-11-21 209 int err = 0;
9996508b335306 Ian Molton 2009-12-01 210 int bytes_read, len;
3a2c0ba5ad00c0 Rusty Russell 2014-12-08 211 struct hwrng *rng;
844dd05fec172d Michael Buesch 2006-06-26 212
844dd05fec172d Michael Buesch 2006-06-26 213 while (size) {
3a2c0ba5ad00c0 Rusty Russell 2014-12-08 214 rng = get_current_rng();
3a2c0ba5ad00c0 Rusty Russell 2014-12-08 215 if (IS_ERR(rng)) {
3a2c0ba5ad00c0 Rusty Russell 2014-12-08 216 err = PTR_ERR(rng);
844dd05fec172d Michael Buesch 2006-06-26 217 goto out;
9996508b335306 Ian Molton 2009-12-01 218 }
3a2c0ba5ad00c0 Rusty Russell 2014-12-08 219 if (!rng) {
844dd05fec172d Michael Buesch 2006-06-26 220 err = -ENODEV;
3a2c0ba5ad00c0 Rusty Russell 2014-12-08 221 goto out;
844dd05fec172d Michael Buesch 2006-06-26 222 }
984e976f5382ff Patrick McHardy 2007-11-21 223
1ab87298cb59b6 Jiri Slaby 2015-11-27 224 if (mutex_lock_interruptible(&reading_mutex)) {
1ab87298cb59b6 Jiri Slaby 2015-11-27 225 err = -ERESTARTSYS;
1ab87298cb59b6 Jiri Slaby 2015-11-27 226 goto out_put;
1ab87298cb59b6 Jiri Slaby 2015-11-27 227 }
9996508b335306 Ian Molton 2009-12-01 228 if (!data_avail) {
3a2c0ba5ad00c0 Rusty Russell 2014-12-08 229 bytes_read = rng_get_data(rng, rng_buffer,
f7f154f1246ccc Rusty Russell 2013-03-05 230 rng_buffer_size(),
9996508b335306 Ian Molton 2009-12-01 231 !(filp->f_flags & O_NONBLOCK));
893f1128664478 Ralph Wuerthner 2008-04-17 232 if (bytes_read < 0) {
893f1128664478 Ralph Wuerthner 2008-04-17 233 err = bytes_read;
9372b35e11149c Rusty Russell 2014-12-08 234 goto out_unlock_reading;
9996508b335306 Ian Molton 2009-12-01 235 }
9996508b335306 Ian Molton 2009-12-01 236 data_avail = bytes_read;
893f1128664478 Ralph Wuerthner 2008-04-17 237 }
844dd05fec172d Michael Buesch 2006-06-26 238
9996508b335306 Ian Molton 2009-12-01 239 if (!data_avail) {
9996508b335306 Ian Molton 2009-12-01 240 if (filp->f_flags & O_NONBLOCK) {
9996508b335306 Ian Molton 2009-12-01 241 err = -EAGAIN;
9372b35e11149c Rusty Russell 2014-12-08 242 goto out_unlock_reading;
9996508b335306 Ian Molton 2009-12-01 243 }
9996508b335306 Ian Molton 2009-12-01 244 } else {
9996508b335306 Ian Molton 2009-12-01 245 len = data_avail;
9996508b335306 Ian Molton 2009-12-01 246 if (len > size)
9996508b335306 Ian Molton 2009-12-01 247 len = size;
9996508b335306 Ian Molton 2009-12-01 248
9996508b335306 Ian Molton 2009-12-01 249 data_avail -= len;
9996508b335306 Ian Molton 2009-12-01 250
9996508b335306 Ian Molton 2009-12-01 @251 if (copy_to_user(buf + ret, rng_buffer + data_avail,
9996508b335306 Ian Molton 2009-12-01 252 len)) {
844dd05fec172d Michael Buesch 2006-06-26 253 err = -EFAULT;
9372b35e11149c Rusty Russell 2014-12-08 254 goto out_unlock_reading;
9996508b335306 Ian Molton 2009-12-01 255 }
9996508b335306 Ian Molton 2009-12-01 256
9996508b335306 Ian Molton 2009-12-01 257 size -= len;
9996508b335306 Ian Molton 2009-12-01 258 ret += len;
844dd05fec172d Michael Buesch 2006-06-26 259 }
844dd05fec172d Michael Buesch 2006-06-26 260
9372b35e11149c Rusty Russell 2014-12-08 261 mutex_unlock(&reading_mutex);
3a2c0ba5ad00c0 Rusty Russell 2014-12-08 262 put_rng(rng);
9996508b335306 Ian Molton 2009-12-01 263
844dd05fec172d Michael Buesch 2006-06-26 264 if (need_resched())
844dd05fec172d Michael Buesch 2006-06-26 265 schedule_timeout_interruptible(1);
9996508b335306 Ian Molton 2009-12-01 266
9996508b335306 Ian Molton 2009-12-01 267 if (signal_pending(current)) {
844dd05fec172d Michael Buesch 2006-06-26 268 err = -ERESTARTSYS;
844dd05fec172d Michael Buesch 2006-06-26 269 goto out;
844dd05fec172d Michael Buesch 2006-06-26 270 }
9996508b335306 Ian Molton 2009-12-01 271 }
844dd05fec172d Michael Buesch 2006-06-26 272 out:
844dd05fec172d Michael Buesch 2006-06-26 273 return ret ? : err;
3a2c0ba5ad00c0 Rusty Russell 2014-12-08 274
9372b35e11149c Rusty Russell 2014-12-08 275 out_unlock_reading:
9372b35e11149c Rusty Russell 2014-12-08 276 mutex_unlock(&reading_mutex);
1ab87298cb59b6 Jiri Slaby 2015-11-27 277 out_put:
3a2c0ba5ad00c0 Rusty Russell 2014-12-08 278 put_rng(rng);
3a2c0ba5ad00c0 Rusty Russell 2014-12-08 279 goto out;
844dd05fec172d Michael Buesch 2006-06-26 280 }
844dd05fec172d Michael Buesch 2006-06-26 281
:::::: The code at line 251 was first introduced by commit
:::::: 9996508b3353063f2d6c48c1a28a84543d72d70b hwrng: core - Replace u32 in driver API with byte array
:::::: TO: Ian Molton <ian.molton@collabora.co.uk>
:::::: CC: Herbert Xu <herbert@gondor.apana.org.au>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 10549 bytes --]
next prev parent reply other threads:[~2019-12-24 4:50 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-20 18:49 [PATCH RFC v4 00/42] Add KernelMemorySanitizer infrastructure glider
2019-12-20 18:49 ` [PATCH RFC v4 01/42] stackdepot: check depot_index before accessing the stack slab glider
2019-12-20 18:49 ` [PATCH RFC v4 02/42] stackdepot: build with -fno-builtin glider
2020-01-03 17:37 ` Steven Rostedt
2019-12-20 18:49 ` [PATCH RFC v4 03/42] kasan: stackdepot: move filter_irq_stacks() to stackdepot.c glider
2019-12-20 18:49 ` [PATCH RFC v4 04/42] stackdepot: reserve 5 extra bits in depot_stack_handle_t glider
2019-12-20 18:49 ` [PATCH RFC v4 05/42] kmsan: add ReST documentation glider
2019-12-20 18:49 ` [PATCH RFC v4 06/42] kmsan: gfp: introduce __GFP_NO_KMSAN_SHADOW glider
2019-12-20 18:49 ` [PATCH RFC v4 07/42] kmsan: introduce __no_sanitize_memory and __SANITIZE_MEMORY__ glider
2019-12-20 18:49 ` [PATCH RFC v4 08/42] kmsan: reduce vmalloc space glider
2019-12-20 18:49 ` [PATCH RFC v4 09/42] kmsan: add KMSAN runtime core glider
2019-12-20 18:49 ` [PATCH RFC v4 10/42] kmsan: KMSAN compiler API implementation glider
2019-12-20 18:49 ` [PATCH RFC v4 11/42] kmsan: add KMSAN hooks for kernel subsystems glider
2019-12-20 18:49 ` [PATCH RFC v4 12/42] kmsan: stackdepot: don't allocate KMSAN metadata for stackdepot glider
2019-12-20 18:49 ` [PATCH RFC v4 13/42] kmsan: define READ_ONCE_NOCHECK() glider
2019-12-20 18:49 ` [PATCH RFC v4 14/42] kmsan: make READ_ONCE_TASK_STACK() return initialized values glider
2019-12-20 18:49 ` [PATCH RFC v4 15/42] kmsan: x86: sync metadata pages on page fault glider
2019-12-20 18:49 ` [PATCH RFC v4 16/42] kmsan: add tests for KMSAN glider
2019-12-20 18:49 ` [PATCH RFC v4 17/42] crypto: kmsan: disable accelerated configs under KMSAN glider
2019-12-20 19:44 ` Eric Biggers
2020-01-09 14:56 ` Alexander Potapenko
2019-12-20 18:49 ` [PATCH RFC v4 18/42] kmsan: x86: disable UNWINDER_ORC " glider
2019-12-20 18:49 ` [PATCH RFC v4 19/42] kmsan: x86/asm: softirq: add KMSAN IRQ entry hooks glider
2019-12-23 19:58 ` kbuild test robot
2019-12-24 14:38 ` kbuild test robot
2019-12-20 18:49 ` [PATCH RFC v4 20/42] kmsan: x86: increase stack sizes in KMSAN builds glider
2019-12-30 17:39 ` Arnd Bergmann
2020-01-08 15:31 ` Alexander Potapenko
2019-12-20 18:49 ` [PATCH RFC v4 21/42] kmsan: disable KMSAN instrumentation for certain kernel parts glider
2019-12-20 18:49 ` [PATCH RFC v4 22/42] kmsan: mm: call KMSAN hooks from SLUB code glider
2019-12-20 18:49 ` [PATCH RFC v4 23/42] kmsan: mm: maintain KMSAN metadata for page operations glider
2019-12-20 18:49 ` [PATCH RFC v4 24/42] kmsan: handle memory sent to/from USB glider
2019-12-20 18:49 ` [PATCH RFC v4 25/42] kmsan: handle task creation and exiting glider
2019-12-20 18:49 ` [PATCH RFC v4 26/42] kmsan: net: check the value of skb before sending it to the network glider
2019-12-20 18:49 ` [PATCH RFC v4 27/42] kmsan: printk: treat the result of vscnprintf() as initialized glider
2019-12-20 18:49 ` [PATCH RFC v4 28/42] kmsan: disable instrumentation of certain functions glider
2019-12-20 18:49 ` [PATCH RFC v4 29/42] kmsan: unpoison |tlb| in arch_tlb_gather_mmu() glider
2019-12-20 18:49 ` [PATCH RFC v4 30/42] kmsan: use __msan_ string functions where possible glider
2019-12-20 18:49 ` [PATCH RFC v4 31/42] kmsan: hooks for copy_to_user() and friends glider
2019-12-24 4:50 ` kbuild test robot
2019-12-24 4:50 ` kbuild test robot [this message]
2019-12-20 18:49 ` [PATCH RFC v4 32/42] kmsan: init: call KMSAN initialization routines glider
2019-12-20 18:49 ` [PATCH RFC v4 33/42] kmsan: enable KMSAN builds glider
2019-12-20 18:49 ` [PATCH RFC v4 34/42] kmsan: handle /dev/[u]random glider
2019-12-20 18:49 ` [PATCH RFC v4 35/42] kmsan: virtio: check/unpoison scatterlist in vring_map_one_sg() glider
2019-12-20 18:49 ` [PATCH RFC v4 36/42] kmsan: disable strscpy() optimization under KMSAN glider
2019-12-20 18:49 ` [PATCH RFC v4 37/42] kmsan: add iomap support glider
2019-12-20 18:49 ` [PATCH RFC v4 38/42] kmsan: dma: unpoison memory mapped by dma_direct_map_page() glider
2019-12-20 18:49 ` [PATCH RFC v4 39/42] kmsan: disable physical page merging in biovec glider
2019-12-20 18:49 ` [PATCH RFC v4 40/42] kmsan: ext4: skip block merging logic in ext4_mpage_readpages for KMSAN glider
2019-12-20 19:18 ` Eric Biggers
2020-01-08 16:14 ` Alexander Potapenko
2019-12-20 18:49 ` [PATCH RFC v4 41/42] x86: kasan: kmsan: support CONFIG_GENERIC_CSUM on x86, enable it for KASAN/KMSAN glider
2019-12-20 18:49 ` [PATCH RFC v4 42/42] kmsan: x86/uprobes: unpoison regs in arch_uprobe_exception_notify() glider
2019-12-23 7:51 ` [PATCH RFC v4 00/42] Add KernelMemorySanitizer infrastructure Leon Romanovsky
2020-01-09 14:38 ` Alexander Potapenko
2020-01-09 16:29 ` Thomas Gleixner
2020-03-25 11:04 ` Alexander Potapenko
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=201912241209.EnGLw5ed%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.