Subject: Re: [PATCH bpf-next] bpf: add ambient BPF runtime context stored in current

From: kernel test robot <[email-masked]>
Date: Sat, 10 Jul 2021 12:34:34 +0800

Hi Andrii,

I love your patch! Yet something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Andrii-Nakryiko/bpf-add-ambient-BPF-runtime-context-stored-in-current/20210710-091156
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: riscv-buildonly-randconfig-r004-20210709 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8d69635ed9ecf36fd0ca85906bfde17949671cbe)
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
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/e66ab92194c9a54bde72690e56df1c2602b06ae4
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andrii-Nakryiko/bpf-add-ambient-BPF-runtime-context-stored-in-current/20210710-091156
        git checkout e66ab92194c9a54bde72690e56df1c2602b06ae4
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=riscv SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email-masked]>

All errors (new ones prefixed by >>):

   In file included from drivers/gpu/drm/tve200/tve200_drv.c:36:
   In file included from include/linux/shmem_fs.h:6:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:28:
   In file included from include/linux/cgroup-defs.h:22:
   In file included from include/linux/bpf-cgroup.h:5:
>> include/linux/bpf.h:1120:21: error: no member named 'bpf_ctx' in 'struct task_struct'
           old_ctx = current->bpf_ctx;
                     ~~~~~~~  ^
   include/linux/bpf.h:1121:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = new_ctx;
           ~~~~~~~  ^
   include/linux/bpf.h:1127:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = old_ctx;
           ~~~~~~~  ^
   3 errors generated.
--
   In file included from drivers/input/touchscreen/mms114.c:15:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:28:
   In file included from include/linux/cgroup-defs.h:22:
   In file included from include/linux/bpf-cgroup.h:5:
>> include/linux/bpf.h:1120:21: error: no member named 'bpf_ctx' in 'struct task_struct'
           old_ctx = current->bpf_ctx;
                     ~~~~~~~  ^
   include/linux/bpf.h:1121:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = new_ctx;
           ~~~~~~~  ^
   include/linux/bpf.h:1127:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = old_ctx;
           ~~~~~~~  ^
   drivers/input/touchscreen/mms114.c:468:15: warning: cast to smaller integer type 'enum mms_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
           data->type = (enum mms_type)match_data;
                        ^~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning and 3 errors generated.
--
   In file included from drivers/regulator/lp872x.c:15:
   In file included from include/linux/regulator/lp872x.h:11:
   In file included from include/linux/regulator/machine.h:15:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:28:
   In file included from include/linux/cgroup-defs.h:22:
   In file included from include/linux/bpf-cgroup.h:5:
>> include/linux/bpf.h:1120:21: error: no member named 'bpf_ctx' in 'struct task_struct'
           old_ctx = current->bpf_ctx;
                     ~~~~~~~  ^
   include/linux/bpf.h:1121:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = new_ctx;
           ~~~~~~~  ^
   include/linux/bpf.h:1127:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = old_ctx;
           ~~~~~~~  ^
   drivers/regulator/lp872x.c:876:5: warning: cast to smaller integer type 'enum lp872x_regulator_id' from 'void *' [-Wvoid-pointer-to-enum-cast]
                                   (enum lp872x_regulator_id)match[i].driver_data;
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning and 3 errors generated.
--
   In file included from drivers/regulator/ltc3589.c:15:
   In file included from include/linux/regulator/driver.h:18:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:28:
   In file included from include/linux/cgroup-defs.h:22:
   In file included from include/linux/bpf-cgroup.h:5:
>> include/linux/bpf.h:1120:21: error: no member named 'bpf_ctx' in 'struct task_struct'
           old_ctx = current->bpf_ctx;
                     ~~~~~~~  ^
   include/linux/bpf.h:1121:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = new_ctx;
           ~~~~~~~  ^
   include/linux/bpf.h:1127:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = old_ctx;
           ~~~~~~~  ^
   drivers/regulator/ltc3589.c:395:22: warning: cast to smaller integer type 'enum ltc3589_variant' from 'const void *' [-Wvoid-pointer-to-enum-cast]
                   ltc3589->variant = (enum ltc3589_variant)
                                      ^~~~~~~~~~~~~~~~~~~~~~
   1 warning and 3 errors generated.
--
   In file included from drivers/char/random.c:335:
   In file included from include/linux/syscalls.h:87:
   In file included from include/trace/syscall.h:7:
   In file included from include/linux/trace_events.h:10:
   In file included from include/linux/perf_event.h:57:
   In file included from include/linux/cgroup.h:28:
   In file included from include/linux/cgroup-defs.h:22:
   In file included from include/linux/bpf-cgroup.h:5:
>> include/linux/bpf.h:1120:21: error: no member named 'bpf_ctx' in 'struct task_struct'
           old_ctx = current->bpf_ctx;
                     ~~~~~~~  ^
   include/linux/bpf.h:1121:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = new_ctx;
           ~~~~~~~  ^
   include/linux/bpf.h:1127:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = old_ctx;
           ~~~~~~~  ^
   drivers/char/random.c:2272:6: warning: no previous prototype for function 'add_hwgenerator_randomness' [-Wmissing-prototypes]
   void add_hwgenerator_randomness(const char *buffer, size_t count,
        ^
   drivers/char/random.c:2272:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void add_hwgenerator_randomness(const char *buffer, size_t count,
   ^
   static 
   1 warning and 3 errors generated.
--
   In file included from drivers/char/tpm/tpm-interface.c:26:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:28:
   In file included from include/linux/cgroup-defs.h:22:
   In file included from include/linux/bpf-cgroup.h:5:
>> include/linux/bpf.h:1120:21: error: no member named 'bpf_ctx' in 'struct task_struct'
           old_ctx = current->bpf_ctx;
                     ~~~~~~~  ^
   include/linux/bpf.h:1121:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = new_ctx;
           ~~~~~~~  ^
   include/linux/bpf.h:1127:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = old_ctx;
           ~~~~~~~  ^
   In file included from drivers/char/tpm/tpm-interface.c:28:
   include/linux/tpm_eventlog.h:167:6: warning: variable 'mapping_size' set but not used [-Wunused-but-set-variable]
           int mapping_size;
               ^
   1 warning and 3 errors generated.
--
   In file included from drivers/iio/dac/mcp4725.c:18:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:28:
   In file included from include/linux/cgroup-defs.h:22:
   In file included from include/linux/bpf-cgroup.h:5:
>> include/linux/bpf.h:1120:21: error: no member named 'bpf_ctx' in 'struct task_struct'
           old_ctx = current->bpf_ctx;
                     ~~~~~~~  ^
   include/linux/bpf.h:1121:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = new_ctx;
           ~~~~~~~  ^
   include/linux/bpf.h:1127:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = old_ctx;
           ~~~~~~~  ^
   drivers/iio/dac/mcp4725.c:389:14: warning: cast to smaller integer type 'enum chip_id' from 'const void *' [-Wvoid-pointer-to-enum-cast]
                   data->id = (enum chip_id)device_get_match_data(&client->dev);
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning and 3 errors generated.
--
   In file included from drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c:14:
   In file included from drivers/iio/imu/inv_icm42600/inv_icm42600.h:13:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:28:
   In file included from include/linux/cgroup-defs.h:22:
   In file included from include/linux/bpf-cgroup.h:5:
>> include/linux/bpf.h:1120:21: error: no member named 'bpf_ctx' in 'struct task_struct'
           old_ctx = current->bpf_ctx;
                     ~~~~~~~  ^
   include/linux/bpf.h:1121:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = new_ctx;
           ~~~~~~~  ^
   include/linux/bpf.h:1127:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = old_ctx;
           ~~~~~~~  ^
   drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c:61:9: warning: cast to smaller integer type 'enum inv_icm42600_chip' from 'const void *' [-Wvoid-pointer-to-enum-cast]
           chip = (enum inv_icm42600_chip)match;
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning and 3 errors generated.
--
   In file included from drivers/iio/magnetometer/ak8975.c:21:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:28:
   In file included from include/linux/cgroup-defs.h:22:
   In file included from include/linux/bpf-cgroup.h:5:
>> include/linux/bpf.h:1120:21: error: no member named 'bpf_ctx' in 'struct task_struct'
           old_ctx = current->bpf_ctx;
                     ~~~~~~~  ^
   include/linux/bpf.h:1121:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = new_ctx;
           ~~~~~~~  ^
   include/linux/bpf.h:1127:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = old_ctx;
           ~~~~~~~  ^
   drivers/iio/magnetometer/ak8975.c:900:13: warning: cast to smaller integer type 'enum asahi_compass_chipset' from 'const void *' [-Wvoid-pointer-to-enum-cast]
                   chipset = (enum asahi_compass_chipset)(match);
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning and 3 errors generated.
--
   In file included from drivers/mfd/lp87565.c:14:
   In file included from include/linux/mfd/lp87565.h:12:
   In file included from include/linux/regulator/driver.h:18:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:28:
   In file included from include/linux/cgroup-defs.h:22:
   In file included from include/linux/bpf-cgroup.h:5:
>> include/linux/bpf.h:1120:21: error: no member named 'bpf_ctx' in 'struct task_struct'
           old_ctx = current->bpf_ctx;
                     ~~~~~~~  ^
   include/linux/bpf.h:1121:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = new_ctx;
           ~~~~~~~  ^
   include/linux/bpf.h:1127:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = old_ctx;
           ~~~~~~~  ^
   drivers/mfd/lp87565.c:77:23: warning: cast to smaller integer type 'enum lp87565_device_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
                   lp87565->dev_type = (enum lp87565_device_type)of_id->data;
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning and 3 errors generated.
--
   In file included from drivers/mfd/wm8994-core.c:21:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:28:
   In file included from include/linux/cgroup-defs.h:22:
   In file included from include/linux/bpf-cgroup.h:5:
>> include/linux/bpf.h:1120:21: error: no member named 'bpf_ctx' in 'struct task_struct'
           old_ctx = current->bpf_ctx;
                     ~~~~~~~  ^
   include/linux/bpf.h:1121:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = new_ctx;
           ~~~~~~~  ^
   include/linux/bpf.h:1127:11: error: no member named 'bpf_ctx' in 'struct task_struct'
           current->bpf_ctx = old_ctx;
           ~~~~~~~  ^
   drivers/mfd/wm8994-core.c:644:19: warning: cast to smaller integer type 'enum wm8994_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
                           wm8994->type = (enum wm8994_type)of_id->data;
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning and 3 errors generated.
..

vim +1120 include/linux/bpf.h

  1115	
  1116	static inline struct bpf_run_ctx *bpf_set_run_ctx(struct bpf_run_ctx *new_ctx)
  1117	{
  1118		struct bpf_run_ctx *old_ctx;
  1119	
> 1120		old_ctx = current->bpf_ctx;
  1121		current->bpf_ctx = new_ctx;
  1122		return old_ctx;
  1123	}
  1124	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email-masked]