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: <YpoqulzEvwNDHFMH@dev-arch.thelio-3990X>
Date:   Fri, 3 Jun 2022 08:37:30 -0700
From:   Nathan Chancellor <nathan@...nel.org>
To:     Jeff Xie <xiehuan09@...il.com>
Cc:     kernel test robot <lkp@...el.com>,
        Steven Rostedt <rostedt@...dmis.org>, llvm@...ts.linux.dev,
        kbuild-all@...ts.01.org, mingo@...hat.com,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Tom Zanussi <zanussi@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v11 1/4] trace: Add trace any kernel object

On Fri, Jun 03, 2022 at 09:48:07AM +0800, Jeff Xie wrote:
> Hi lkp,
> 
> On Fri, Jun 3, 2022 at 5:12 AM kernel test robot <lkp@...el.com> wrote:
> >
> > Hi Jeff,
> >
> > Thank you for the patch! Perhaps something to improve:
> >
> > [auto build test WARNING on b39181f7c6907dc66ff937b74758671fa6ba430c]
> >
> > url:    https://github.com/intel-lab-lkp/linux/commits/Jeff-Xie/trace-Introduce-objtrace-trigger-to-trace-the-kernel-object/20220603-004723
> > base:   b39181f7c6907dc66ff937b74758671fa6ba430c
> > config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/20220603/202206030515.4lqqkb3W-lkp@intel.com/config)
> > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project b364c76683f8ef241025a9556300778c07b590c2)
> > 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/765253f020469f94856aedc5a3fe5444e1e8f4e8
> >         git remote add linux-review https://github.com/intel-lab-lkp/linux
> >         git fetch --no-tags linux-review Jeff-Xie/trace-Introduce-objtrace-trigger-to-trace-the-kernel-object/20220603-004723
> >         git checkout 765253f020469f94856aedc5a3fe5444e1e8f4e8
> >         # save the config file
> >         mkdir build_dir && cp config build_dir/.config
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/gpu/drm/qxl/ kernel/trace/
> >
> > 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 >>):
> >
> > >> kernel/trace/trace_object.c:336:61: warning: format specifies type 'long' but the argument has type 'unsigned int' [-Wformat]
> >                    pr_err("the size of the %s should be:%ld\n", field->name, sizeof(void *));
> >                                                         ~~~                  ^~~~~~~~~~~~~~
> >                                                         %u
> 
> I will  double check it ,the sizeof(void *) on x86_64 is type ‘long
> unsigned int’.

Per Documentation/core-api/printk-formats.rst, sizeof returns size_t,
which should use the %zu specifier.

Cheers,
Nathan

> >    include/linux/printk.h:489:33: note: expanded from macro 'pr_err'
> >            printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
> >                                   ~~~     ^~~~~~~~~~~
> >    include/linux/printk.h:446:60: note: expanded from macro 'printk'
> >    #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
> >                                                        ~~~    ^~~~~~~~~~~
> >    include/linux/printk.h:418:19: note: expanded from macro 'printk_index_wrap'
> >                    _p_func(_fmt, ##__VA_ARGS__);                           \
> >                            ~~~~    ^~~~~~~~~~~
> >    1 warning generated.
> >
> >
> > vim +336 kernel/trace/trace_object.c
> >
> >    297
> >    298  static int
> >    299  event_object_trigger_parse(struct event_command *cmd_ops,
> >    300                         struct trace_event_file *file,
> >    301                         char *glob, char *cmd, char *param_and_filter)
> >    302  {
> >    303          struct event_trigger_data *trigger_data;
> >    304          struct objtrace_trigger_data *obj_data;
> >    305          struct ftrace_event_field *field;
> >    306          char *objtrace_cmd, *arg;
> >    307          char *param, *filter;
> >    308          int ret;
> >    309          bool remove;
> >    310
> >    311          remove = event_trigger_check_remove(glob);
> >    312
> >    313          /*
> >    314           * separate the param and the filter:
> >    315           * objtrace:add:OBJ[:COUNT] [if filter]
> >    316           */
> >    317          ret = event_trigger_separate_filter(param_and_filter, &param, &filter, true);
> >    318          if (ret)
> >    319                  return ret;
> >    320
> >    321          objtrace_cmd = strsep(&param, ":");
> >    322          if (!objtrace_cmd || strcmp(objtrace_cmd, OBJTRACE_CMD_ADD)) {
> >    323                  pr_err("error objtrace command\n");
> >    324                  return -EINVAL;
> >    325          }
> >    326
> >    327          arg = strsep(&param, ":");
> >    328          if (!arg)
> >    329                  return -EINVAL;
> >    330
> >    331          field = trace_find_event_field(file->event_call, arg);
> >    332          if (!field)
> >    333                  return -EINVAL;
> >    334
> >    335          if (field->size != sizeof(void *)) {
> >  > 336                  pr_err("the size of the %s should be:%ld\n", field->name, sizeof(void *));
> >    337                  return -EINVAL;
> >    338          }
> >    339
> >    340          if (remove && !field_exist(file, cmd_ops, field->name))
> >    341                  return -ENOENT;
> >    342
> >    343          obj_data = kzalloc(sizeof(*obj_data), GFP_KERNEL);
> >    344          if (!obj_data)
> >    345                  return -ENOMEM;
> >    346
> >    347          obj_data->field = field;
> >    348          obj_data->tr = file->tr;
> >    349          snprintf(obj_data->objtrace_cmd, OBJTRACE_CMD_LEN, objtrace_cmd);
> >    350
> >    351          trigger_data = event_trigger_alloc(cmd_ops, cmd, param, obj_data);
> >    352          if (!trigger_data) {
> >    353                  kfree(obj_data);
> >    354                  return -ENOMEM;
> >    355          }
> >    356          if (remove) {
> >    357                  event_trigger_unregister(cmd_ops, file, glob+1, trigger_data);
> >    358                  kfree(obj_data);
> >    359                  kfree(trigger_data);
> >    360                  return 0;
> >    361          }
> >    362
> >    363          ret = event_trigger_parse_num(param, trigger_data);
> >    364          if (ret)
> >    365                  goto out_free;
> >    366
> >    367          ret = event_trigger_set_filter(cmd_ops, file, filter, trigger_data);
> >    368          if (ret < 0)
> >    369                  goto out_free;
> >    370
> >    371          ret = event_trigger_register(cmd_ops, file, glob, trigger_data);
> >    372          if (ret)
> >    373                  goto out_free;
> >    374
> >    375          return ret;
> >    376
> >    377   out_free:
> >    378          event_trigger_reset_filter(cmd_ops, trigger_data);
> >    379          kfree(obj_data);
> >    380          kfree(trigger_data);
> >    381          return ret;
> >    382  }
> >    383
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://01.org/lkp
> 
> Thanks,
> JeffXie
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ