linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [tip:core/entry 9/11] arch/powerpc/kernel/interrupt.c:151:64: error: passing argument 2 of 'set_bits' makes pointer from integer without a cast
@ 2021-11-27  3:03 kernel test robot
  2021-11-29  9:48 ` Mark Rutland
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2021-11-27  3:03 UTC (permalink / raw)
  To: Mark Rutland; +Cc: kbuild-all, linux-kernel, x86, Thomas Gleixner

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/entry
head:   5796ee48d26a18930a8b86fb865ba195282889d0
commit: 51ed65dcfd9c61a15920a40178d471d236a7514c [9/11] powerpc: Avoid discarding flags in system_call_exception()
config: powerpc-allnoconfig (https://download.01.org/0day-ci/archive/20211127/202111271105.v7pE3REd-lkp@intel.com/config)
compiler: powerpc-linux-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://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=51ed65dcfd9c61a15920a40178d471d236a7514c
        git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
        git fetch --no-tags tip core/entry
        git checkout 51ed65dcfd9c61a15920a40178d471d236a7514c
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=powerpc SHELL=/bin/bash arch/powerpc/kernel/

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

All errors (new ones prefixed by >>):

   arch/powerpc/kernel/interrupt.c: In function 'system_call_exception':
>> arch/powerpc/kernel/interrupt.c:151:64: error: passing argument 2 of 'set_bits' makes pointer from integer without a cast [-Werror=int-conversion]
     151 |                 set_bits(_TIF_RESTOREALL, current_thread_info()->flags);
   In file included from include/linux/bitops.h:33,
                    from include/linux/log2.h:12,
                    from include/asm-generic/div64.h:55,
                    from ./arch/powerpc/include/generated/asm/div64.h:1,
                    from include/linux/math.h:5,
                    from include/linux/math64.h:6,
                    from include/linux/time64.h:5,
                    from include/linux/restart_block.h:10,
                    from include/linux/thread_info.h:14,
                    from arch/powerpc/include/asm/ptrace.h:323,
                    from arch/powerpc/include/asm/hw_irq.h:12,
                    from arch/powerpc/include/asm/irqflags.h:12,
                    from include/linux/irqflags.h:16,
                    from include/asm-generic/cmpxchg-local.h:6,
                    from arch/powerpc/include/asm/cmpxchg.h:526,
                    from arch/powerpc/include/asm/atomic.h:11,
                    from include/linux/atomic.h:7,
                    from include/linux/rcupdate.h:25,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/context_tracking.h:5,
                    from arch/powerpc/kernel/interrupt.c:3:
   arch/powerpc/include/asm/bitops.h:67:41: note: expected 'volatile long unsigned int *' but argument is of type 'long unsigned int'
      67 |                 volatile unsigned long *_p)     \
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~^~
   arch/powerpc/include/asm/bitops.h:82:1: note: in expansion of macro 'DEFINE_BITOP'
      82 | DEFINE_BITOP(set_bits, or, "")
         | ^~~~~~~~~~~~
   cc1: all warnings being treated as errors


vim +/set_bits +151 arch/powerpc/kernel/interrupt.c

    76	
    77	/* Has to run notrace because it is entered not completely "reconciled" */
    78	notrace long system_call_exception(long r3, long r4, long r5,
    79					   long r6, long r7, long r8,
    80					   unsigned long r0, struct pt_regs *regs)
    81	{
    82		syscall_fn f;
    83	
    84		kuep_lock();
    85	
    86		regs->orig_gpr3 = r3;
    87	
    88		if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG))
    89			BUG_ON(irq_soft_mask_return() != IRQS_ALL_DISABLED);
    90	
    91		trace_hardirqs_off(); /* finish reconciling */
    92	
    93		CT_WARN_ON(ct_state() == CONTEXT_KERNEL);
    94		user_exit_irqoff();
    95	
    96		BUG_ON(regs_is_unrecoverable(regs));
    97		BUG_ON(!(regs->msr & MSR_PR));
    98		BUG_ON(arch_irq_disabled_regs(regs));
    99	
   100	#ifdef CONFIG_PPC_PKEY
   101		if (mmu_has_feature(MMU_FTR_PKEY)) {
   102			unsigned long amr, iamr;
   103			bool flush_needed = false;
   104			/*
   105			 * When entering from userspace we mostly have the AMR/IAMR
   106			 * different from kernel default values. Hence don't compare.
   107			 */
   108			amr = mfspr(SPRN_AMR);
   109			iamr = mfspr(SPRN_IAMR);
   110			regs->amr  = amr;
   111			regs->iamr = iamr;
   112			if (mmu_has_feature(MMU_FTR_BOOK3S_KUAP)) {
   113				mtspr(SPRN_AMR, AMR_KUAP_BLOCKED);
   114				flush_needed = true;
   115			}
   116			if (mmu_has_feature(MMU_FTR_BOOK3S_KUEP)) {
   117				mtspr(SPRN_IAMR, AMR_KUEP_BLOCKED);
   118				flush_needed = true;
   119			}
   120			if (flush_needed)
   121				isync();
   122		} else
   123	#endif
   124			kuap_assert_locked();
   125	
   126		booke_restore_dbcr0();
   127	
   128		account_cpu_user_entry();
   129	
   130		account_stolen_time();
   131	
   132		/*
   133		 * This is not required for the syscall exit path, but makes the
   134		 * stack frame look nicer. If this was initialised in the first stack
   135		 * frame, or if the unwinder was taught the first stack frame always
   136		 * returns to user with IRQS_ENABLED, this store could be avoided!
   137		 */
   138		irq_soft_mask_regs_set_state(regs, IRQS_ENABLED);
   139	
   140		/*
   141		 * If system call is called with TM active, set _TIF_RESTOREALL to
   142		 * prevent RFSCV being used to return to userspace, because POWER9
   143		 * TM implementation has problems with this instruction returning to
   144		 * transactional state. Final register values are not relevant because
   145		 * the transaction will be aborted upon return anyway. Or in the case
   146		 * of unsupported_scv SIGILL fault, the return state does not much
   147		 * matter because it's an edge case.
   148		 */
   149		if (IS_ENABLED(CONFIG_PPC_TRANSACTIONAL_MEM) &&
   150				unlikely(MSR_TM_TRANSACTIONAL(regs->msr)))
 > 151			set_bits(_TIF_RESTOREALL, current_thread_info()->flags);
   152	
   153		/*
   154		 * If the system call was made with a transaction active, doom it and
   155		 * return without performing the system call. Unless it was an
   156		 * unsupported scv vector, in which case it's treated like an illegal
   157		 * instruction.
   158		 */
   159	#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
   160		if (unlikely(MSR_TM_TRANSACTIONAL(regs->msr)) &&
   161		    !trap_is_unsupported_scv(regs)) {
   162			/* Enable TM in the kernel, and disable EE (for scv) */
   163			hard_irq_disable();
   164			mtmsr(mfmsr() | MSR_TM);
   165	
   166			/* tabort, this dooms the transaction, nothing else */
   167			asm volatile(".long 0x7c00071d | ((%0) << 16)"
   168					:: "r"(TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT));
   169	
   170			/*
   171			 * Userspace will never see the return value. Execution will
   172			 * resume after the tbegin. of the aborted transaction with the
   173			 * checkpointed register state. A context switch could occur
   174			 * or signal delivered to the process before resuming the
   175			 * doomed transaction context, but that should all be handled
   176			 * as expected.
   177			 */
   178			return -ENOSYS;
   179		}
   180	#endif // CONFIG_PPC_TRANSACTIONAL_MEM
   181	
   182		local_irq_enable();
   183	
   184		if (unlikely(current_thread_info()->flags & _TIF_SYSCALL_DOTRACE)) {
   185			if (unlikely(trap_is_unsupported_scv(regs))) {
   186				/* Unsupported scv vector */
   187				_exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
   188				return regs->gpr[3];
   189			}
   190			/*
   191			 * We use the return value of do_syscall_trace_enter() as the
   192			 * syscall number. If the syscall was rejected for any reason
   193			 * do_syscall_trace_enter() returns an invalid syscall number
   194			 * and the test against NR_syscalls will fail and the return
   195			 * value to be used is in regs->gpr[3].
   196			 */
   197			r0 = do_syscall_trace_enter(regs);
   198			if (unlikely(r0 >= NR_syscalls))
   199				return regs->gpr[3];
   200			r3 = regs->gpr[3];
   201			r4 = regs->gpr[4];
   202			r5 = regs->gpr[5];
   203			r6 = regs->gpr[6];
   204			r7 = regs->gpr[7];
   205			r8 = regs->gpr[8];
   206	
   207		} else if (unlikely(r0 >= NR_syscalls)) {
   208			if (unlikely(trap_is_unsupported_scv(regs))) {
   209				/* Unsupported scv vector */
   210				_exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
   211				return regs->gpr[3];
   212			}
   213			return -ENOSYS;
   214		}
   215	
   216		/* May be faster to do array_index_nospec? */
   217		barrier_nospec();
   218	
   219		if (unlikely(is_compat_task())) {
   220			f = (void *)compat_sys_call_table[r0];
   221	
   222			r3 &= 0x00000000ffffffffULL;
   223			r4 &= 0x00000000ffffffffULL;
   224			r5 &= 0x00000000ffffffffULL;
   225			r6 &= 0x00000000ffffffffULL;
   226			r7 &= 0x00000000ffffffffULL;
   227			r8 &= 0x00000000ffffffffULL;
   228	
   229		} else {
   230			f = (void *)sys_call_table[r0];
   231		}
   232	
   233		return f(r3, r4, r5, r6, r7, r8);
   234	}
   235	

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

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

* Re: [tip:core/entry 9/11] arch/powerpc/kernel/interrupt.c:151:64: error: passing argument 2 of 'set_bits' makes pointer from integer without a cast
  2021-11-27  3:03 [tip:core/entry 9/11] arch/powerpc/kernel/interrupt.c:151:64: error: passing argument 2 of 'set_bits' makes pointer from integer without a cast kernel test robot
@ 2021-11-29  9:48 ` Mark Rutland
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Rutland @ 2021-11-29  9:48 UTC (permalink / raw)
  To: kernel test robot, Thomas Gleixner; +Cc: kbuild-all, linux-kernel, x86

On Sat, Nov 27, 2021 at 11:03:48AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/entry
> head:   5796ee48d26a18930a8b86fb865ba195282889d0
> commit: 51ed65dcfd9c61a15920a40178d471d236a7514c [9/11] powerpc: Avoid discarding flags in system_call_exception()
> config: powerpc-allnoconfig (https://download.01.org/0day-ci/archive/20211127/202111271105.v7pE3REd-lkp@intel.com/config)
> compiler: powerpc-linux-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://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=51ed65dcfd9c61a15920a40178d471d236a7514c
>         git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
>         git fetch --no-tags tip core/entry
>         git checkout 51ed65dcfd9c61a15920a40178d471d236a7514c
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=powerpc SHELL=/bin/bash arch/powerpc/kernel/
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>    arch/powerpc/kernel/interrupt.c: In function 'system_call_exception':
> >> arch/powerpc/kernel/interrupt.c:151:64: error: passing argument 2 of 'set_bits' makes pointer from integer without a cast [-Werror=int-conversion]
>      151 |                 set_bits(_TIF_RESTOREALL, current_thread_info()->flags);
>    In file included from include/linux/bitops.h:33,
>                     from include/linux/log2.h:12,
>                     from include/asm-generic/div64.h:55,
>                     from ./arch/powerpc/include/generated/asm/div64.h:1,
>                     from include/linux/math.h:5,
>                     from include/linux/math64.h:6,
>                     from include/linux/time64.h:5,
>                     from include/linux/restart_block.h:10,
>                     from include/linux/thread_info.h:14,
>                     from arch/powerpc/include/asm/ptrace.h:323,
>                     from arch/powerpc/include/asm/hw_irq.h:12,
>                     from arch/powerpc/include/asm/irqflags.h:12,
>                     from include/linux/irqflags.h:16,
>                     from include/asm-generic/cmpxchg-local.h:6,
>                     from arch/powerpc/include/asm/cmpxchg.h:526,
>                     from arch/powerpc/include/asm/atomic.h:11,
>                     from include/linux/atomic.h:7,
>                     from include/linux/rcupdate.h:25,
>                     from include/linux/rculist.h:11,
>                     from include/linux/pid.h:5,
>                     from include/linux/sched.h:14,
>                     from include/linux/context_tracking.h:5,
>                     from arch/powerpc/kernel/interrupt.c:3:
>    arch/powerpc/include/asm/bitops.h:67:41: note: expected 'volatile long unsigned int *' but argument is of type 'long unsigned int'
>       67 |                 volatile unsigned long *_p)     \
>          |                 ~~~~~~~~~~~~~~~~~~~~~~~~^~
>    arch/powerpc/include/asm/bitops.h:82:1: note: in expansion of macro 'DEFINE_BITOP'
>       82 | DEFINE_BITOP(set_bits, or, "")
>          | ^~~~~~~~~~~~
>    cc1: all warnings being treated as errors
> 
> 
> vim +/set_bits +151 arch/powerpc/kernel/interrupt.c

>    149		if (IS_ENABLED(CONFIG_PPC_TRANSACTIONAL_MEM) &&
>    150				unlikely(MSR_TM_TRANSACTIONAL(regs->msr)))
>  > 151			set_bits(_TIF_RESTOREALL, current_thread_info()->flags);

I missed a `&` in my patch, and the above should have been:
	
	set_bits(_TIF_RESTOREALL, &current_thread_info()->flags);

Thomas, should I respin the series with that corrected, send a fixup patch to
apply atop, or would you prefer to fix the commit locally?

Thanks,
Mark.

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

end of thread, other threads:[~2021-11-29  9:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-27  3:03 [tip:core/entry 9/11] arch/powerpc/kernel/interrupt.c:151:64: error: passing argument 2 of 'set_bits' makes pointer from integer without a cast kernel test robot
2021-11-29  9:48 ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).