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]
Date:   Thu, 17 Nov 2022 01:38:30 +0800
From:   kernel test robot <lkp@...el.com>
To:     Roberto Sassu <roberto.sassu@...weicloud.com>, ast@...nel.org,
        daniel@...earbox.net, andrii@...nel.org, martin.lau@...ux.dev,
        song@...nel.org, yhs@...com, john.fastabend@...il.com,
        kpsingh@...nel.org, sdf@...gle.com, haoluo@...gle.com,
        jolsa@...nel.org, revest@...omium.org, jackmanb@...omium.org,
        paul@...l-moore.com, jmorris@...ei.org, serge@...lyn.com
Cc:     oe-kbuild-all@...ts.linux.dev, bpf@...r.kernel.org,
        linux-security-module@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Roberto Sassu <roberto.sassu@...wei.com>
Subject: Re: [PoC][PATCH] bpf: Call return value check function in the JITed
 code

Hi Roberto,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on ]

url:    https://github.com/intel-lab-lkp/linux/commits/UPDATE-20221116-234919/Roberto-Sassu/security-Ensure-LSMs-return-expected-values/20221116-020057
base:   the 4th patch of https://lore.kernel.org/r/20221115175652.3836811-5-roberto.sassu%40huaweicloud.com
patch link:    https://lore.kernel.org/r/20221116154712.4115929-1-roberto.sassu%40huaweicloud.com
patch subject: [PoC][PATCH] bpf: Call return value check function in the JITed code
config: mips-allyesconfig
compiler: mips-linux-gcc (GCC) 12.1.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/8d9a4cbc633baa0bb3f9945b999f4cd0ab5cc6bb
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review UPDATE-20221116-234919/Roberto-Sassu/security-Ensure-LSMs-return-expected-values/20221116-020057
        git checkout 8d9a4cbc633baa0bb3f9945b999f4cd0ab5cc6bb
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash kernel/

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/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_binder_set_context_mgr_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:30:1: note: in expansion of macro 'LSM_HOOK'
      30 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, binder_set_context_mgr,
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_binder_transaction_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:32:1: note: in expansion of macro 'LSM_HOOK'
      32 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, binder_transaction,
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_binder_transfer_binder_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:34:1: note: in expansion of macro 'LSM_HOOK'
      34 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, binder_transfer_binder,
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_binder_transfer_file_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:36:1: note: in expansion of macro 'LSM_HOOK'
      36 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, binder_transfer_file,
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_ptrace_access_check_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:38:1: note: in expansion of macro 'LSM_HOOK'
      38 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, ptrace_access_check,
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_ptrace_traceme_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:40:1: note: in expansion of macro 'LSM_HOOK'
      40 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, ptrace_traceme,
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_capget_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:42:1: note: in expansion of macro 'LSM_HOOK'
      42 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, capget, struct task_struct *target,
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_capset_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:45:1: note: in expansion of macro 'LSM_HOOK'
      45 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, capset, struct cred *new,
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_capable_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:48:1: note: in expansion of macro 'LSM_HOOK'
      48 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, capable, const struct cred *cred,
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_quotactl_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:50:1: note: in expansion of macro 'LSM_HOOK'
      50 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, quotactl, int cmds, int type,
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_quota_on_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:52:1: note: in expansion of macro 'LSM_HOOK'
      52 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, quota_on, struct dentry *dentry)
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_syslog_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:53:1: note: in expansion of macro 'LSM_HOOK'
      53 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, syslog, int type)
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_settime_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:54:1: note: in expansion of macro 'LSM_HOOK'
      54 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, settime,
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_vm_enough_memory_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:56:1: note: in expansion of macro 'LSM_HOOK'
      56 | LSM_HOOK(int, 0, LSM_RET_ZERO | LSM_RET_ONE, vm_enough_memory,
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_bprm_creds_for_exec_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:58:1: note: in expansion of macro 'LSM_HOOK'
      58 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, bprm_creds_for_exec,
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_bprm_creds_from_file_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:60:1: note: in expansion of macro 'LSM_HOOK'
      60 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, bprm_creds_from_file,
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_bprm_check_security_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:62:1: note: in expansion of macro 'LSM_HOOK'
      62 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, bprm_check_security,
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_bprm_committing_creds_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:64:1: note: in expansion of macro 'LSM_HOOK'
      64 | LSM_HOOK(void, LSM_RET_VOID, 0, bprm_committing_creds, struct linux_binprm *bprm)
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_bprm_committed_creds_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:65:1: note: in expansion of macro 'LSM_HOOK'
      65 | LSM_HOOK(void, LSM_RET_VOID, 0, bprm_committed_creds, struct linux_binprm *bprm)
         | ^~~~~~~~
>> kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_fs_context_dup_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:66:1: note: in expansion of macro 'LSM_HOOK'
      66 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, fs_context_dup,
         | ^~~~~~~~
   kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_fs_context_parse_param_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:68:1: note: in expansion of macro 'LSM_HOOK'
      68 | LSM_HOOK(int, -ENOPARAM, LSM_RET_NEG | LSM_RET_ZERO | LSM_RET_ONE,
         | ^~~~~~~~
   kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_sb_alloc_security_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:71:1: note: in expansion of macro 'LSM_HOOK'
      71 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, sb_alloc_security,
         | ^~~~~~~~
   kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_sb_delete_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:73:1: note: in expansion of macro 'LSM_HOOK'
      73 | LSM_HOOK(void, LSM_RET_VOID, 0, sb_delete, struct super_block *sb)
         | ^~~~~~~~
   kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_sb_free_security_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:74:1: note: in expansion of macro 'LSM_HOOK'
      74 | LSM_HOOK(void, LSM_RET_VOID, 0, sb_free_security, struct super_block *sb)
         | ^~~~~~~~
   kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_sb_free_mnt_opts_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:75:1: note: in expansion of macro 'LSM_HOOK'
      75 | LSM_HOOK(void, LSM_RET_VOID, 0, sb_free_mnt_opts, void *mnt_opts)
         | ^~~~~~~~
   kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_sb_eat_lsm_opts_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:76:1: note: in expansion of macro 'LSM_HOOK'
      76 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, sb_eat_lsm_opts, char *orig,
         | ^~~~~~~~
   kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_sb_mnt_opts_compat_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:78:1: note: in expansion of macro 'LSM_HOOK'
      78 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, sb_mnt_opts_compat,
         | ^~~~~~~~
   kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_sb_remount_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:80:1: note: in expansion of macro 'LSM_HOOK'
      80 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, sb_remount, struct super_block *sb,
         | ^~~~~~~~
   kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_sb_kern_mount_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:82:1: note: in expansion of macro 'LSM_HOOK'
      82 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, sb_kern_mount,
         | ^~~~~~~~
   kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_sb_show_options_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:84:1: note: in expansion of macro 'LSM_HOOK'
      84 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, sb_show_options,
         | ^~~~~~~~
   kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_sb_statfs_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:86:1: note: in expansion of macro 'LSM_HOOK'
      86 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, sb_statfs, struct dentry *dentry)
         | ^~~~~~~~
   kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_sb_mount_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:87:1: note: in expansion of macro 'LSM_HOOK'
      87 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, sb_mount, const char *dev_name,
         | ^~~~~~~~
   kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_sb_umount_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:90:1: note: in expansion of macro 'LSM_HOOK'
      90 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, sb_umount, struct vfsmount *mnt,
         | ^~~~~~~~
   kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_sb_pivotroot_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:92:1: note: in expansion of macro 'LSM_HOOK'
      92 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, sb_pivotroot,
         | ^~~~~~~~
   kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_sb_set_mnt_opts_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:94:1: note: in expansion of macro 'LSM_HOOK'
      94 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, sb_set_mnt_opts,
         | ^~~~~~~~
   kernel/bpf/bpf_lsm.c:45:14: warning: no previous prototype for 'bpf_lsm_sb_clone_mnt_opts_ret' [-Wmissing-prototypes]
      45 | noinline RET bpf_lsm_##NAME##_ret(int ret)      \
         |              ^~~~~~~~
   include/linux/lsm_hook_defs.h:97:1: note: in expansion of macro 'LSM_HOOK'
      97 | LSM_HOOK(int, 0, LSM_RET_NEG | LSM_RET_ZERO, sb_clone_mnt_opts,


vim +/bpf_lsm_binder_set_context_mgr_ret +45 kernel/bpf/bpf_lsm.c

    43	
    44	#define LSM_HOOK(RET, DEFAULT, RET_FLAGS, NAME, ...)	\
  > 45	noinline RET bpf_lsm_##NAME##_ret(int ret)	\
    46	{						\
    47		return is_ret_value_allowed(ret, RET_FLAGS) ? ret : DEFAULT; \
    48	}
    49	

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

View attachment "config" of type "text/plain" (327608 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ