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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202206020533.bBh0IXx6-lkp@intel.com>
Date:   Thu, 2 Jun 2022 06:01:43 +0800
From:   kernel test robot <lkp@...el.com>
To:     Song Liu <song@...nel.org>, netdev@...r.kernel.org,
        bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     kbuild-all@...ts.01.org, ast@...nel.org, daniel@...earbox.net,
        andrii@...nel.org, kernel-team@...com, rostedt@...dmis.org,
        jolsa@...nel.org, Song Liu <song@...nel.org>
Subject: Re: [PATCH bpf-next 3/5] ftrace: introduce
 FTRACE_OPS_FL_SHARE_IPMODIFY

Hi Song,

I love your patch! Yet something to improve:

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

url:    https://github.com/intel-lab-lkp/linux/commits/Song-Liu/ftrace-host-klp-and-bpf-trampoline-together/20220602-020112
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: parisc-randconfig-r005-20220531 (https://download.01.org/0day-ci/archive/20220602/202206020533.bBh0IXx6-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 11.3.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://github.com/intel-lab-lkp/linux/commit/a710d92bb10a7a0376af57af15208ea1b4396545
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Song-Liu/ftrace-host-klp-and-bpf-trampoline-together/20220602-020112
        git checkout a710d92bb10a7a0376af57af15208ea1b4396545
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=parisc SHELL=/bin/bash kernel/trace/

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

All errors (new ones prefixed by >>):

   kernel/trace/ftrace.c: In function 'prepare_direct_functions_for_ipmodify':
   kernel/trace/ftrace.c:8005:21: error: 'direct_mutex' undeclared (first use in this function); did you mean 'event_mutex'?
    8005 |         mutex_lock(&direct_mutex);
         |                     ^~~~~~~~~~~~
         |                     event_mutex
   kernel/trace/ftrace.c:8005:21: note: each undeclared identifier is reported only once for each function it appears in
>> kernel/trace/ftrace.c:8007:19: error: 'struct ftrace_ops' has no member named 'func_hash'
    8007 |         hash = ops->func_hash->filter_hash;
         |                   ^~
>> kernel/trace/ftrace.c:8020:37: error: implicit declaration of function 'ops_references_ip' [-Werror=implicit-function-declaration]
    8020 |                                 if (ops_references_ip(op, ip)) {
         |                                     ^~~~~~~~~~~~~~~~~
>> kernel/trace/ftrace.c:8028:40: error: 'struct ftrace_ops' has no member named 'ops_func'
    8028 |                                 if (!op->ops_func) {
         |                                        ^~
   kernel/trace/ftrace.c:8032:41: error: 'struct ftrace_ops' has no member named 'ops_func'
    8032 |                                 ret = op->ops_func(op, FTRACE_OPS_CMD_ENABLE_SHARE_IPMODIFY);
         |                                         ^~
   kernel/trace/ftrace.c: In function 'register_ftrace_function':
   kernel/trace/ftrace.c:8084:31: error: 'direct_mutex' undeclared (first use in this function); did you mean 'event_mutex'?
    8084 |                 mutex_unlock(&direct_mutex);
         |                               ^~~~~~~~~~~~
         |                               event_mutex
   cc1: some warnings being treated as errors


vim +8007 kernel/trace/ftrace.c

  7974	
  7975	/*
  7976	 * When registering ftrace_ops with IPMODIFY (not direct), it is necessary
  7977	 * to make sure it doesn't conflict with any direct ftrace_ops. If there is
  7978	 * existing direct ftrace_ops on a kernel function being patched, call
  7979	 * FTRACE_OPS_CMD_ENABLE_SHARE_IPMODIFY on it to enable sharing.
  7980	 *
  7981	 * @ops:     ftrace_ops being registered.
  7982	 *
  7983	 * Returns:
  7984	 *         0 - @ops does have IPMODIFY or @ops itself is DIRECT, no change
  7985	 *             needed;
  7986	 *         1 - @ops has IPMODIFY, hold direct_mutex;
  7987	 *         -EBUSY - currently registered DIRECT ftrace_ops does not support
  7988	 *                  SHARE_IPMODIFY, we need to abort the register.
  7989	 *         -EAGAIN - cannot make changes to currently registered DIRECT
  7990	 *                   ftrace_ops at the moment, but we can retry later. This
  7991	 *                   is needed to avoid potential deadlocks.
  7992	 */
  7993	static int prepare_direct_functions_for_ipmodify(struct ftrace_ops *ops)
  7994		__acquires(&direct_mutex)
  7995	{
  7996		struct ftrace_func_entry *entry;
  7997		struct ftrace_hash *hash;
  7998		struct ftrace_ops *op;
  7999		int size, i, ret;
  8000	
  8001		if (!(ops->flags & FTRACE_OPS_FL_IPMODIFY) ||
  8002		    (ops->flags & FTRACE_OPS_FL_DIRECT))
  8003			return 0;
  8004	
  8005		mutex_lock(&direct_mutex);
  8006	
> 8007		hash = ops->func_hash->filter_hash;
  8008		size = 1 << hash->size_bits;
  8009		for (i = 0; i < size; i++) {
  8010			hlist_for_each_entry(entry, &hash->buckets[i], hlist) {
  8011				unsigned long ip = entry->ip;
  8012				bool found_op = false;
  8013	
  8014				mutex_lock(&ftrace_lock);
  8015				do_for_each_ftrace_op(op, ftrace_ops_list) {
  8016					if (!(op->flags & FTRACE_OPS_FL_DIRECT))
  8017						continue;
  8018					if (op->flags & FTRACE_OPS_FL_SHARE_IPMODIFY)
  8019						break;
> 8020					if (ops_references_ip(op, ip)) {
  8021						found_op = true;
  8022						break;
  8023					}
  8024				} while_for_each_ftrace_op(op);
  8025				mutex_unlock(&ftrace_lock);
  8026	
  8027				if (found_op) {
> 8028					if (!op->ops_func) {
  8029						ret = -EBUSY;
  8030						goto err_out;
  8031					}
  8032					ret = op->ops_func(op, FTRACE_OPS_CMD_ENABLE_SHARE_IPMODIFY);
  8033					if (ret)
  8034						goto err_out;
  8035				}
  8036			}
  8037		}
  8038	
  8039		/*
  8040		 * Didn't find any overlap with any direct function, or the direct
  8041		 * function can share with ipmodify. Hold direct_mutex to make sure
  8042		 * this doesn't change until we are done.
  8043		 */
  8044		return 1;
  8045	
  8046	err_out:
  8047		mutex_unlock(&direct_mutex);
  8048		return ret;
  8049	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ