Public bug reported:

A Resolute kernel fails to build when CONFIG_SECURITY_APPARMOR=y and
CONFIG_NETWORK_SECMARK=n (for example, with CONFIG_SECURITY_SELINUX=n).

Steps to reproduce:
 1. Check out the Resolute kernel (master-next).
 2. Set CONFIG_SECURITY_SELINUX=n and CONFIG_NETWORK_SECMARK=n, and keep
    CONFIG_SECURITY_APPARMOR=y.
 3. Build the kernel.

The build fails in security/apparmor:

```
security/apparmor/lsm.c: In function 'apparmor_socket_sock_rcv_skb':
security/apparmor/lsm.c:1907:14: error: implicit declaration of function 
'aa_secmark_enabled' [-Werror=implicit-function-declaration]
 1907 |         if (!aa_secmark_enabled())
      |              ^~~~~~~~~~~~~~~~~~
security/apparmor/lsm.c:1921:63: error: 'struct sk_buff' has no member named 
'secmark'; did you mean 'mark'?
 1921 |         if (label_mediates(label, AA_CLASS_NETV9_SKB) || skb->secmark)
      |                                                               ^~~~~~~
      |                                                               mark
security/apparmor/lsm.c: In function 'apparmor_inet_conn_request':
security/apparmor/lsm.c:1949:63: error: 'struct sk_buff' has no member named 
'secmark'; did you mean 'mark'?
 1949 |         if (label_mediates(label, AA_CLASS_NETV9_SKB) || skb->secmark)
      |                                                               ^~~~~~~
      |                                                               mark
security/apparmor/lsm.c: In function 'apparmor_ip_postroute':
security/apparmor/lsm.c:1975:44: error: 'struct sk_buff' has no member named 
'secmark'; did you mean 'mark'?
 1975 |         if (!aa_secmark_enabled() || !skb->secmark)
      |                                            ^~~~~~~
      |                                            mark
security/apparmor/lsm.c:1994:48: error: 'struct sk_buff' has no member named 
'secmark'; did you mean 'mark'?
 1994 |                 label = aa_secid_to_label(skb->secmark); /* may be NULL 
*/
      |                                                ^~~~~~~
      |                                                mark
security/apparmor/lsm.c: In function 'apparmor_ip_localout':
security/apparmor/lsm.c:2066:14: error: 'struct sk_buff' has no member named 
'secmark'; did you mean 'mark'?
 2066 |         skb->secmark = out->secid;
      |              ^~~~~~~
      |              mark
security/apparmor/lsm.c: At top level:
security/apparmor/lsm.c:1965:21: warning: 'apparmor_ip_postroute' defined but 
not used [-Wunused-function]
 1965 | static unsigned int apparmor_ip_postroute(void *priv,
      |                     ^~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[4]: *** [scripts/Makefile.build:289: security/apparmor/lsm.o] Error 1
make[4]: *** Waiting for unfinished jobs....
security/apparmor/af_inet.c: In function 'match_addr_iface':
security/apparmor/af_inet.c:1199:20: warning: unused variable 'tmp' 
[-Wunused-variable]
 1199 |         aa_state_t tmp = state;
      |                    ^~~
security/apparmor/af_inet.c: In function '__profile_skb_perm':
security/apparmor/af_inet.c:1367:52: error: 'const struct sk_buff' has no 
member named 'secmark'; did you mean 'mark'?
 1367 |                                               skb->secmark, sk);
      |                                                    ^~~~~~~
      |                                                    mark
security/apparmor/af_inet.c: In function '__aa_sock_rcv_skb':
security/apparmor/af_inet.c:1417:43: error: 'const struct sk_buff' has no 
member named 'secmark'; did you mean 'mark'?
 1417 |         seclabel = aa_secid_to_label(skb->secmark); /* may be NULL */
      |                                           ^~~~~~~
      |                                           mark
security/apparmor/af_inet.c: In function '__aa_inet_conn_request':
security/apparmor/af_inet.c:1451:43: error: 'const struct sk_buff' has no 
member named 'secmark'; did you mean 'mark'?
 1451 |         seclabel = aa_secid_to_label(skb->secmark); /* may be NULL */
      |                                           ^~~~~~~
      |                                           mark
security/apparmor/af_inet.c: In function '__aa_ip_postroute':
security/apparmor/af_inet.c:1485:43: error: 'const struct sk_buff' has no 
member named 'secmark'; did you mean 'mark'?
 1485 |         seclabel = aa_secid_to_label(skb->secmark); /* may be NULL */
      |                                           ^~~~~~~
      |                                           mark
```

Enabling CONFIG_SECURITY_SELINUX or CONFIG_NETWORK_SECMARK lets the
build complete.

** Affects: linux (Ubuntu)
     Importance: Undecided
         Status: New

** Affects: linux (Ubuntu Resolute)
     Importance: Undecided
         Status: New

** Also affects: linux (Ubuntu Resolute)
   Importance: Undecided
       Status: New

** Description changed:

  A Resolute kernel fails to build when CONFIG_SECURITY_APPARMOR=y and
  CONFIG_NETWORK_SECMARK=n (for example, with CONFIG_SECURITY_SELINUX=n).
  
  Steps to reproduce:
-  1. Check out the Resolute kernel (master-next).
-  2. Set CONFIG_SECURITY_SELINUX=n and CONFIG_NETWORK_SECMARK=n, and keep
-     CONFIG_SECURITY_APPARMOR=y.
-  3. Build the kernel.
+  1. Check out the Resolute kernel (master-next).
+  2. Set CONFIG_SECURITY_SELINUX=n and CONFIG_NETWORK_SECMARK=n, and keep
+     CONFIG_SECURITY_APPARMOR=y.
+  3. Build the kernel.
  
  The build fails in security/apparmor:
  
-   security/apparmor/lsm.c: In function 'apparmor_socket_sock_rcv_skb':
-   security/apparmor/lsm.c:1907:14: error: implicit declaration of function 
'aa_secmark_enabled' [-Werror=implicit-function-declaration]
-   security/apparmor/lsm.c:1921:63: error: 'struct sk_buff' has no member 
named 'secmark'; did you mean 'mark'?
-   security/apparmor/lsm.c: In function 'apparmor_inet_conn_request':
-   security/apparmor/lsm.c:1949:63: error: 'struct sk_buff' has no member 
named 'secmark'; did you mean 'mark'?
-   security/apparmor/lsm.c: In function 'apparmor_ip_postroute':
-   security/apparmor/lsm.c:1975:44: error: 'struct sk_buff' has no member 
named 'secmark'; did you mean 'mark'?
-   security/apparmor/lsm.c:1994:48: error: 'struct sk_buff' has no member 
named 'secmark'; did you mean 'mark'?
-   security/apparmor/lsm.c: In function 'apparmor_ip_localout':
-   security/apparmor/lsm.c:2066:14: error: 'struct sk_buff' has no member 
named 'secmark'; did you mean 'mark'?
-   security/apparmor/lsm.c:1965:21: warning: 'apparmor_ip_postroute' defined 
but not used [-Wunused-function]
-   cc1: some warnings being treated as errors
-   make[4]: *** [scripts/Makefile.build:289: security/apparmor/lsm.o] Error 1
-   security/apparmor/af_inet.c: In function '__profile_skb_perm':
-   security/apparmor/af_inet.c:1367:52: error: 'const struct sk_buff' has no 
member named 'secmark'; did you mean 'mark'?
-   security/apparmor/af_inet.c: In function '__aa_sock_rcv_skb':
-   security/apparmor/af_inet.c:1417:43: error: 'const struct sk_buff' has no 
member named 'secmark'; did you mean 'mark'?
-   security/apparmor/af_inet.c: In function '__aa_inet_conn_request':
-   security/apparmor/af_inet.c:1451:43: error: 'const struct sk_buff' has no 
member named 'secmark'; did you mean 'mark'?
-   security/apparmor/af_inet.c: In function '__aa_ip_postroute':
-   security/apparmor/af_inet.c:1485:43: error: 'const struct sk_buff' has no 
member named 'secmark'; did you mean 'mark'?
+ ```
+ security/apparmor/lsm.c: In function 'apparmor_socket_sock_rcv_skb':
+ security/apparmor/lsm.c:1907:14: error: implicit declaration of function 
'aa_secmark_enabled' [-Werror=implicit-function-declaration]
+  1907 |         if (!aa_secmark_enabled())
+       |              ^~~~~~~~~~~~~~~~~~
+ security/apparmor/lsm.c:1921:63: error: 'struct sk_buff' has no member named 
'secmark'; did you mean 'mark'?
+  1921 |         if (label_mediates(label, AA_CLASS_NETV9_SKB) || skb->secmark)
+       |                                                               ^~~~~~~
+       |                                                               mark
+ security/apparmor/lsm.c: In function 'apparmor_inet_conn_request':
+ security/apparmor/lsm.c:1949:63: error: 'struct sk_buff' has no member named 
'secmark'; did you mean 'mark'?
+  1949 |         if (label_mediates(label, AA_CLASS_NETV9_SKB) || skb->secmark)
+       |                                                               ^~~~~~~
+       |                                                               mark
+ security/apparmor/lsm.c: In function 'apparmor_ip_postroute':
+ security/apparmor/lsm.c:1975:44: error: 'struct sk_buff' has no member named 
'secmark'; did you mean 'mark'?
+  1975 |         if (!aa_secmark_enabled() || !skb->secmark)
+       |                                            ^~~~~~~
+       |                                            mark
+ security/apparmor/lsm.c:1994:48: error: 'struct sk_buff' has no member named 
'secmark'; did you mean 'mark'?
+  1994 |                 label = aa_secid_to_label(skb->secmark); /* may be 
NULL */
+       |                                                ^~~~~~~
+       |                                                mark
+ security/apparmor/lsm.c: In function 'apparmor_ip_localout':
+ security/apparmor/lsm.c:2066:14: error: 'struct sk_buff' has no member named 
'secmark'; did you mean 'mark'?
+  2066 |         skb->secmark = out->secid;
+       |              ^~~~~~~
+       |              mark
+ security/apparmor/lsm.c: At top level:
+ security/apparmor/lsm.c:1965:21: warning: 'apparmor_ip_postroute' defined but 
not used [-Wunused-function]
+  1965 | static unsigned int apparmor_ip_postroute(void *priv,
+       |                     ^~~~~~~~~~~~~~~~~~~~~
+ cc1: some warnings being treated as errors
+ make[4]: *** [scripts/Makefile.build:289: security/apparmor/lsm.o] Error 1
+ make[4]: *** Waiting for unfinished jobs....
+ security/apparmor/af_inet.c: In function 'match_addr_iface':
+ security/apparmor/af_inet.c:1199:20: warning: unused variable 'tmp' 
[-Wunused-variable]
+  1199 |         aa_state_t tmp = state;
+       |                    ^~~
+ security/apparmor/af_inet.c: In function '__profile_skb_perm':
+ security/apparmor/af_inet.c:1367:52: error: 'const struct sk_buff' has no 
member named 'secmark'; did you mean 'mark'?
+  1367 |                                               skb->secmark, sk);
+       |                                                    ^~~~~~~
+       |                                                    mark
+ security/apparmor/af_inet.c: In function '__aa_sock_rcv_skb':
+ security/apparmor/af_inet.c:1417:43: error: 'const struct sk_buff' has no 
member named 'secmark'; did you mean 'mark'?
+  1417 |         seclabel = aa_secid_to_label(skb->secmark); /* may be NULL */
+       |                                           ^~~~~~~
+       |                                           mark
+ security/apparmor/af_inet.c: In function '__aa_inet_conn_request':
+ security/apparmor/af_inet.c:1451:43: error: 'const struct sk_buff' has no 
member named 'secmark'; did you mean 'mark'?
+  1451 |         seclabel = aa_secid_to_label(skb->secmark); /* may be NULL */
+       |                                           ^~~~~~~
+       |                                           mark
+ security/apparmor/af_inet.c: In function '__aa_ip_postroute':
+ security/apparmor/af_inet.c:1485:43: error: 'const struct sk_buff' has no 
member named 'secmark'; did you mean 'mark'?
+  1485 |         seclabel = aa_secid_to_label(skb->secmark); /* may be NULL */
+       |                                           ^~~~~~~
+       |                                           mark
+ ```
  
  Enabling CONFIG_SECURITY_SELINUX or CONFIG_NETWORK_SECMARK lets the
  build complete.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2174761

Title:
  resolute/linux: apparmor: kernel fails to build with
  CONFIG_NETWORK_SECMARK=n

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2174761/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to