tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 6ce5d01e7011b32600656bf90a626b1e51fb192a commit: 54d9469bc515dc5fcbc20eecbe19cea868b70d68 [5023/7393] fortify: Add run-time WARN for cross-field memcpy() config: mips-buildonly-randconfig-r006-20220915 (https://download.01.org/0day-ci/archive/20220916/202209161144.x9xSqNQZ-lkp@xxxxxxxxx/config) compiler: mips64el-linux-gcc (GCC) 12.1.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://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=54d9469bc515dc5fcbc20eecbe19cea868b70d68 git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout 54d9469bc515dc5fcbc20eecbe19cea868b70d68 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <lkp@xxxxxxxxx> All errors (new ones prefixed by >>): mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `lzma2_lzma': >> arch/mips/boot/compressed/../../../../lib/xz/xz_dec_lzma2.c:917: undefined reference to `warn_slowpath_fmt' vim +917 arch/mips/boot/compressed/../../../../lib/xz/xz_dec_lzma2.c 24fa0402a9b6a5 Lasse Collin 2011-01-12 862 24fa0402a9b6a5 Lasse Collin 2011-01-12 863 /********* 24fa0402a9b6a5 Lasse Collin 2011-01-12 864 * LZMA2 * 24fa0402a9b6a5 Lasse Collin 2011-01-12 865 *********/ 24fa0402a9b6a5 Lasse Collin 2011-01-12 866 24fa0402a9b6a5 Lasse Collin 2011-01-12 867 /* 24fa0402a9b6a5 Lasse Collin 2011-01-12 868 * The LZMA decoder assumes that if the input limit (s->rc.in_limit) hasn't 24fa0402a9b6a5 Lasse Collin 2011-01-12 869 * been exceeded, it is safe to read up to LZMA_IN_REQUIRED bytes. This 24fa0402a9b6a5 Lasse Collin 2011-01-12 870 * wrapper function takes care of making the LZMA decoder's assumption safe. 24fa0402a9b6a5 Lasse Collin 2011-01-12 871 * 24fa0402a9b6a5 Lasse Collin 2011-01-12 872 * As long as there is plenty of input left to be decoded in the current LZMA 24fa0402a9b6a5 Lasse Collin 2011-01-12 873 * chunk, we decode directly from the caller-supplied input buffer until 24fa0402a9b6a5 Lasse Collin 2011-01-12 874 * there's LZMA_IN_REQUIRED bytes left. Those remaining bytes are copied into 24fa0402a9b6a5 Lasse Collin 2011-01-12 875 * s->temp.buf, which (hopefully) gets filled on the next call to this 24fa0402a9b6a5 Lasse Collin 2011-01-12 876 * function. We decode a few bytes from the temporary buffer so that we can 24fa0402a9b6a5 Lasse Collin 2011-01-12 877 * continue decoding from the caller-supplied input buffer again. 24fa0402a9b6a5 Lasse Collin 2011-01-12 878 */ 24fa0402a9b6a5 Lasse Collin 2011-01-12 879 static bool lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b) 24fa0402a9b6a5 Lasse Collin 2011-01-12 880 { 24fa0402a9b6a5 Lasse Collin 2011-01-12 881 size_t in_avail; 24fa0402a9b6a5 Lasse Collin 2011-01-12 882 uint32_t tmp; 24fa0402a9b6a5 Lasse Collin 2011-01-12 883 24fa0402a9b6a5 Lasse Collin 2011-01-12 884 in_avail = b->in_size - b->in_pos; 24fa0402a9b6a5 Lasse Collin 2011-01-12 885 if (s->temp.size > 0 || s->lzma2.compressed == 0) { 24fa0402a9b6a5 Lasse Collin 2011-01-12 886 tmp = 2 * LZMA_IN_REQUIRED - s->temp.size; 24fa0402a9b6a5 Lasse Collin 2011-01-12 887 if (tmp > s->lzma2.compressed - s->temp.size) 24fa0402a9b6a5 Lasse Collin 2011-01-12 888 tmp = s->lzma2.compressed - s->temp.size; 24fa0402a9b6a5 Lasse Collin 2011-01-12 889 if (tmp > in_avail) 24fa0402a9b6a5 Lasse Collin 2011-01-12 890 tmp = in_avail; 24fa0402a9b6a5 Lasse Collin 2011-01-12 891 24fa0402a9b6a5 Lasse Collin 2011-01-12 892 memcpy(s->temp.buf + s->temp.size, b->in + b->in_pos, tmp); 24fa0402a9b6a5 Lasse Collin 2011-01-12 893 24fa0402a9b6a5 Lasse Collin 2011-01-12 894 if (s->temp.size + tmp == s->lzma2.compressed) { 24fa0402a9b6a5 Lasse Collin 2011-01-12 895 memzero(s->temp.buf + s->temp.size + tmp, 24fa0402a9b6a5 Lasse Collin 2011-01-12 896 sizeof(s->temp.buf) 24fa0402a9b6a5 Lasse Collin 2011-01-12 897 - s->temp.size - tmp); 24fa0402a9b6a5 Lasse Collin 2011-01-12 898 s->rc.in_limit = s->temp.size + tmp; 24fa0402a9b6a5 Lasse Collin 2011-01-12 899 } else if (s->temp.size + tmp < LZMA_IN_REQUIRED) { 24fa0402a9b6a5 Lasse Collin 2011-01-12 900 s->temp.size += tmp; 24fa0402a9b6a5 Lasse Collin 2011-01-12 901 b->in_pos += tmp; 24fa0402a9b6a5 Lasse Collin 2011-01-12 902 return true; 24fa0402a9b6a5 Lasse Collin 2011-01-12 903 } else { 24fa0402a9b6a5 Lasse Collin 2011-01-12 904 s->rc.in_limit = s->temp.size + tmp - LZMA_IN_REQUIRED; 24fa0402a9b6a5 Lasse Collin 2011-01-12 905 } 24fa0402a9b6a5 Lasse Collin 2011-01-12 906 24fa0402a9b6a5 Lasse Collin 2011-01-12 907 s->rc.in = s->temp.buf; 24fa0402a9b6a5 Lasse Collin 2011-01-12 908 s->rc.in_pos = 0; 24fa0402a9b6a5 Lasse Collin 2011-01-12 909 24fa0402a9b6a5 Lasse Collin 2011-01-12 910 if (!lzma_main(s) || s->rc.in_pos > s->temp.size + tmp) 24fa0402a9b6a5 Lasse Collin 2011-01-12 911 return false; 24fa0402a9b6a5 Lasse Collin 2011-01-12 912 24fa0402a9b6a5 Lasse Collin 2011-01-12 913 s->lzma2.compressed -= s->rc.in_pos; 24fa0402a9b6a5 Lasse Collin 2011-01-12 914 24fa0402a9b6a5 Lasse Collin 2011-01-12 915 if (s->rc.in_pos < s->temp.size) { 24fa0402a9b6a5 Lasse Collin 2011-01-12 916 s->temp.size -= s->rc.in_pos; 24fa0402a9b6a5 Lasse Collin 2011-01-12 @917 memmove(s->temp.buf, s->temp.buf + s->rc.in_pos, 24fa0402a9b6a5 Lasse Collin 2011-01-12 918 s->temp.size); 24fa0402a9b6a5 Lasse Collin 2011-01-12 919 return true; 24fa0402a9b6a5 Lasse Collin 2011-01-12 920 } 24fa0402a9b6a5 Lasse Collin 2011-01-12 921 24fa0402a9b6a5 Lasse Collin 2011-01-12 922 b->in_pos += s->rc.in_pos - s->temp.size; 24fa0402a9b6a5 Lasse Collin 2011-01-12 923 s->temp.size = 0; 24fa0402a9b6a5 Lasse Collin 2011-01-12 924 } 24fa0402a9b6a5 Lasse Collin 2011-01-12 925 24fa0402a9b6a5 Lasse Collin 2011-01-12 926 in_avail = b->in_size - b->in_pos; 24fa0402a9b6a5 Lasse Collin 2011-01-12 927 if (in_avail >= LZMA_IN_REQUIRED) { 24fa0402a9b6a5 Lasse Collin 2011-01-12 928 s->rc.in = b->in; 24fa0402a9b6a5 Lasse Collin 2011-01-12 929 s->rc.in_pos = b->in_pos; 24fa0402a9b6a5 Lasse Collin 2011-01-12 930 24fa0402a9b6a5 Lasse Collin 2011-01-12 931 if (in_avail >= s->lzma2.compressed + LZMA_IN_REQUIRED) 24fa0402a9b6a5 Lasse Collin 2011-01-12 932 s->rc.in_limit = b->in_pos + s->lzma2.compressed; 24fa0402a9b6a5 Lasse Collin 2011-01-12 933 else 24fa0402a9b6a5 Lasse Collin 2011-01-12 934 s->rc.in_limit = b->in_size - LZMA_IN_REQUIRED; 24fa0402a9b6a5 Lasse Collin 2011-01-12 935 24fa0402a9b6a5 Lasse Collin 2011-01-12 936 if (!lzma_main(s)) 24fa0402a9b6a5 Lasse Collin 2011-01-12 937 return false; 24fa0402a9b6a5 Lasse Collin 2011-01-12 938 24fa0402a9b6a5 Lasse Collin 2011-01-12 939 in_avail = s->rc.in_pos - b->in_pos; 24fa0402a9b6a5 Lasse Collin 2011-01-12 940 if (in_avail > s->lzma2.compressed) 24fa0402a9b6a5 Lasse Collin 2011-01-12 941 return false; 24fa0402a9b6a5 Lasse Collin 2011-01-12 942 24fa0402a9b6a5 Lasse Collin 2011-01-12 943 s->lzma2.compressed -= in_avail; 24fa0402a9b6a5 Lasse Collin 2011-01-12 944 b->in_pos = s->rc.in_pos; 24fa0402a9b6a5 Lasse Collin 2011-01-12 945 } 24fa0402a9b6a5 Lasse Collin 2011-01-12 946 24fa0402a9b6a5 Lasse Collin 2011-01-12 947 in_avail = b->in_size - b->in_pos; 24fa0402a9b6a5 Lasse Collin 2011-01-12 948 if (in_avail < LZMA_IN_REQUIRED) { 24fa0402a9b6a5 Lasse Collin 2011-01-12 949 if (in_avail > s->lzma2.compressed) 24fa0402a9b6a5 Lasse Collin 2011-01-12 950 in_avail = s->lzma2.compressed; 24fa0402a9b6a5 Lasse Collin 2011-01-12 951 24fa0402a9b6a5 Lasse Collin 2011-01-12 952 memcpy(s->temp.buf, b->in + b->in_pos, in_avail); 24fa0402a9b6a5 Lasse Collin 2011-01-12 953 s->temp.size = in_avail; 24fa0402a9b6a5 Lasse Collin 2011-01-12 954 b->in_pos += in_avail; 24fa0402a9b6a5 Lasse Collin 2011-01-12 955 } 24fa0402a9b6a5 Lasse Collin 2011-01-12 956 24fa0402a9b6a5 Lasse Collin 2011-01-12 957 return true; 24fa0402a9b6a5 Lasse Collin 2011-01-12 958 } 24fa0402a9b6a5 Lasse Collin 2011-01-12 959 :::::: The code at line 917 was first introduced by commit :::::: 24fa0402a9b6a537e87e38341e78b7da86486846 decompressors: add XZ decompressor module :::::: TO: Lasse Collin <lasse.collin@xxxxxxxxxxx> :::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> -- 0-DAY CI Kernel Test Service https://01.org/lkp