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]
Message-ID: <202209230213.4NtxMTaN-lkp@intel.com>
Date:   Fri, 23 Sep 2022 02:48:35 +0800
From:   kernel test robot <lkp@...el.com>
To:     Dmitry Vyukov <dvyukov@...gle.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [dvyukov:dvyukov-perf-debugging 1/1]
 arch/x86/kernel/hw_breakpoint.c:101:29: warning: variable 'copy' set but not
 used

tree:   https://github.com/dvyukov/linux dvyukov-perf-debugging
head:   62267cd404c44bbb18a96c108839c99e7ba6f9bd
commit: 62267cd404c44bbb18a96c108839c99e7ba6f9bd [1/1] perf: debugging of missed breakpoints
config: i386-tinyconfig (https://download.01.org/0day-ci/archive/20220923/202209230213.4NtxMTaN-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/dvyukov/linux/commit/62267cd404c44bbb18a96c108839c99e7ba6f9bd
        git remote add dvyukov https://github.com/dvyukov/linux
        git fetch --no-tags dvyukov dvyukov-perf-debugging
        git checkout 62267cd404c44bbb18a96c108839c99e7ba6f9bd
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash arch/x86/kernel/ kernel/events/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   arch/x86/kernel/hw_breakpoint.c: In function 'arch_install_hw_breakpoint':
>> arch/x86/kernel/hw_breakpoint.c:101:29: warning: variable 'copy' set but not used [-Wunused-but-set-variable]
     101 |         unsigned long *dr7, copy;
         |                             ^~~~
   arch/x86/kernel/hw_breakpoint.c: In function 'arch_uninstall_hw_breakpoint':
   arch/x86/kernel/hw_breakpoint.c:151:28: warning: variable 'copy' set but not used [-Wunused-but-set-variable]
     151 |         unsigned long dr7, copy;
         |                            ^~~~
   arch/x86/kernel/hw_breakpoint.c: In function 'hw_breakpoint_handler':
>> arch/x86/kernel/hw_breakpoint.c:578:37: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
     578 |                 LOG("HIT not found");
         |                                     ^
--
   kernel/events/core.c: In function 'perf_event_disable_inatomic':
>> kernel/events/core.c:2474:74: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
    2474 |                 LOG("perf_event_disable_inatomic: irq_work_queue FAILED");
         |                                                                          ^
   kernel/events/core.c: In function 'merge_sched_in':
>> kernel/events/core.c:3739:53: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
    3739 |                         LOG("group_sched_in failed");
         |                                                     ^
   kernel/events/core.c: In function 'perf_bp_event':
   kernel/events/core.c:10191:45: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
   10191 |                 LOG("perf_bp_event: ignore");
         |                                             ^


vim +/copy +101 arch/x86/kernel/hw_breakpoint.c

    88	
    89	/*
    90	 * Install a perf counter breakpoint.
    91	 *
    92	 * We seek a free debug address register and use it for this
    93	 * breakpoint. Eventually we enable it in the debug control register.
    94	 *
    95	 * Atomic: we hold the counter->ctx->lock and we only handle variables
    96	 * and registers local to this cpu.
    97	 */
    98	int arch_install_hw_breakpoint(struct perf_event *bp)
    99	{
   100		struct arch_hw_breakpoint *info = counter_arch_bp(bp);
 > 101		unsigned long *dr7, copy;
   102		int i;
   103	
   104		lockdep_assert_irqs_disabled();
   105	
   106		for (i = 0; i < HBP_NUM; i++) {
   107			struct perf_event **slot = this_cpu_ptr(&bp_per_reg[i]);
   108	
   109			if (!*slot) {
   110				*slot = bp;
   111				break;
   112			}
   113		}
   114	
   115		if (WARN_ONCE(i == HBP_NUM, "Can't find any breakpoint slot"))
   116			return -EBUSY;
   117	
   118		set_debugreg(info->address, i);
   119		__this_cpu_write(cpu_debugreg[i], info->address);
   120	
   121		dr7 = this_cpu_ptr(&cpu_dr7);
   122		copy = *dr7;
   123		*dr7 |= encode_dr7(i, info->len, info->type);
   124		//LOG("INSTALL slot=%d event=%p", i, bp);
   125	
   126		/*
   127		 * Ensure we first write cpu_dr7 before we set the DR7 register.
   128		 * This ensures an NMI never see cpu_dr7 0 when DR7 is not.
   129		 */
   130		barrier();
   131	
   132		set_debugreg(*dr7, 7);
   133		if (info->mask)
   134			set_dr_addr_mask(info->mask, i);
   135	
   136		return 0;
   137	}
   138	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ