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]
Date:   Thu, 21 May 2020 07:40:17 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
        linux-kernel@...r.kernel.org, x86@...nel.org,
        Alexandre Chartre <alexandre.chartre@...cle.com>
Subject: [tip:x86/entry 23/80] arch/x86/entry/common.c:44:24: warning: no
 previous prototype for function 'enter_from_user_mode'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/entry
head:   095b7a3e7745e6fb7cf0a1c09967c4f43e76f8f4
commit: aa9712e07f82a5458f2f16c100c491d736240d60 [23/80] x86/entry/common: Protect against instrumentation
config: x86_64-randconfig-r031-20200520 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project e6658079aca6d971b4e9d7137a3a2ecbc9c34aec)
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        git checkout aa9712e07f82a5458f2f16c100c491d736240d60
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> arch/x86/entry/common.c:44:24: warning: no previous prototype for function 'enter_from_user_mode' [-Wmissing-prototypes]
__visible noinstr void enter_from_user_mode(void)
^
arch/x86/entry/common.c:44:19: note: declare 'static' if the function is not intended to be used outside of this translation unit
__visible noinstr void enter_from_user_mode(void)
^
static
>> arch/x86/entry/common.c:234:24: warning: no previous prototype for function 'prepare_exit_to_usermode' [-Wmissing-prototypes]
__visible noinstr void prepare_exit_to_usermode(struct pt_regs *regs)
^
arch/x86/entry/common.c:234:19: note: declare 'static' if the function is not intended to be used outside of this translation unit
__visible noinstr void prepare_exit_to_usermode(struct pt_regs *regs)
^
static
>> arch/x86/entry/common.c:296:24: warning: no previous prototype for function 'syscall_return_slowpath' [-Wmissing-prototypes]
__visible noinstr void syscall_return_slowpath(struct pt_regs *regs)
^
arch/x86/entry/common.c:296:19: note: declare 'static' if the function is not intended to be used outside of this translation unit
__visible noinstr void syscall_return_slowpath(struct pt_regs *regs)
^
static
3 warnings generated.

vim +/enter_from_user_mode +44 arch/x86/entry/common.c

    41	
    42	#ifdef CONFIG_CONTEXT_TRACKING
    43	/* Called on entry from user mode with IRQs off. */
  > 44	__visible noinstr void enter_from_user_mode(void)
    45	{
    46		enum ctx_state state = ct_state();
    47	
    48		user_exit_irqoff();
    49	
    50		instrumentation_begin();
    51		CT_WARN_ON(state != CONTEXT_USER);
    52		instrumentation_end();
    53	}
    54	#else
    55	static inline void enter_from_user_mode(void) {}
    56	#endif
    57	
    58	static noinstr void exit_to_user_mode(void)
    59	{
    60		user_enter_irqoff();
    61		mds_user_clear_cpu_buffers();
    62	}
    63	
    64	static void do_audit_syscall_entry(struct pt_regs *regs, u32 arch)
    65	{
    66	#ifdef CONFIG_X86_64
    67		if (arch == AUDIT_ARCH_X86_64) {
    68			audit_syscall_entry(regs->orig_ax, regs->di,
    69					    regs->si, regs->dx, regs->r10);
    70		} else
    71	#endif
    72		{
    73			audit_syscall_entry(regs->orig_ax, regs->bx,
    74					    regs->cx, regs->dx, regs->si);
    75		}
    76	}
    77	
    78	/*
    79	 * Returns the syscall nr to run (which should match regs->orig_ax) or -1
    80	 * to skip the syscall.
    81	 */
    82	static long syscall_trace_enter(struct pt_regs *regs)
    83	{
    84		u32 arch = in_ia32_syscall() ? AUDIT_ARCH_I386 : AUDIT_ARCH_X86_64;
    85	
    86		struct thread_info *ti = current_thread_info();
    87		unsigned long ret = 0;
    88		u32 work;
    89	
    90		if (IS_ENABLED(CONFIG_DEBUG_ENTRY))
    91			BUG_ON(regs != task_pt_regs(current));
    92	
    93		work = READ_ONCE(ti->flags);
    94	
    95		if (work & (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU)) {
    96			ret = tracehook_report_syscall_entry(regs);
    97			if (ret || (work & _TIF_SYSCALL_EMU))
    98				return -1L;
    99		}
   100	
   101	#ifdef CONFIG_SECCOMP
   102		/*
   103		 * Do seccomp after ptrace, to catch any tracer changes.
   104		 */
   105		if (work & _TIF_SECCOMP) {
   106			struct seccomp_data sd;
   107	
   108			sd.arch = arch;
   109			sd.nr = regs->orig_ax;
   110			sd.instruction_pointer = regs->ip;
   111	#ifdef CONFIG_X86_64
   112			if (arch == AUDIT_ARCH_X86_64) {
   113				sd.args[0] = regs->di;
   114				sd.args[1] = regs->si;
   115				sd.args[2] = regs->dx;
   116				sd.args[3] = regs->r10;
   117				sd.args[4] = regs->r8;
   118				sd.args[5] = regs->r9;
   119			} else
   120	#endif
   121			{
   122				sd.args[0] = regs->bx;
   123				sd.args[1] = regs->cx;
   124				sd.args[2] = regs->dx;
   125				sd.args[3] = regs->si;
   126				sd.args[4] = regs->di;
   127				sd.args[5] = regs->bp;
   128			}
   129	
   130			ret = __secure_computing(&sd);
   131			if (ret == -1)
   132				return ret;
   133		}
   134	#endif
   135	
   136		if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
   137			trace_sys_enter(regs, regs->orig_ax);
   138	
   139		do_audit_syscall_entry(regs, arch);
   140	
   141		return ret ?: regs->orig_ax;
   142	}
   143	
   144	#define EXIT_TO_USERMODE_LOOP_FLAGS				\
   145		(_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_UPROBE |	\
   146		 _TIF_NEED_RESCHED | _TIF_USER_RETURN_NOTIFY | _TIF_PATCH_PENDING)
   147	
   148	static void exit_to_usermode_loop(struct pt_regs *regs, u32 cached_flags)
   149	{
   150		/*
   151		 * In order to return to user mode, we need to have IRQs off with
   152		 * none of EXIT_TO_USERMODE_LOOP_FLAGS set.  Several of these flags
   153		 * can be set at any time on preemptible kernels if we have IRQs on,
   154		 * so we need to loop.  Disabling preemption wouldn't help: doing the
   155		 * work to clear some of the flags can sleep.
   156		 */
   157		while (true) {
   158			/* We have work to do. */
   159			local_irq_enable();
   160	
   161			if (cached_flags & _TIF_NEED_RESCHED)
   162				schedule();
   163	
   164			if (cached_flags & _TIF_UPROBE)
   165				uprobe_notify_resume(regs);
   166	
   167			if (cached_flags & _TIF_PATCH_PENDING)
   168				klp_update_patch_state(current);
   169	
   170			/* deal with pending signal delivery */
   171			if (cached_flags & _TIF_SIGPENDING)
   172				do_signal(regs);
   173	
   174			if (cached_flags & _TIF_NOTIFY_RESUME) {
   175				clear_thread_flag(TIF_NOTIFY_RESUME);
   176				tracehook_notify_resume(regs);
   177				rseq_handle_notify_resume(NULL, regs);
   178			}
   179	
   180			if (cached_flags & _TIF_USER_RETURN_NOTIFY)
   181				fire_user_return_notifiers();
   182	
   183			/* Disable IRQs and retry */
   184			local_irq_disable();
   185	
   186			cached_flags = READ_ONCE(current_thread_info()->flags);
   187	
   188			if (!(cached_flags & EXIT_TO_USERMODE_LOOP_FLAGS))
   189				break;
   190		}
   191	}
   192	
   193	static void __prepare_exit_to_usermode(struct pt_regs *regs)
   194	{
   195		struct thread_info *ti = current_thread_info();
   196		u32 cached_flags;
   197	
   198		addr_limit_user_check();
   199	
   200		lockdep_assert_irqs_disabled();
   201		lockdep_sys_exit();
   202	
   203		cached_flags = READ_ONCE(ti->flags);
   204	
   205		if (unlikely(cached_flags & EXIT_TO_USERMODE_LOOP_FLAGS))
   206			exit_to_usermode_loop(regs, cached_flags);
   207	
   208		/* Reload ti->flags; we may have rescheduled above. */
   209		cached_flags = READ_ONCE(ti->flags);
   210	
   211		if (unlikely(cached_flags & _TIF_IO_BITMAP))
   212			tss_update_io_bitmap();
   213	
   214		fpregs_assert_state_consistent();
   215		if (unlikely(cached_flags & _TIF_NEED_FPU_LOAD))
   216			switch_fpu_return();
   217	
   218	#ifdef CONFIG_COMPAT
   219		/*
   220		 * Compat syscalls set TS_COMPAT.  Make sure we clear it before
   221		 * returning to user mode.  We need to clear it *after* signal
   222		 * handling, because syscall restart has a fixup for compat
   223		 * syscalls.  The fixup is exercised by the ptrace_syscall_32
   224		 * selftest.
   225		 *
   226		 * We also need to clear TS_REGS_POKED_I386: the 32-bit tracer
   227		 * special case only applies after poking regs and before the
   228		 * very next return to user mode.
   229		 */
   230		ti->status &= ~(TS_COMPAT|TS_I386_REGS_POKED);
   231	#endif
   232	}
   233	
 > 234	__visible noinstr void prepare_exit_to_usermode(struct pt_regs *regs)
   235	{
   236		instrumentation_begin();
   237		__prepare_exit_to_usermode(regs);
   238		instrumentation_end();
   239		exit_to_user_mode();
   240	}
   241	

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

Download attachment ".config.gz" of type "application/gzip" (33159 bytes)

Powered by blists - more mailing lists