From: kernel test robot <lkp@intel.com>
To: Blaise Boscaccy <bboscaccy@linux.microsoft.com>
Cc: oe-kbuild-all@lists.linux.dev, Paul Moore <paul@paul-moore.com>
Subject: [linuxsecuritymodule:next 7/11] security/hornet/hornet_lsm.c:78:33: warning: comparison of distinct pointer types ('const struct file_operations *' and 'void (*)(struct bpf_map *)')
Date: Thu, 14 May 2026 11:33:33 +0800 [thread overview]
Message-ID: <202605141142.p1dckBny-lkp@intel.com> (raw)
tree: https://github.com/LinuxSecurityModule/kernel next
head: 7cd0da3c29d22e2a8dcbc995b12199bc3d2704a8
commit: c62310df81899f7e14d632271aba08d0a55e2318 [7/11] lsm: introduce the Hornet LSM
config: riscv-randconfig-r133-20260514 (https://download.01.org/0day-ci/archive/20260514/202605141142.p1dckBny-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 5bac06718f502014fade905512f1d26d578a18f3)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260514/202605141142.p1dckBny-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605141142.p1dckBny-lkp@intel.com/
All warnings (new ones prefixed by >>):
security/hornet/hornet_lsm.c:78:37: error: use of undeclared identifier 'bpf_map_fops'; did you mean 'bpf_map_put'?
78 | if (unlikely(fd_file(f)->f_op != &bpf_map_fops))
| ^~~~~~~~~~~~
| bpf_map_put
include/linux/compiler.h:77:42: note: expanded from macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/bpf.h:3291:20: note: 'bpf_map_put' declared here
3291 | static inline void bpf_map_put(struct bpf_map *map)
| ^
>> security/hornet/hornet_lsm.c:78:33: warning: comparison of distinct pointer types ('const struct file_operations *' and 'void (*)(struct bpf_map *)') [-Wcompare-distinct-pointer-types]
78 | if (unlikely(fd_file(f)->f_op != &bpf_map_fops))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
include/linux/compiler.h:77:42: note: expanded from macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
security/hornet/hornet_lsm.c:256:9: error: call to undeclared function 'security_bpf_prog_load_post_integrity'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
256 | return security_bpf_prog_load_post_integrity(prog, attr, token, is_kernel,
| ^
security/hornet/hornet_lsm.c:256:9: note: did you mean 'hornet_bpf_prog_load_integrity'?
security/hornet/hornet_lsm.c:247:12: note: 'hornet_bpf_prog_load_integrity' declared here
247 | static int hornet_bpf_prog_load_integrity(struct bpf_prog *prog, union bpf_attr *attr,
| ^
248 | struct bpf_token *token, bool is_kernel)
249 | {
250 | enum lsm_integrity_verdict verdict;
251 | int result = hornet_check_program(prog, attr, token, is_kernel, &verdict);
252 |
253 | if (result < 0)
254 | return result;
255 |
256 | return security_bpf_prog_load_post_integrity(prog, attr, token, is_kernel,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| hornet_bpf_prog_load_integrity
security/hornet/hornet_lsm.c:273:27: error: use of undeclared identifier 'bpf_prog_fops'
273 | if (fd_file(f)->f_op != &bpf_prog_fops)
| ^~~~~~~~~~~~~
security/hornet/hornet_lsm.c:337:16: error: no member named 'bpf_prog_load_integrity' in 'struct lsm_static_calls_table'
337 | LSM_HOOK_INIT(bpf_prog_load_integrity, hornet_bpf_prog_load_integrity),
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/lsm_hooks.h:139:32: note: expanded from macro 'LSM_HOOK_INIT'
139 | .scalls = static_calls_table.NAME, \
| ~~~~~~~~~~~~~~~~~~ ^
security/hornet/hornet_lsm.c:338:16: error: no member named 'bpf' in 'struct lsm_static_calls_table'
338 | LSM_HOOK_INIT(bpf, hornet_bpf),
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
include/linux/lsm_hooks.h:139:32: note: expanded from macro 'LSM_HOOK_INIT'
139 | .scalls = static_calls_table.NAME, \
| ~~~~~~~~~~~~~~~~~~ ^
1 warning and 5 errors generated.
vim +78 security/hornet/hornet_lsm.c
53
54 static int hornet_verify_hashes(struct hornet_maps *maps,
55 struct hornet_parse_context *ctx,
56 struct bpf_prog *prog)
57 {
58 int map_fd;
59 u32 i;
60 struct bpf_map *map;
61 int err = 0;
62 unsigned char hash[SHA256_DIGEST_SIZE];
63 struct hornet_prog_security_struct *security = hornet_bpf_prog_security(prog);
64
65 for (i = 0; i < ctx->hash_count; i++) {
66 if (ctx->skips[i])
67 continue;
68
69 err = copy_from_bpfptr_offset(&map_fd, maps->fd_array,
70 ctx->indexes[i] * sizeof(map_fd),
71 sizeof(map_fd));
72 if (err != 0)
73 return LSM_INT_VERDICT_FAULT;
74
75 CLASS(fd, f)(map_fd);
76 if (fd_empty(f))
77 return LSM_INT_VERDICT_FAULT;
> 78 if (unlikely(fd_file(f)->f_op != &bpf_map_fops))
79 return LSM_INT_VERDICT_FAULT;
80
81 map = fd_file(f)->private_data;
82 if (!READ_ONCE(map->frozen))
83 return LSM_INT_VERDICT_FAULT;
84
85 if (!map->ops->map_get_hash)
86 return LSM_INT_VERDICT_FAULT;
87
88 if (map->ops->map_get_hash(map, SHA256_DIGEST_SIZE, hash))
89 return LSM_INT_VERDICT_FAULT;
90
91 err = memcmp(hash, &ctx->hashes[i * SHA256_DIGEST_SIZE],
92 SHA256_DIGEST_SIZE);
93 if (err)
94 return LSM_INT_VERDICT_UNEXPECTED;
95
96 memcpy(&security->signed_hashes[security->signed_hash_count * SHA256_DIGEST_SIZE],
97 &ctx->hashes[i * SHA256_DIGEST_SIZE], SHA256_DIGEST_SIZE);
98 security->signed_hash_count++;
99 }
100 return LSM_INT_VERDICT_OK;
101 }
102
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2026-05-14 3:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-14 3:33 kernel test robot [this message]
2026-05-14 18:08 ` [linuxsecuritymodule:next 7/11] security/hornet/hornet_lsm.c:78:33: warning: comparison of distinct pointer types ('const struct file_operations *' and 'void (*)(struct bpf_map *)') Paul Moore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202605141142.p1dckBny-lkp@intel.com \
--to=lkp@intel.com \
--cc=bboscaccy@linux.microsoft.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=paul@paul-moore.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.