~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/netlabel/netlabel_user.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /net/netlabel/netlabel_user.c (Version linux-6.11.5) and /net/netlabel/netlabel_user.c (Version linux-5.5.19)


  1 // SPDX-License-Identifier: GPL-2.0-or-later        1 // SPDX-License-Identifier: GPL-2.0-or-later
  2 /*                                                  2 /*
  3  * NetLabel NETLINK Interface                       3  * NetLabel NETLINK Interface
  4  *                                                  4  *
  5  * This file defines the NETLINK interface for      5  * This file defines the NETLINK interface for the NetLabel system.  The
  6  * NetLabel system manages static and dynamic       6  * NetLabel system manages static and dynamic label mappings for network
  7  * protocols such as CIPSO and RIPSO.               7  * protocols such as CIPSO and RIPSO.
  8  *                                                  8  *
  9  * Author: Paul Moore <paul@paul-moore.com>         9  * Author: Paul Moore <paul@paul-moore.com>
 10  */                                                10  */
 11                                                    11 
 12 /*                                                 12 /*
 13  * (c) Copyright Hewlett-Packard Development C     13  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
 14  */                                                14  */
 15                                                    15 
 16 #include <linux/init.h>                            16 #include <linux/init.h>
 17 #include <linux/types.h>                           17 #include <linux/types.h>
 18 #include <linux/list.h>                            18 #include <linux/list.h>
 19 #include <linux/socket.h>                          19 #include <linux/socket.h>
 20 #include <linux/audit.h>                           20 #include <linux/audit.h>
 21 #include <linux/tty.h>                             21 #include <linux/tty.h>
 22 #include <linux/security.h>                        22 #include <linux/security.h>
 23 #include <linux/gfp.h>                             23 #include <linux/gfp.h>
 24 #include <net/sock.h>                              24 #include <net/sock.h>
 25 #include <net/netlink.h>                           25 #include <net/netlink.h>
 26 #include <net/genetlink.h>                         26 #include <net/genetlink.h>
 27 #include <net/netlabel.h>                          27 #include <net/netlabel.h>
 28 #include <asm/bug.h>                               28 #include <asm/bug.h>
 29                                                    29 
 30 #include "netlabel_mgmt.h"                         30 #include "netlabel_mgmt.h"
 31 #include "netlabel_unlabeled.h"                    31 #include "netlabel_unlabeled.h"
 32 #include "netlabel_cipso_v4.h"                     32 #include "netlabel_cipso_v4.h"
 33 #include "netlabel_calipso.h"                      33 #include "netlabel_calipso.h"
 34 #include "netlabel_user.h"                         34 #include "netlabel_user.h"
 35                                                    35 
 36 /*                                                 36 /*
 37  * NetLabel NETLINK Setup Functions                37  * NetLabel NETLINK Setup Functions
 38  */                                                38  */
 39                                                    39 
 40 /**                                                40 /**
 41  * netlbl_netlink_init - Initialize the NETLIN     41  * netlbl_netlink_init - Initialize the NETLINK communication channel
 42  *                                                 42  *
 43  * Description:                                    43  * Description:
 44  * Call out to the NetLabel components so they     44  * Call out to the NetLabel components so they can register their families and
 45  * commands with the Generic NETLINK mechanism     45  * commands with the Generic NETLINK mechanism.  Returns zero on success and
 46  * non-zero on failure.                            46  * non-zero on failure.
 47  *                                                 47  *
 48  */                                                48  */
 49 int __init netlbl_netlink_init(void)               49 int __init netlbl_netlink_init(void)
 50 {                                                  50 {
 51         int ret_val;                               51         int ret_val;
 52                                                    52 
 53         ret_val = netlbl_mgmt_genl_init();         53         ret_val = netlbl_mgmt_genl_init();
 54         if (ret_val != 0)                          54         if (ret_val != 0)
 55                 return ret_val;                    55                 return ret_val;
 56                                                    56 
 57         ret_val = netlbl_cipsov4_genl_init();      57         ret_val = netlbl_cipsov4_genl_init();
 58         if (ret_val != 0)                          58         if (ret_val != 0)
 59                 return ret_val;                    59                 return ret_val;
 60                                                    60 
 61         ret_val = netlbl_calipso_genl_init();      61         ret_val = netlbl_calipso_genl_init();
 62         if (ret_val != 0)                          62         if (ret_val != 0)
 63                 return ret_val;                    63                 return ret_val;
 64                                                    64 
 65         return netlbl_unlabel_genl_init();         65         return netlbl_unlabel_genl_init();
 66 }                                                  66 }
 67                                                    67 
 68 /*                                                 68 /*
 69  * NetLabel Audit Functions                        69  * NetLabel Audit Functions
 70  */                                                70  */
 71                                                    71 
 72 /**                                                72 /**
 73  * netlbl_audit_start_common - Start an audit      73  * netlbl_audit_start_common - Start an audit message
 74  * @type: audit message type                       74  * @type: audit message type
 75  * @audit_info: NetLabel audit information         75  * @audit_info: NetLabel audit information
 76  *                                                 76  *
 77  * Description:                                    77  * Description:
 78  * Start an audit message using the type speci     78  * Start an audit message using the type specified in @type and fill the audit
 79  * message with some fields common to all NetL     79  * message with some fields common to all NetLabel audit messages.  Returns
 80  * a pointer to the audit buffer on success, N     80  * a pointer to the audit buffer on success, NULL on failure.
 81  *                                                 81  *
 82  */                                                82  */
 83 struct audit_buffer *netlbl_audit_start_common     83 struct audit_buffer *netlbl_audit_start_common(int type,
 84                                                    84                                                struct netlbl_audit *audit_info)
 85 {                                                  85 {
 86         struct audit_buffer *audit_buf;            86         struct audit_buffer *audit_buf;
 87         char *secctx;                              87         char *secctx;
 88         u32 secctx_len;                            88         u32 secctx_len;
 89                                                    89 
 90         if (audit_enabled == AUDIT_OFF)            90         if (audit_enabled == AUDIT_OFF)
 91                 return NULL;                       91                 return NULL;
 92                                                    92 
 93         audit_buf = audit_log_start(audit_cont     93         audit_buf = audit_log_start(audit_context(), GFP_ATOMIC, type);
 94         if (audit_buf == NULL)                     94         if (audit_buf == NULL)
 95                 return NULL;                       95                 return NULL;
 96                                                    96 
 97         audit_log_format(audit_buf, "netlabel:     97         audit_log_format(audit_buf, "netlabel: auid=%u ses=%u",
 98                          from_kuid(&init_user_     98                          from_kuid(&init_user_ns, audit_info->loginuid),
 99                          audit_info->sessionid     99                          audit_info->sessionid);
100                                                   100 
101         if (audit_info->secid != 0 &&             101         if (audit_info->secid != 0 &&
102             security_secid_to_secctx(audit_inf    102             security_secid_to_secctx(audit_info->secid,
103                                      &secctx,     103                                      &secctx,
104                                      &secctx_l    104                                      &secctx_len) == 0) {
105                 audit_log_format(audit_buf, "     105                 audit_log_format(audit_buf, " subj=%s", secctx);
106                 security_release_secctx(secctx    106                 security_release_secctx(secctx, secctx_len);
107         }                                         107         }
108                                                   108 
109         return audit_buf;                         109         return audit_buf;
110 }                                                 110 }
111                                                   111 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php