lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202210070152.0mYQFaRo-lkp@intel.com>
Date:   Fri, 7 Oct 2022 01:21:48 +0800
From:   kernel test robot <lkp@...el.com>
To:     Hans Verkuil <hverkuil@...all.nl>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [hverkuil-media-tree:extron 4/5]
 arch/x86/include/asm/thread_info.h:175:13: error: calling
 '__builtin_frame_address' with a nonzero argument is unsafe

tree:   git://linuxtv.org/hverkuil/media_tree.git extron
head:   4ed18d5ad8d9686183afe89ee29be3ee399c379f
commit: 29bf6b404c12d2fff3d379859493afe6d6810f3b [4/5] cec/extron-da-hd-4k-plus: add the Extron DA HD 4K Plus CEC driver
config: i386-allyesconfig
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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
        git remote add hverkuil-media-tree git://linuxtv.org/hverkuil/media_tree.git
        git fetch --no-tags hverkuil-media-tree extron
        git checkout 29bf6b404c12d2fff3d379859493afe6d6810f3b
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/media/cec/usb/extron-da-hd-4k-plus/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All errors (new ones prefixed by >>):

   In file included from drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c:31:
   In file included from include/linux/completion.h:12:
   In file included from include/linux/swait.h:7:
   In file included from include/linux/spinlock.h:55:
   In file included from include/linux/preempt.h:78:
   In file included from arch/x86/include/asm/preempt.h:7:
   In file included from include/linux/thread_info.h:60:
>> arch/x86/include/asm/thread_info.h:175:13: error: calling '__builtin_frame_address' with a nonzero argument is unsafe [-Werror,-Wframe-address]
           oldframe = __builtin_frame_address(1);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/thread_info.h:177:11: error: calling '__builtin_frame_address' with a nonzero argument is unsafe [-Werror,-Wframe-address]
                   frame = __builtin_frame_address(2);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   2 errors generated.


vim +/__builtin_frame_address +175 arch/x86/include/asm/thread_info.h

2052e8d40ad58b1 include/asm-x86/thread_info.h      Christoph Lameter 2008-05-12  157  
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  158  /*
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  159   * Walks up the stack frames to make sure that the specified object is
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  160   * entirely contained by a single stack frame.
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  161   *
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  162   * Returns:
96dc4f9fb64690f arch/x86/include/asm/thread_info.h Sahara            2017-02-16  163   *	GOOD_FRAME	if within a frame
96dc4f9fb64690f arch/x86/include/asm/thread_info.h Sahara            2017-02-16  164   *	BAD_STACK	if placed across a frame boundary (or outside stack)
96dc4f9fb64690f arch/x86/include/asm/thread_info.h Sahara            2017-02-16  165   *	NOT_STACK	unable to determine (no frame pointers, etc)
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  166   */
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  167  static inline int arch_within_stack_frames(const void * const stack,
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  168  					   const void * const stackend,
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  169  					   const void *obj, unsigned long len)
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  170  {
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  171  #if defined(CONFIG_FRAME_POINTER)
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  172  	const void *frame = NULL;
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  173  	const void *oldframe;
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  174  
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12 @175  	oldframe = __builtin_frame_address(1);
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  176  	if (oldframe)
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  177  		frame = __builtin_frame_address(2);
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  178  	/*
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  179  	 * low ----------------------------------------------> high
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  180  	 * [saved bp][saved ip][args][local vars][saved bp][saved ip]
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  181  	 *                     ^----------------^
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  182  	 *               allow copies only within here
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  183  	 */
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  184  	while (stack <= frame && frame < stackend) {
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  185  		/*
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  186  		 * If obj + len extends past the last frame, this
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  187  		 * check won't pass and the next frame will be 0,
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  188  		 * causing us to bail out and correctly report
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  189  		 * the copy as invalid.
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  190  		 */
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  191  		if (obj + len <= frame)
96dc4f9fb64690f arch/x86/include/asm/thread_info.h Sahara            2017-02-16  192  			return obj >= oldframe + 2 * sizeof(void *) ?
96dc4f9fb64690f arch/x86/include/asm/thread_info.h Sahara            2017-02-16  193  				GOOD_FRAME : BAD_STACK;
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  194  		oldframe = frame;
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  195  		frame = *(const void * const *)frame;
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  196  	}
96dc4f9fb64690f arch/x86/include/asm/thread_info.h Sahara            2017-02-16  197  	return BAD_STACK;
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  198  #else
96dc4f9fb64690f arch/x86/include/asm/thread_info.h Sahara            2017-02-16  199  	return NOT_STACK;
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  200  #endif
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  201  }
0f60a8efe4005ab arch/x86/include/asm/thread_info.h Kees Cook         2016-07-12  202  

:::::: The code at line 175 was first introduced by commit
:::::: 0f60a8efe4005ab5e65ce000724b04d4ca04a199 mm: Implement stack frame object validation

:::::: TO: Kees Cook <keescook@...omium.org>
:::::: CC: Kees Cook <keescook@...omium.org>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (280870 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ