Re: [PATCH bpf-next v2 2/2] selftests/bpf: Test bpf_strcat,bpf_strncat kfuncs

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all,org.kernel.vger.bpf,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest
Message-ID <[email protected]>
Hi Rong,

kernel test robot noticed the following build errors:

[auto build test ERROR on bpf-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Rong-Tao/selftests-bpf-Test-bpf_strcat-bpf_strncat-kfuncs/20260807-065842
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link:    https://lore.kernel.org/r/tencent_DB0510330C3A8574B3C62E6154165FCB4709%40qq.com
patch subject: [PATCH bpf-next v2 2/2] selftests/bpf: Test bpf_strcat,bpf_strncat kfuncs
config: s390-randconfig-r052-20260807 (https://download.01.org/0day-ci/archive/20260808/[email protected]/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 12df34b8469b8095359de8c249cb1b2753fadeea)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260808/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> kernel/bpf/helpers.c:4228:3: error: invalid lvalue in asm output
    4228 |                 __put_kernel_nofault(dst + dlen + copied, &cs, char, err_out);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/uaccess.h:612:2: note: expanded from macro '__put_kernel_nofault'
     612 |         arch_put_kernel_nofault(dst, src, type, local_label);   \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/s390/include/asm/uaccess.h:471:33: note: expanded from macro 'arch_put_kernel_nofault'
     471 | #define arch_put_kernel_nofault __mvc_kernel_nofault
         |                                 ^
   arch/s390/include/asm/uaccess.h:424:19: note: expanded from macro '__mvc_kernel_nofault'
     424 |                         : [_dst] "=Q" (*(type *)dst)                    \
         |                                        ^~~~~~~~~~~~
   kernel/bpf/helpers.c:4233:2: error: invalid lvalue in asm output
    4233 |         __put_kernel_nofault(dst + dlen + copied, &cs, char, err_out);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/uaccess.h:612:2: note: expanded from macro '__put_kernel_nofault'
     612 |         arch_put_kernel_nofault(dst, src, type, local_label);   \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/s390/include/asm/uaccess.h:471:33: note: expanded from macro 'arch_put_kernel_nofault'
     471 | #define arch_put_kernel_nofault __mvc_kernel_nofault
         |                                 ^
   arch/s390/include/asm/uaccess.h:424:19: note: expanded from macro '__mvc_kernel_nofault'
     424 |                         : [_dst] "=Q" (*(type *)dst)                    \
         |                                        ^~~~~~~~~~~~
   2 errors generated.


vim +4228 kernel/bpf/helpers.c

  4197	
  4198	static int __bpf_strncat(char *dst, u32 dsz, const char *src, u32 sz)
  4199	{
  4200		int dlen, slen, space, copied;
  4201		char cs = '?';
  4202	
  4203		if (!copy_from_kernel_nofault_allowed(dst, 1) ||
  4204		    !copy_from_kernel_nofault_allowed(src, 1)) {
  4205			return -ERANGE;
  4206		}
  4207	
  4208		dlen = bpf_strnlen(dst, dsz);
  4209		if (dlen < 0)
  4210			return dlen;
  4211		slen = bpf_strnlen(src, sz);
  4212		if (slen < 0)
  4213			return slen;
  4214	
  4215		if (dlen >= dsz || sz == 0 || dsz == 0)
  4216			return -EINVAL;
  4217	
  4218		space = dsz - dlen;
  4219		if (space <= 1 || space < min(slen, sz) + 1)
  4220			return -E2BIG;
  4221	
  4222		guard(pagefault)();
  4223		for (copied = 0; copied < space - 1 && copied < slen; copied++) {
  4224			__get_kernel_nofault(&cs, src, char, err_out);
  4225			if (cs == '\0')
  4226				break;
  4227	
> 4228			__put_kernel_nofault(dst + dlen + copied, &cs, char, err_out);
  4229	
  4230			src++;
  4231		}
  4232		cs = '\0';
  4233		__put_kernel_nofault(dst + dlen + copied, &cs, char, err_out);
  4234	
  4235		__get_kernel_nofault(&cs, src, char, err_out);
  4236		if (cs != '\0' && sz > copied)
  4237			return -E2BIG;
  4238	
  4239		return dlen + copied;
  4240	err_out:
  4241		return -EFAULT;
  4242	}
  4243	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.