public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* kernel/sched/syscalls.c:979:8: error: unexpected token, expected comma
@ 2024-08-20  0:11 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2024-08-20  0:11 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: oe-kbuild-all, linux-kernel

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   6e4436539ae182dc86d57d13849862bcafaa4709
commit: 04746ed80bcf3130951ed4d5c1bc5b0bcabdde22 sched/syscalls: Split out kernel/sched/syscalls.c from kernel/sched/core.c
date:   3 months ago
config: mips-randconfig-r111-20240819 (https://download.01.org/0day-ci/archive/20240820/202408200858.vCxqGpji-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 26670e7fa4f032a019d23d56c6a02926e854e8af)
reproduce: (https://download.01.org/0day-ci/archive/20240820/202408200858.vCxqGpji-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408200858.vCxqGpji-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from kernel/sched/build_policy.c:24:
   In file included from include/linux/livepatch.h:13:
   In file included from include/linux/ftrace.h:13:
   In file included from include/linux/kallsyms.h:13:
   In file included from include/linux/mm.h:2253:
   include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   In file included from kernel/sched/build_policy.c:55:
>> kernel/sched/syscalls.c:979:8: error: unexpected token, expected comma
     979 |         ret = get_user(size, &uattr->size);
         |               ^
   arch/mips/include/asm/uaccess.h:97:33: note: expanded from macro 'get_user'
      97 |         access_ok(__p, sizeof(*__p)) ? __get_user((x), __p) :           \
         |                                        ^
   arch/mips/include/asm/uaccess.h:183:23: note: expanded from macro '__get_user'
     183 |                 __get_data_asm((x), user_lw, __gu_ptr);                 \
         |                                     ^
   <inline asm>:3:10: note: instantiated into assembly here
       3 |         .set    eva
         |                    ^
   In file included from kernel/sched/build_policy.c:55:
>> kernel/sched/syscalls.c:979:8: error: invalid operand for instruction
     979 |         ret = get_user(size, &uattr->size);
         |               ^
   arch/mips/include/asm/uaccess.h:97:33: note: expanded from macro 'get_user'
      97 |         access_ok(__p, sizeof(*__p)) ? __get_user((x), __p) :           \
         |                                        ^
   arch/mips/include/asm/uaccess.h:183:23: note: expanded from macro '__get_user'
     183 |                 __get_data_asm((x), user_lw, __gu_ptr);                 \
         |                                     ^
   <inline asm>:4:10: note: instantiated into assembly here
       4 |         lwe $2, 0($17)
         |                 ^
   In file included from kernel/sched/build_policy.c:55:
   kernel/sched/syscalls.c:1009:2: error: unexpected token, expected comma
    1009 |         put_user(sizeof(*attr), &uattr->size);
         |         ^
   arch/mips/include/asm/uaccess.h:71:33: note: expanded from macro 'put_user'
      71 |         access_ok(__p, sizeof(*__p)) ? __put_user((x), __p) : -EFAULT;  \
         |                                        ^
   arch/mips/include/asm/uaccess.h:136:18: note: expanded from macro '__put_user'
     136 |                 __put_data_asm(user_sw, __pu_ptr);                      \
         |                                ^
   <inline asm>:3:10: note: instantiated into assembly here
       3 |         .set    eva
         |                    ^
   In file included from kernel/sched/build_policy.c:55:
   kernel/sched/syscalls.c:1009:2: error: invalid operand for instruction
    1009 |         put_user(sizeof(*attr), &uattr->size);
         |         ^
   arch/mips/include/asm/uaccess.h:71:33: note: expanded from macro 'put_user'
      71 |         access_ok(__p, sizeof(*__p)) ? __put_user((x), __p) : -EFAULT;  \
         |                                        ^
   arch/mips/include/asm/uaccess.h:136:18: note: expanded from macro '__put_user'
     136 |                 __put_data_asm(user_sw, __pu_ptr);                      \
         |                                ^
   <inline asm>:4:10: note: instantiated into assembly here
       4 |         swe $2, 0($17)
         |                 ^
   1 warning and 4 errors generated.


vim +979 kernel/sched/syscalls.c

   967	
   968	/*
   969	 * Mimics kernel/events/core.c perf_copy_attr().
   970	 */
   971	static int sched_copy_attr(struct sched_attr __user *uattr, struct sched_attr *attr)
   972	{
   973		u32 size;
   974		int ret;
   975	
   976		/* Zero the full structure, so that a short copy will be nice: */
   977		memset(attr, 0, sizeof(*attr));
   978	
 > 979		ret = get_user(size, &uattr->size);
   980		if (ret)
   981			return ret;
   982	
   983		/* ABI compatibility quirk: */
   984		if (!size)
   985			size = SCHED_ATTR_SIZE_VER0;
   986		if (size < SCHED_ATTR_SIZE_VER0 || size > PAGE_SIZE)
   987			goto err_size;
   988	
   989		ret = copy_struct_from_user(attr, sizeof(*attr), uattr, size);
   990		if (ret) {
   991			if (ret == -E2BIG)
   992				goto err_size;
   993			return ret;
   994		}
   995	
   996		if ((attr->sched_flags & SCHED_FLAG_UTIL_CLAMP) &&
   997		    size < SCHED_ATTR_SIZE_VER1)
   998			return -EINVAL;
   999	
  1000		/*
  1001		 * XXX: Do we want to be lenient like existing syscalls; or do we want
  1002		 * to be strict and return an error on out-of-bounds values?
  1003		 */
  1004		attr->sched_nice = clamp(attr->sched_nice, MIN_NICE, MAX_NICE);
  1005	
  1006		return 0;
  1007	
  1008	err_size:
  1009		put_user(sizeof(*attr), &uattr->size);
  1010		return -E2BIG;
  1011	}
  1012	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* kernel/sched/syscalls.c:979:8: error: unexpected token, expected comma
@ 2025-04-08 12:10 kernel test robot
  2025-04-10  6:56 ` Ingo Molnar
  0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2025-04-08 12:10 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: oe-kbuild-all, linux-kernel

Hi Ingo,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   0af2f6be1b4281385b618cb86ad946eded089ac8
commit: 04746ed80bcf3130951ed4d5c1bc5b0bcabdde22 sched/syscalls: Split out kernel/sched/syscalls.c from kernel/sched/core.c
date:   11 months ago
config: mips-randconfig-r064-20250408 (https://download.01.org/0day-ci/archive/20250408/202504082254.7GLSWAbI-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 92c93f5286b9ff33f27ff694d2dc33da1c07afdd)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250408/202504082254.7GLSWAbI-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504082254.7GLSWAbI-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from kernel/sched/build_policy.c:24:
   In file included from include/linux/livepatch.h:13:
   In file included from include/linux/ftrace.h:13:
   In file included from include/linux/kallsyms.h:13:
   In file included from include/linux/mm.h:2253:
   include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   In file included from kernel/sched/build_policy.c:55:
>> kernel/sched/syscalls.c:979:8: error: unexpected token, expected comma
     979 |         ret = get_user(size, &uattr->size);
         |               ^
   arch/mips/include/asm/uaccess.h:97:33: note: expanded from macro 'get_user'
      97 |         access_ok(__p, sizeof(*__p)) ? __get_user((x), __p) :           \
         |                                        ^
   arch/mips/include/asm/uaccess.h:183:23: note: expanded from macro '__get_user'
     183 |                 __get_data_asm((x), user_lw, __gu_ptr);                 \
         |                                     ^
   <inline asm>:3:10: note: instantiated into assembly here
       3 |         .set    eva
         |                    ^
   In file included from kernel/sched/build_policy.c:55:
   kernel/sched/syscalls.c:979:8: error: instruction requires a CPU feature not currently enabled
     979 |         ret = get_user(size, &uattr->size);
         |               ^
   arch/mips/include/asm/uaccess.h:97:33: note: expanded from macro 'get_user'
      97 |         access_ok(__p, sizeof(*__p)) ? __get_user((x), __p) :           \
         |                                        ^
   arch/mips/include/asm/uaccess.h:183:23: note: expanded from macro '__get_user'
     183 |                 __get_data_asm((x), user_lw, __gu_ptr);                 \
         |                                     ^
   <inline asm>:4:2: note: instantiated into assembly here
       4 |         lwe $2, 0($16)
         |         ^
   In file included from kernel/sched/build_policy.c:55:
   kernel/sched/syscalls.c:1009:2: error: unexpected token, expected comma
    1009 |         put_user(sizeof(*attr), &uattr->size);
         |         ^
   arch/mips/include/asm/uaccess.h:71:33: note: expanded from macro 'put_user'
      71 |         access_ok(__p, sizeof(*__p)) ? __put_user((x), __p) : -EFAULT;  \
         |                                        ^
   arch/mips/include/asm/uaccess.h:136:18: note: expanded from macro '__put_user'
     136 |                 __put_data_asm(user_sw, __pu_ptr);                      \
         |                                ^
   <inline asm>:3:10: note: instantiated into assembly here
       3 |         .set    eva
         |                    ^
   In file included from kernel/sched/build_policy.c:55:
   kernel/sched/syscalls.c:1009:2: error: instruction requires a CPU feature not currently enabled
    1009 |         put_user(sizeof(*attr), &uattr->size);
         |         ^
   arch/mips/include/asm/uaccess.h:71:33: note: expanded from macro 'put_user'
      71 |         access_ok(__p, sizeof(*__p)) ? __put_user((x), __p) : -EFAULT;  \
         |                                        ^
   arch/mips/include/asm/uaccess.h:136:18: note: expanded from macro '__put_user'
     136 |                 __put_data_asm(user_sw, __pu_ptr);                      \
         |                                ^
   <inline asm>:4:2: note: instantiated into assembly here
       4 |         swe $3, 0($16)
         |         ^
   1 warning and 4 errors generated.


vim +979 kernel/sched/syscalls.c

   967	
   968	/*
   969	 * Mimics kernel/events/core.c perf_copy_attr().
   970	 */
   971	static int sched_copy_attr(struct sched_attr __user *uattr, struct sched_attr *attr)
   972	{
   973		u32 size;
   974		int ret;
   975	
   976		/* Zero the full structure, so that a short copy will be nice: */
   977		memset(attr, 0, sizeof(*attr));
   978	
 > 979		ret = get_user(size, &uattr->size);
   980		if (ret)
   981			return ret;
   982	
   983		/* ABI compatibility quirk: */
   984		if (!size)
   985			size = SCHED_ATTR_SIZE_VER0;
   986		if (size < SCHED_ATTR_SIZE_VER0 || size > PAGE_SIZE)
   987			goto err_size;
   988	
   989		ret = copy_struct_from_user(attr, sizeof(*attr), uattr, size);
   990		if (ret) {
   991			if (ret == -E2BIG)
   992				goto err_size;
   993			return ret;
   994		}
   995	
   996		if ((attr->sched_flags & SCHED_FLAG_UTIL_CLAMP) &&
   997		    size < SCHED_ATTR_SIZE_VER1)
   998			return -EINVAL;
   999	
  1000		/*
  1001		 * XXX: Do we want to be lenient like existing syscalls; or do we want
  1002		 * to be strict and return an error on out-of-bounds values?
  1003		 */
  1004		attr->sched_nice = clamp(attr->sched_nice, MIN_NICE, MAX_NICE);
  1005	
  1006		return 0;
  1007	
  1008	err_size:
  1009		put_user(sizeof(*attr), &uattr->size);
  1010		return -E2BIG;
  1011	}
  1012	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kernel/sched/syscalls.c:979:8: error: unexpected token, expected comma
  2025-04-08 12:10 kernel/sched/syscalls.c:979:8: error: unexpected token, expected comma kernel test robot
@ 2025-04-10  6:56 ` Ingo Molnar
  2025-04-13  2:23   ` Philip Li
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2025-04-10  6:56 UTC (permalink / raw)
  To: kernel test robot; +Cc: oe-kbuild-all, linux-kernel


* kernel test robot <lkp@intel.com> wrote:

> Hi Ingo,
> 
> FYI, the error/warning still remains.
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   0af2f6be1b4281385b618cb86ad946eded089ac8
> commit: 04746ed80bcf3130951ed4d5c1bc5b0bcabdde22 sched/syscalls: Split out kernel/sched/syscalls.c from kernel/sched/core.c
> date:   11 months ago
> config: mips-randconfig-r064-20250408 (https://download.01.org/0day-ci/archive/20250408/202504082254.7GLSWAbI-lkp@intel.com/config)
> compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 92c93f5286b9ff33f27ff694d2dc33da1c07afdd)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250408/202504082254.7GLSWAbI-lkp@intel.com/reproduce)

I cannot reproduce this.

To test it, I did:

  $ wget 'https://download.01.org/0day-ci/archive/20250408/202504082254.7GLSWAbI-lkp@intel.com/config'
  $ /bin/cp config .config
  $ make -j102 CROSS_COMPILE=/home/mingo/gcc/cross/bin/mips64-linux- ARCH=mips kernel/sched/

  CALL    scripts/checksyscalls.sh
  CC      kernel/sched/core.o
  CC      kernel/sched/fair.o
  CC      kernel/sched/build_policy.o
  CC      kernel/sched/build_utility.o
  AR      kernel/sched/built-in.a

Note that the config was *very* old AFAICS, from v6.10 or so, and I 
accepted all the default .config suggestions.

Compiler used is:

  # CONFIG_CC_VERSION_TEXT="mips64-linux-gcc (GCC) 9.3.1 20200601"

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kernel/sched/syscalls.c:979:8: error: unexpected token, expected comma
  2025-04-10  6:56 ` Ingo Molnar
@ 2025-04-13  2:23   ` Philip Li
  2025-04-14 23:09     ` Nathan Chancellor
  0 siblings, 1 reply; 5+ messages in thread
From: Philip Li @ 2025-04-13  2:23 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: kernel test robot, oe-kbuild-all, linux-kernel, llvm

+ llvm mailing list to consult

On Thu, Apr 10, 2025 at 08:56:26AM +0200, Ingo Molnar wrote:
> 
> * kernel test robot <lkp@intel.com> wrote:
> 
> > Hi Ingo,
> > 
> > FYI, the error/warning still remains.
> > 
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head:   0af2f6be1b4281385b618cb86ad946eded089ac8
> > commit: 04746ed80bcf3130951ed4d5c1bc5b0bcabdde22 sched/syscalls: Split out kernel/sched/syscalls.c from kernel/sched/core.c
> > date:   11 months ago
> > config: mips-randconfig-r064-20250408 (https://download.01.org/0day-ci/archive/20250408/202504082254.7GLSWAbI-lkp@intel.com/config)
> > compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 92c93f5286b9ff33f27ff694d2dc33da1c07afdd)
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250408/202504082254.7GLSWAbI-lkp@intel.com/reproduce)
> 
> I cannot reproduce this.

Hi Ingo, looks this problem is clang + mips specific, and it can be traced back to
early days like [1] [2] on different commits/files

	>> lib/usercopy_kunit.c:205:2: error: unexpected token, expected comma
	>> net/mctp/af_mctp.c:259:6: error: invalid operand for instruction

I add llvm mailing list to consult for this behavior, and it's possible the bot
environment is not correctly setup for this case.

BTW: the reproduce step should be below after saving the config (the steps in report is not correct)

$ mkdir build_dir && cp config build_dir/.config
$ COMPILER_INSTALL_PATH=~/temp/cross-compiler COMPILER=clang-20 ~/temp/lkp-tests/kbuild/make.cross W=1 O=build_dir ARCH=mips olddefconfig
$ COMPILER_INSTALL_PATH=~/temp/cross-compiler COMPILER=clang-20 ~/temp/lkp-tests/kbuild/make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/ fs/ kernel/

[1] https://lore.kernel.org/oe-kbuild-all/202201200842.QCcshg1P-lkp@intel.com/
[2] https://lore.kernel.org/oe-kbuild-all/202408200858.vCxqGpji-lkp@intel.com/

> 
> To test it, I did:
> 
>   $ wget 'https://download.01.org/0day-ci/archive/20250408/202504082254.7GLSWAbI-lkp@intel.com/config'
>   $ /bin/cp config .config
>   $ make -j102 CROSS_COMPILE=/home/mingo/gcc/cross/bin/mips64-linux- ARCH=mips kernel/sched/
> 
>   CALL    scripts/checksyscalls.sh
>   CC      kernel/sched/core.o
>   CC      kernel/sched/fair.o
>   CC      kernel/sched/build_policy.o
>   CC      kernel/sched/build_utility.o
>   AR      kernel/sched/built-in.a
> 
> Note that the config was *very* old AFAICS, from v6.10 or so, and I 
> accepted all the default .config suggestions.
> 
> Compiler used is:
> 
>   # CONFIG_CC_VERSION_TEXT="mips64-linux-gcc (GCC) 9.3.1 20200601"
> 
> Thanks,
> 
> 	Ingo
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kernel/sched/syscalls.c:979:8: error: unexpected token, expected comma
  2025-04-13  2:23   ` Philip Li
@ 2025-04-14 23:09     ` Nathan Chancellor
  0 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2025-04-14 23:09 UTC (permalink / raw)
  To: Philip Li
  Cc: Ingo Molnar, kernel test robot, oe-kbuild-all, linux-kernel, llvm

Hi Philip,

On Sun, Apr 13, 2025 at 10:23:43AM +0800, Philip Li wrote:
> + llvm mailing list to consult
> 
> On Thu, Apr 10, 2025 at 08:56:26AM +0200, Ingo Molnar wrote:
> > 
> > * kernel test robot <lkp@intel.com> wrote:
> > 
> > > Hi Ingo,
> > > 
> > > FYI, the error/warning still remains.
> > > 
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > > head:   0af2f6be1b4281385b618cb86ad946eded089ac8
> > > commit: 04746ed80bcf3130951ed4d5c1bc5b0bcabdde22 sched/syscalls: Split out kernel/sched/syscalls.c from kernel/sched/core.c
> > > date:   11 months ago
> > > config: mips-randconfig-r064-20250408 (https://download.01.org/0day-ci/archive/20250408/202504082254.7GLSWAbI-lkp@intel.com/config)
> > > compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 92c93f5286b9ff33f27ff694d2dc33da1c07afdd)
> > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250408/202504082254.7GLSWAbI-lkp@intel.com/reproduce)
> > 
> > I cannot reproduce this.
> 
> Hi Ingo, looks this problem is clang + mips specific, and it can be traced back to
> early days like [1] [2] on different commits/files
> 
> 	>> lib/usercopy_kunit.c:205:2: error: unexpected token, expected comma
> 	>> net/mctp/af_mctp.c:259:6: error: invalid operand for instruction
> 
> I add llvm mailing list to consult for this behavior, and it's possible the bot
> environment is not correctly setup for this case.

No, I do not think this is a bot configuration issue, I think this is an
"our matrix is not very big for MIPS" issue so we just have not seen
this issue come up yet. Based on my brief research, this appears to be
an LLVM issue so I will follow up on trying to get that fixed later
(MIPS is rather low priority):

https://github.com/ClangBuiltLinux/linux/issues/2086

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-04-14 23:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08 12:10 kernel/sched/syscalls.c:979:8: error: unexpected token, expected comma kernel test robot
2025-04-10  6:56 ` Ingo Molnar
2025-04-13  2:23   ` Philip Li
2025-04-14 23:09     ` Nathan Chancellor
  -- strict thread matches above, loose matches on Subject: below --
2024-08-20  0:11 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox