Re: [PATCH] ALSA: firewire-motu: fix invalid memory access when operating hwdep character device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Takashi,

I love your patch! Yet something to improve:

[auto build test ERROR on tiwai-sound/for-next]
[also build test ERROR on next-20211025]
[cannot apply to v5.15-rc6]
[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]

url:    https://github.com/0day-ci/linux/commits/Takashi-Sakamoto/ALSA-firewire-motu-fix-invalid-memory-access-when-operating-hwdep-character-device/20211020-122834
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
config: arc-randconfig-r043-20211020 (attached as .config)
compiler: arc-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/0105a381c2c6677118fca8f30b96778d590e2173
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Takashi-Sakamoto/ALSA-firewire-motu-fix-invalid-memory-access-when-operating-hwdep-character-device/20211020-122834
        git checkout 0105a381c2c6677118fca8f30b96778d590e2173
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash sound/firewire/motu/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

   In file included from include/asm-generic/current.h:5,
                    from arch/arc/include/asm/current.h:20,
                    from include/linux/sched.h:12,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from sound/firewire/motu/motu.h:11,
                    from sound/firewire/motu/motu-hwdep.c:17:
   In function 'check_copy_size',
       inlined from 'copy_to_user' at include/linux/uaccess.h:199:6,
       inlined from 'copy_dsp_event_to_user' at sound/firewire/motu/motu-hwdep.c:49:7,
       inlined from 'hwdep_read' at sound/firewire/motu/motu-hwdep.c:101:11:
>> include/linux/thread_info.h:211:25: error: call to '__bad_copy_from' declared with attribute error: copy source size is too small
     211 |                         __bad_copy_from();
         |                         ^~~~~~~~~~~~~~~~~


vim +/__bad_copy_from +211 include/linux/thread_info.h

b0377fedb65280 Al Viro   2017-06-29  202  
9dd819a15162f8 Kees Cook 2019-09-25  203  static __always_inline __must_check bool
b0377fedb65280 Al Viro   2017-06-29  204  check_copy_size(const void *addr, size_t bytes, bool is_source)
b0377fedb65280 Al Viro   2017-06-29  205  {
b0377fedb65280 Al Viro   2017-06-29  206  	int sz = __compiletime_object_size(addr);
b0377fedb65280 Al Viro   2017-06-29  207  	if (unlikely(sz >= 0 && sz < bytes)) {
b0377fedb65280 Al Viro   2017-06-29  208  		if (!__builtin_constant_p(bytes))
b0377fedb65280 Al Viro   2017-06-29  209  			copy_overflow(sz, bytes);
b0377fedb65280 Al Viro   2017-06-29  210  		else if (is_source)
b0377fedb65280 Al Viro   2017-06-29 @211  			__bad_copy_from();
b0377fedb65280 Al Viro   2017-06-29  212  		else
b0377fedb65280 Al Viro   2017-06-29  213  			__bad_copy_to();
b0377fedb65280 Al Viro   2017-06-29  214  		return false;
b0377fedb65280 Al Viro   2017-06-29  215  	}
6d13de1489b6bf Kees Cook 2019-12-04  216  	if (WARN_ON_ONCE(bytes > INT_MAX))
6d13de1489b6bf Kees Cook 2019-12-04  217  		return false;
b0377fedb65280 Al Viro   2017-06-29  218  	check_object_size(addr, bytes, is_source);
b0377fedb65280 Al Viro   2017-06-29  219  	return true;
b0377fedb65280 Al Viro   2017-06-29  220  }
b0377fedb65280 Al Viro   2017-06-29  221  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux