Subject: linux-next: build failure after merge of the landlock tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 6 Jun 2023 13:02:36 +1000

Hi all,

After merging the landlock tree, today's linux-next build (powerpc
ppc64_defconfig) failed like this:

security/landlock/net.c:165:51: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__lsm_ro_after_init'
  165 | static struct security_hook_list landlock_hooks[] __lsm_ro_after_init = {
      |                                                   ^~~~~~~~~~~~~~~~~~~
security/landlock/net.c: In function 'landlock_add_net_hooks':
security/landlock/net.c:172:28: error: 'landlock_hooks' undeclared (first use in this function)
  172 |         security_add_hooks(landlock_hooks, ARRAY_SIZE(landlock_hooks),
      |                            ^~~~~~~~~~~~~~
security/landlock/net.c:172:28: note: each undeclared identifier is reported only once for each function it appears in
In file included from include/linux/container_of.h:5,
                 from include/linux/kernel.h:21,
                 from include/linux/uio.h:8,
                 from include/linux/socket.h:8,
                 from include/uapi/linux/in.h:25,
                 from include/linux/in.h:19,
                 from security/landlock/net.c:9:
include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant
   16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
      |                                                   ^
include/linux/compiler.h:231:33: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
  231 | #define __must_be_array(a)      BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
      |                                 ^~~~~~~~~~~~~~~~~
include/linux/kernel.h:56:59: note: in expansion of macro '__must_be_array'
   56 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
      |                                                           ^~~~~~~~~~~~~~~
security/landlock/net.c:172:44: note: in expansion of macro 'ARRAY_SIZE'
  172 |         security_add_hooks(landlock_hooks, ARRAY_SIZE(landlock_hooks),
      |                                            ^~~~~~~~~~
security/landlock/net.c: At top level:
security/landlock/net.c:157:12: warning: 'hook_socket_connect' defined but not used [-Wunused-function]
  157 | static int hook_socket_connect(struct socket *const sock,
      |            ^~~~~~~~~~~~~~~~~~~
security/landlock/net.c:150:12: warning: 'hook_socket_bind' defined but not used [-Wunused-function]
  150 | static int hook_socket_bind(struct socket *const sock,
      |            ^~~~~~~~~~~~~~~~

Caused by commit

  6d0bfdb25ce6 ("landlock: Add network rules and TCP hooks support")

I have use the landlock tree from next-20230605 for today.

-- 
Cheers,
Stephen Rothwell