From patchwork Thu Oct 11 12:35:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Carter X-Patchwork-Id: 10636609 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5932E16B1 for ; Thu, 11 Oct 2018 12:37:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E6452B461 for ; Thu, 11 Oct 2018 12:37:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 429152B469; Thu, 11 Oct 2018 12:37:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from USFB19PA12.eemsg.mail.mil (uphb19pa09.eemsg.mail.mil [214.24.26.83]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA256 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6B6A42B45A for ; Thu, 11 Oct 2018 12:37:29 +0000 (UTC) X-EEMSG-check-008: 222198996|USFB19PA12_EEMSG_MP8.csd.disa.mil Received: from emsm-gh1-uea10.ncsc.mil ([214.29.60.2]) by USFB19PA12.eemsg.mail.mil with ESMTP; 11 Oct 2018 12:37:28 +0000 X-IronPort-AV: E=Sophos;i="5.54,368,1534809600"; d="scan'208";a="16722933" IronPort-PHdr: 9a23:tZAXXRw0bveI3oTXCy+O+j09IxM/srCxBDY+r6Qd1uoVKvad9pjvdHbS+e9qxAeQG9mDtLQc06L/iOPJYSQ4+5GPsXQPItRndiQuroEopTEmG9OPEkbhLfTnPGQQFcVGU0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xc78woDlaeVXPkQBWQKv0pqAPihEdUd94vk9MH3i8OGQg6DrbBuxpi/yKBfgU9CiDZrIBXl8uMS5kRR6xnpJ0dOiHh/dC50FPmy5m6NMjySBrXlPouzLnrrgRgxo86bq4s3MHonUDQeKAxXSbQW5fxegH2P9PQ03p7kaxNTxZNIY= X-IPAS-Result: A2AuAABbQ79b/wHyM5BiGgEBAQEBAgEBAQEHAgEBAQGBVAIBAQEBCwGBWSqBZSiMaotXTAEBAQEBAQaKNYkXhH2BYikTAYkXITcKDQEDAQEBAQEBAgFsKII2JIJgAwMBAjcUIAsDAwkBAUAICAMBLRURDgsFGASCQD+BdQ2nT4R3hGKHJYQggRCBB4ESh10BEgGFdwKBKAGHOIYSjx0GA5BJCxeQESyXPiJkcSsIAhgpSoEegU6CJheONFN7AQGJJoI+AQE Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by EMSM-GH1-UEA10.NCSC.MIL with ESMTP; 11 Oct 2018 12:37:27 +0000 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id w9BCbQBp028218; Thu, 11 Oct 2018 08:37:27 -0400 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id w9BCZNs3030954 for ; Thu, 11 Oct 2018 08:35:23 -0400 Received: from moss-lions.infosec.tycho.ncsc.mil (moss-lions [192.168.25.4]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id w9BCZNWp028160; Thu, 11 Oct 2018 08:35:23 -0400 From: James Carter To: selinux@vger.kernel.org Date: Thu, 11 Oct 2018 08:35:46 -0400 Message-Id: <20181011123549.14875-2-jwcart2@tycho.nsa.gov> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181011123549.14875-1-jwcart2@tycho.nsa.gov> References: <20181011123549.14875-1-jwcart2@tycho.nsa.gov> Subject: [PATCH 1/4] libsepol: Rename kernel_to_common.c stack functions X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: Cc: selinux@tycho.nsa.gov MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP Want to make use of selinux_sid_to_str[] and xen_sid_to_str[] from kernel_to_common.h in module_to_cil.c, but stack functions with the same names exist in module_to_cil.c and kernel_to_common.c (with the function prototypes in kernel_to_common.h). Since the stack functions in kernel_to_common.c are less general and only work with strings, rename those functions from stack_* to strs_stack_*. Signed-off-by: James Carter --- libsepol/src/kernel_to_cil.c | 36 ++++++++++++++++----------------- libsepol/src/kernel_to_common.c | 10 ++++----- libsepol/src/kernel_to_common.h | 10 ++++----- libsepol/src/kernel_to_conf.c | 36 ++++++++++++++++----------------- 4 files changed, 46 insertions(+), 46 deletions(-) diff --git a/libsepol/src/kernel_to_cil.c b/libsepol/src/kernel_to_cil.c index b1eb66d6..c2a733ee 100644 --- a/libsepol/src/kernel_to_cil.c +++ b/libsepol/src/kernel_to_cil.c @@ -36,7 +36,7 @@ static char *cond_expr_to_str(struct policydb *pdb, struct cond_expr *expr) char *str = NULL; int rc; - rc = stack_init(&stack); + rc = strs_stack_init(&stack); if (rc != 0) { goto exit; } @@ -65,13 +65,13 @@ static char *cond_expr_to_str(struct policydb *pdb, struct cond_expr *expr) } if (num_params == 2) { - val2 = stack_pop(stack); + val2 = strs_stack_pop(stack); if (!val2) { sepol_log_err("Invalid conditional expression"); goto exit; } } - val1 = stack_pop(stack); + val1 = strs_stack_pop(stack); if (!val1) { sepol_log_err("Invalid conditional expression"); free(val2); @@ -89,29 +89,29 @@ static char *cond_expr_to_str(struct policydb *pdb, struct cond_expr *expr) sepol_log_err("Invalid conditional expression"); goto exit; } - rc = stack_push(stack, new_val); + rc = strs_stack_push(stack, new_val); if (rc != 0) { sepol_log_err("Out of memory"); goto exit; } } - new_val = stack_pop(stack); - if (!new_val || !stack_empty(stack)) { + new_val = strs_stack_pop(stack); + if (!new_val || !strs_stack_empty(stack)) { sepol_log_err("Invalid conditional expression"); goto exit; } str = new_val; - stack_destroy(&stack); + strs_stack_destroy(&stack); return str; exit: - while ((new_val = stack_pop(stack)) != NULL) { + while ((new_val = strs_stack_pop(stack)) != NULL) { free(new_val); } - stack_destroy(&stack); + strs_stack_destroy(&stack); return NULL; } @@ -127,7 +127,7 @@ static char *constraint_expr_to_str(struct policydb *pdb, struct constraint_expr *use_mls = 0; - rc = stack_init(&stack); + rc = strs_stack_init(&stack); if (rc != 0) { goto exit; } @@ -208,13 +208,13 @@ static char *constraint_expr_to_str(struct policydb *pdb, struct constraint_expr } if (num_params == 2) { - val2 = stack_pop(stack); + val2 = strs_stack_pop(stack); if (!val2) { sepol_log_err("Invalid constraint expression"); goto exit; } } - val1 = stack_pop(stack); + val1 = strs_stack_pop(stack); if (!val1) { sepol_log_err("Invalid constraint expression"); goto exit; @@ -231,30 +231,30 @@ static char *constraint_expr_to_str(struct policydb *pdb, struct constraint_expr if (!new_val) { goto exit; } - rc = stack_push(stack, new_val); + rc = strs_stack_push(stack, new_val); if (rc != 0) { sepol_log_err("Out of memory"); goto exit; } } - new_val = stack_pop(stack); - if (!new_val || !stack_empty(stack)) { + new_val = strs_stack_pop(stack); + if (!new_val || !strs_stack_empty(stack)) { sepol_log_err("Invalid constraint expression"); goto exit; } str = new_val; - stack_destroy(&stack); + strs_stack_destroy(&stack); return str; exit: - while ((new_val = stack_pop(stack)) != NULL) { + while ((new_val = strs_stack_pop(stack)) != NULL) { free(new_val); } - stack_destroy(&stack); + strs_stack_destroy(&stack); return NULL; } diff --git a/libsepol/src/kernel_to_common.c b/libsepol/src/kernel_to_common.c index 7c5699c5..891e139c 100644 --- a/libsepol/src/kernel_to_common.c +++ b/libsepol/src/kernel_to_common.c @@ -400,27 +400,27 @@ exit: return str; } -int stack_init(struct strs **stack) +int strs_stack_init(struct strs **stack) { return strs_init(stack, STACK_SIZE); } -void stack_destroy(struct strs **stack) +void strs_stack_destroy(struct strs **stack) { return strs_destroy(stack); } -int stack_push(struct strs *stack, char *s) +int strs_stack_push(struct strs *stack, char *s) { return strs_add(stack, s); } -char *stack_pop(struct strs *stack) +char *strs_stack_pop(struct strs *stack) { return strs_remove_last(stack); } -int stack_empty(struct strs *stack) +int strs_stack_empty(struct strs *stack) { return strs_num_items(stack) == 0; } diff --git a/libsepol/src/kernel_to_common.h b/libsepol/src/kernel_to_common.h index 992929ae..7c5edbd6 100644 --- a/libsepol/src/kernel_to_common.h +++ b/libsepol/src/kernel_to_common.h @@ -105,10 +105,10 @@ int hashtab_ordered_to_strs(char *key, void *data, void *args); int ebitmap_to_strs(struct ebitmap *map, struct strs *strs, char **val_to_name); char *ebitmap_to_str(struct ebitmap *map, char **val_to_name, int sort); -int stack_init(struct strs **stack); -void stack_destroy(struct strs **stack); -int stack_push(struct strs *stack, char *s); -char *stack_pop(struct strs *stack); -int stack_empty(struct strs *stack); +int strs_stack_init(struct strs **stack); +void strs_stack_destroy(struct strs **stack); +int strs_stack_push(struct strs *stack, char *s); +char *strs_stack_pop(struct strs *stack); +int strs_stack_empty(struct strs *stack); int sort_ocontexts(struct policydb *pdb); diff --git a/libsepol/src/kernel_to_conf.c b/libsepol/src/kernel_to_conf.c index 95405207..a98b5ca9 100644 --- a/libsepol/src/kernel_to_conf.c +++ b/libsepol/src/kernel_to_conf.c @@ -35,7 +35,7 @@ static char *cond_expr_to_str(struct policydb *pdb, struct cond_expr *expr) char *str = NULL; int rc; - rc = stack_init(&stack); + rc = strs_stack_init(&stack); if (rc != 0) { goto exit; } @@ -63,13 +63,13 @@ static char *cond_expr_to_str(struct policydb *pdb, struct cond_expr *expr) } if (num_params == 2) { - val2 = stack_pop(stack); + val2 = strs_stack_pop(stack); if (!val2) { sepol_log_err("Invalid conditional expression"); goto exit; } } - val1 = stack_pop(stack); + val1 = strs_stack_pop(stack); if (!val1) { sepol_log_err("Invalid conditional expression"); free(val2); @@ -87,29 +87,29 @@ static char *cond_expr_to_str(struct policydb *pdb, struct cond_expr *expr) sepol_log_err("Invalid conditional expression"); goto exit; } - rc = stack_push(stack, new_val); + rc = strs_stack_push(stack, new_val); if (rc != 0) { sepol_log_err("Out of memory"); goto exit; } } - new_val = stack_pop(stack); - if (!new_val || !stack_empty(stack)) { + new_val = strs_stack_pop(stack); + if (!new_val || !strs_stack_empty(stack)) { sepol_log_err("Invalid conditional expression"); goto exit; } str = new_val; - stack_destroy(&stack); + strs_stack_destroy(&stack); return str; exit: - while ((new_val = stack_pop(stack)) != NULL) { + while ((new_val = strs_stack_pop(stack)) != NULL) { free(new_val); } - stack_destroy(&stack); + strs_stack_destroy(&stack); return NULL; } @@ -125,7 +125,7 @@ static char *constraint_expr_to_str(struct policydb *pdb, struct constraint_expr *use_mls = 0; - rc = stack_init(&stack); + rc = strs_stack_init(&stack); if (rc != 0) { goto exit; } @@ -204,13 +204,13 @@ static char *constraint_expr_to_str(struct policydb *pdb, struct constraint_expr } if (num_params == 2) { - val2 = stack_pop(stack); + val2 = strs_stack_pop(stack); if (!val2) { sepol_log_err("Invalid constraint expression"); goto exit; } } - val1 = stack_pop(stack); + val1 = strs_stack_pop(stack); if (!val1) { sepol_log_err("Invalid constraint expression"); goto exit; @@ -227,30 +227,30 @@ static char *constraint_expr_to_str(struct policydb *pdb, struct constraint_expr if (!new_val) { goto exit; } - rc = stack_push(stack, new_val); + rc = strs_stack_push(stack, new_val); if (rc != 0) { sepol_log_err("Out of memory"); goto exit; } } - new_val = stack_pop(stack); - if (!new_val || !stack_empty(stack)) { + new_val = strs_stack_pop(stack); + if (!new_val || !strs_stack_empty(stack)) { sepol_log_err("Invalid constraint expression"); goto exit; } str = new_val; - stack_destroy(&stack); + strs_stack_destroy(&stack); return str; exit: - while ((new_val = stack_pop(stack)) != NULL) { + while ((new_val = strs_stack_pop(stack)) != NULL) { free(new_val); } - stack_destroy(&stack); + strs_stack_destroy(&stack); return NULL; } From patchwork Thu Oct 11 12:35:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Carter X-Patchwork-Id: 10636611 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 50A745CAF for ; Thu, 11 Oct 2018 12:37:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 469272B2F8 for ; Thu, 11 Oct 2018 12:37:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AAC92B44F; Thu, 11 Oct 2018 12:37:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from USFB19PA12.eemsg.mail.mil (uphb19pa09.eemsg.mail.mil [214.24.26.83]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA256 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6D1AF2B462 for ; Thu, 11 Oct 2018 12:37:32 +0000 (UTC) X-EEMSG-check-008: 222199042|USFB19PA12_EEMSG_MP8.csd.disa.mil Received: from emsm-gh1-uea10.ncsc.mil ([214.29.60.2]) by USFB19PA12.eemsg.mail.mil with ESMTP; 11 Oct 2018 12:37:31 +0000 X-IronPort-AV: E=Sophos;i="5.54,368,1534809600"; d="scan'208";a="16722943" IronPort-PHdr: 9a23:fHP2ZRz/pLjINjLXCy+O+j09IxM/srCxBDY+r6Qd1uoVKvad9pjvdHbS+e9qxAeQG9mDtLQc06L/iOPJYSQ4+5GPsXQP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ThFvSL7tpVuZW/geZN54R/PFtHxV7phgK6AXNliHuJPqtitIqEwxAAIxc78woDlaeVXPkQBWQKv0pqAPihEdUd94vk9MH3i8OGQg6DrbBuxpi/yKBfgU9CiDZrIBXl8uMS5kRR6xnpJ0dOiHh/dC50FPmy5m6NMjySBrXlPouzLnrrgRgxo86bq4s3MHonUDQeKAxXSbQW5fxegH2P9PQ03p7kaxNTxZNIY= X-IPAS-Result: A2AQAgBbQ79b/wHyM5BiGwEBAQEDAQEBBwMBAQGBZYFaKoFlKIxqi1dMAQEBAQEBBoo1jhSBXS4TAYkXITgWAQMBAQEBAQECAWwogjYkgmADAwECNxQgCwMDCQEBQAgIAwEtFREOCwUYBIJAP4F1DadPhHeEYoclhCCBEIEHgRKCZIR5ARIBB2WFCwKBKAGHOIYSjx0GA5BJCxeQESyXPyFkcSsIAhgpSoEegU6CJhcRjiNTewEBiSaCPgEB Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by EMSM-GH1-UEA10.NCSC.MIL with ESMTP; 11 Oct 2018 12:37:30 +0000 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id w9BCbTho028228; Thu, 11 Oct 2018 08:37:30 -0400 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id w9BCZOir030957 for ; Thu, 11 Oct 2018 08:35:24 -0400 Received: from moss-lions.infosec.tycho.ncsc.mil (moss-lions [192.168.25.4]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id w9BCZNWq028160; Thu, 11 Oct 2018 08:35:23 -0400 From: James Carter To: selinux@vger.kernel.org Date: Thu, 11 Oct 2018 08:35:47 -0400 Message-Id: <20181011123549.14875-3-jwcart2@tycho.nsa.gov> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181011123549.14875-1-jwcart2@tycho.nsa.gov> References: <20181011123549.14875-1-jwcart2@tycho.nsa.gov> Subject: [PATCH 2/4] libsepol: Eliminate initial sid string definitions in module_to_cil.c X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: Cc: selinux@tycho.nsa.gov MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP Since the initial sid strings are defined in kernel_to_common.h, module_to_cil.c can use those and its initial sid string definitions can be removed. Signed-off-by: James Carter --- libsepol/src/module_to_cil.c | 59 +++--------------------------------- 1 file changed, 5 insertions(+), 54 deletions(-) diff --git a/libsepol/src/module_to_cil.c b/libsepol/src/module_to_cil.c index dcf6ebb1..8ab0dfce 100644 --- a/libsepol/src/module_to_cil.c +++ b/libsepol/src/module_to_cil.c @@ -52,6 +52,7 @@ #include #include +#include "kernel_to_common.h" #include "private.h" #ifdef __GNUC__ @@ -2546,7 +2547,8 @@ static int context_to_cil(struct policydb *pdb, struct context_struct *con) return 0; } -static int ocontext_isid_to_cil(struct policydb *pdb, const char **sid_to_string, struct ocontext *isids) +static int ocontext_isid_to_cil(struct policydb *pdb, const char *const *sid_to_string, + struct ocontext *isids) { int rc = -1; @@ -2602,41 +2604,7 @@ static int ocontext_selinux_isid_to_cil(struct policydb *pdb, struct ocontext *i { int rc = -1; - // initial sid names aren't actually stored in the pp files, need to a have - // a mapping, taken from the linux kernel - static const char *selinux_sid_to_string[] = { - "null", - "kernel", - "security", - "unlabeled", - "fs", - "file", - "file_labels", - "init", - "any_socket", - "port", - "netif", - "netmsg", - "node", - "igmp_packet", - "icmp_socket", - "tcp_socket", - "sysctl_modprobe", - "sysctl", - "sysctl_fs", - "sysctl_kernel", - "sysctl_net", - "sysctl_net_unix", - "sysctl_vm", - "sysctl_dev", - "kmod", - "policy", - "scmp_packet", - "devnull", - NULL - }; - - rc = ocontext_isid_to_cil(pdb, selinux_sid_to_string, isids); + rc = ocontext_isid_to_cil(pdb, selinux_sid_to_str, isids); if (rc != 0) { goto exit; } @@ -2865,24 +2833,7 @@ static int ocontext_xen_isid_to_cil(struct policydb *pdb, struct ocontext *isids { int rc = -1; - // initial sid names aren't actually stored in the pp files, need to a have - // a mapping, taken from the xen kernel - static const char *xen_sid_to_string[] = { - "null", - "xen", - "dom0", - "domio", - "domxen", - "unlabeled", - "security", - "ioport", - "iomem", - "irq", - "device", - NULL, - }; - - rc = ocontext_isid_to_cil(pdb, xen_sid_to_string, isids); + rc = ocontext_isid_to_cil(pdb, xen_sid_to_str, isids); if (rc != 0) { goto exit; } From patchwork Thu Oct 11 12:35:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Carter X-Patchwork-Id: 10636613 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 93DBD5CAF for ; Thu, 11 Oct 2018 12:37:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8861F2B2F8 for ; Thu, 11 Oct 2018 12:37:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A07C2B45D; Thu, 11 Oct 2018 12:37:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from USFB19PA13.eemsg.mail.mil (uphb19pa10.eemsg.mail.mil [214.24.26.84]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA256 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 71C962B2F8 for ; Thu, 11 Oct 2018 12:37:37 +0000 (UTC) X-EEMSG-check-008: 202772345|USFB19PA13_EEMSG_MP9.csd.disa.mil Received: from emsm-gh1-uea11.ncsc.mil ([214.29.60.3]) by USFB19PA13.eemsg.mail.mil with ESMTP; 11 Oct 2018 12:37:35 +0000 X-IronPort-AV: E=Sophos;i="5.54,368,1534809600"; d="scan'208";a="19290138" IronPort-PHdr: 9a23:XIQ+8hLfuGQ8BQctIdmcpTZWNBhigK39O0sv0rFitYgTKv/7rarrMEGX3/hxlliBBdydt6obzbKO+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZLebxlKiTanfb9+MAi9oBnMuMURnYZsMLs6xAHTontPdeRWxGdoKkyWkh3h+Mq+/4Nt/jpJtf45+MFOTav1f6IjTbxFFzsmKHw65NfqtRbYUwSC4GYXX3gMnRpJBwjF6wz6Xov0vyDnuOdxxDWWMMvrRr86QzSi67pgRgHuhikJKjU19HjbhtJsgK5eph+quh5xzJPOYIyNNPRwYK3Tc9AdS2VDUMZfSjRBD4GhY4YBAOUOIelWoJfmp1YVsRuzBxOhCP/1xzNUmHP727Ax3eQ7EQHB2QwtB9YAv27RrNrrL6cZTP64w7PSzTXfcfxWwyr25Y/KchEvvf6DR6hwcdbPxUQ0CwPEjkmfqYziPz+P0OQNqHKU4/BvVeKolW4qsgd8qSWsyMc0koTFm40Yx1/e+Sh53Yo5P8O0RUFlbdK+DZddsTyROZFsTcM4WW5ovT43yrgBuZGmYicH0I8nxxvDa/yfdIiI/w7jWP6RIThmgHJlf6qyhwqo/ki6y+38S9K03ExWritFjtbMtncN2wbV6sebUfty4l2t2TOO1wDX8u1EIEY0mrTHK5M537I9mZUevV7DEyPrgkn6kqCbels+9uS18+jnZ6/ppp6YN496kAH+NaEul9SkAesmNggOXm6b+fmz1bH65kL5R6hKjvsqnabHq5DXPtgb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KjrT/EBCAsIQatMEJsrChx5bhlfvWL5N6srRAkWYBJtrd8A082r3zyg48Z89Uubm9T+3KonT71VMP/NYkCVsj8nPpOkPzvrUDygb+36ZawJ6wima0ZmCF+7w/fmQyNHTT14GGzQ5XJtdJDqD/wynQfG4lIvoUgOS9MDzhJM+dESNRn2+hqgFtbxMEeFYgCXhwjdeDpz1h+6Ss9e06mtYrF5HEIFo4hDeBaVfOIl7ORT/lsm2SUh8Bjf/dNvSdhUwpOqc3v0M7PlmN0vieY8bJQoJy7D/6XpSVAtuUr/2vk2CUOIXftRmTe3LrnFP5YJnMa8PM0CXpIb2oTdQtFA2HAgpZacrrjxUc0nBgAxYVqXvtb4elAQcS995uE5LGWK2Im4+4STIVbgGxJWWXecY9jSVU7wmTUplKGV9Tgmz1ZEofKGmzt5dtWYTvCp4reNi+DV8WBam8XnuuKkEwy560K2pvzUG/3peR6ORlDmeWgYL9+gDkapJUyWq0le7enRWKdGq7Q== X-IPAS-Result: A2B9AAAkQ79b/wHyM5BiGwEBAQEDAQEBBwMBAQGBVAMBAQELAYFZKoFlKIxqi1dMAQEBAQEBBoIviAaOFIFiKRMBiRchNwoNAQMBAQEBAQECAWwogjYkgmADAwECJBMUIAsDAwkBAUAICAMBLRURDgsFGASCQD+BdQ2nGzOEd4RihyWEIIEQgQeBEoJdB4R5ARIBhXcCgSgBjQpAjx0GA5BJCxeQEZdqImRxKwgCGClKgR6BToImF440U3sBAYkmgj4BAQ Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by emsm-gh1-uea11.NCSC.MIL with ESMTP; 11 Oct 2018 12:37:33 +0000 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id w9BCbWgq028240; Thu, 11 Oct 2018 08:37:33 -0400 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id w9BCZOTv030960 for ; Thu, 11 Oct 2018 08:35:24 -0400 Received: from moss-lions.infosec.tycho.ncsc.mil (moss-lions [192.168.25.4]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id w9BCZNWr028160; Thu, 11 Oct 2018 08:35:23 -0400 From: James Carter To: selinux@vger.kernel.org Date: Thu, 11 Oct 2018 08:35:48 -0400 Message-Id: <20181011123549.14875-4-jwcart2@tycho.nsa.gov> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181011123549.14875-1-jwcart2@tycho.nsa.gov> References: <20181011123549.14875-1-jwcart2@tycho.nsa.gov> Subject: [PATCH 3/4] libsepol: Check that initial sid indexes are within the valid range X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: Cc: selinux@tycho.nsa.gov MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP When writing CIL from a policy module or when writing CIL or policy.conf from a kernel binary policy, check that the initial sid index is within the valid range of the selinux_sid_to_str[] array (or xen_sid_to_str[] array for a XEN policy). If it is not, then create a unique name ("UNKNOWN"+index) for the initial sid. Signed-off-by: James Carter --- libsepol/src/kernel_to_cil.c | 42 +++++++++++++++++++++++++-------- libsepol/src/kernel_to_common.h | 4 ++++ libsepol/src/kernel_to_conf.c | 42 +++++++++++++++++++++++++-------- libsepol/src/module_to_cil.c | 25 ++++++++++++++------ 4 files changed, 86 insertions(+), 27 deletions(-) diff --git a/libsepol/src/kernel_to_cil.c b/libsepol/src/kernel_to_cil.c index c2a733ee..d173144e 100644 --- a/libsepol/src/kernel_to_cil.c +++ b/libsepol/src/kernel_to_cil.c @@ -529,23 +529,31 @@ exit: return rc; } -static int write_sids_to_cil(FILE *out, const char *const *sid_to_str, struct ocontext *isids) +static int write_sids_to_cil(FILE *out, const char *const *sid_to_str, + unsigned num_sids, struct ocontext *isids) { struct ocontext *isid; struct strs *strs; char *sid; char *prev; + char unknown[17]; unsigned i; int rc; - rc = strs_init(&strs, SECINITSID_NUM+1); + rc = strs_init(&strs, num_sids+1); if (rc != 0) { goto exit; } for (isid = isids; isid != NULL; isid = isid->next) { i = isid->sid[0]; - rc = strs_add_at_index(strs, (char *)sid_to_str[i], i); + if (i < num_sids) { + sid = (char *)sid_to_str[i]; + } else { + snprintf(unknown, 17, "%s%u", "UNKNOWN", i); + sid = strdup(unknown); + } + rc = strs_add_at_index(strs, sid, i); if (rc != 0) { goto exit; } @@ -577,6 +585,10 @@ static int write_sids_to_cil(FILE *out, const char *const *sid_to_str, struct oc sepol_printf(out, "))\n"); exit: + for (i=num_sids; itarget_platform == SEPOL_TARGET_SELINUX) { - rc = write_sids_to_cil(out, selinux_sid_to_str, pdb->ocontexts[0]); + rc = write_sids_to_cil(out, selinux_sid_to_str, SELINUX_SID_SZ, + pdb->ocontexts[0]); } else if (pdb->target_platform == SEPOL_TARGET_XEN) { - rc = write_sids_to_cil(out, xen_sid_to_str, pdb->ocontexts[0]); + rc = write_sids_to_cil(out, xen_sid_to_str, XEN_SID_SZ, + pdb->ocontexts[0]); } else { sepol_log_err("Unknown target platform: %i", pdb->target_platform); rc = -1; @@ -2479,11 +2493,12 @@ exit: return ctx; } -static int write_sid_context_rules_to_cil(FILE *out, struct policydb *pdb, const char *const *sid_to_str) +static int write_sid_context_rules_to_cil(FILE *out, struct policydb *pdb, const char *const *sid_to_str, unsigned num_sids) { struct ocontext *isid; struct strs *strs; - const char *sid; + char *sid; + char unknown[17]; char *ctx, *rule; unsigned i; int rc = -1; @@ -2495,7 +2510,13 @@ static int write_sid_context_rules_to_cil(FILE *out, struct policydb *pdb, const for (isid = pdb->ocontexts[0]; isid != NULL; isid = isid->next) { i = isid->sid[0]; - sid = sid_to_str[i]; + if (i < num_sids) { + sid = (char *)sid_to_str[i]; + } else { + snprintf(unknown, 17, "%s%u", "UNKNOWN", i); + sid = unknown; + } + ctx = context_to_str(pdb, &isid->context[0]); if (!ctx) { rc = -1; @@ -2531,7 +2552,8 @@ exit: static int write_selinux_isid_rules_to_cil(FILE *out, struct policydb *pdb) { - return write_sid_context_rules_to_cil(out, pdb, selinux_sid_to_str); + return write_sid_context_rules_to_cil(out, pdb, selinux_sid_to_str, + SELINUX_SID_SZ); } static int write_selinux_fsuse_rules_to_cil(FILE *out, struct policydb *pdb) @@ -2884,7 +2906,7 @@ exit: static int write_xen_isid_rules_to_cil(FILE *out, struct policydb *pdb) { - return write_sid_context_rules_to_cil(out, pdb, xen_sid_to_str); + return write_sid_context_rules_to_cil(out, pdb, xen_sid_to_str, XEN_SID_SZ); } static int write_xen_pirq_rules_to_cil(FILE *out, struct policydb *pdb) diff --git a/libsepol/src/kernel_to_common.h b/libsepol/src/kernel_to_common.h index 7c5edbd6..dacfe97e 100644 --- a/libsepol/src/kernel_to_common.h +++ b/libsepol/src/kernel_to_common.h @@ -43,6 +43,8 @@ static const char * const selinux_sid_to_str[] = { "devnull", }; +#define SELINUX_SID_SZ (sizeof(selinux_sid_to_str)/sizeof(selinux_sid_to_str[0])) + static const char * const xen_sid_to_str[] = { "null", "xen", @@ -57,6 +59,8 @@ static const char * const xen_sid_to_str[] = { "device", }; +#define XEN_SID_SZ (sizeof(xen_sid_to_str)/sizeof(xen_sid_to_str[0])) + static const uint32_t avtab_flavors[] = { AVTAB_ALLOWED, AVTAB_AUDITALLOW, diff --git a/libsepol/src/kernel_to_conf.c b/libsepol/src/kernel_to_conf.c index a98b5ca9..7e04a13b 100644 --- a/libsepol/src/kernel_to_conf.c +++ b/libsepol/src/kernel_to_conf.c @@ -428,22 +428,30 @@ static int write_class_decl_rules_to_conf(FILE *out, struct policydb *pdb) return 0; } -static int write_sids_to_conf(FILE *out, const char *const *sid_to_str, struct ocontext *isids) +static int write_sids_to_conf(FILE *out, const char *const *sid_to_str, + unsigned num_sids, struct ocontext *isids) { struct ocontext *isid; struct strs *strs; char *sid; + char unknown[17]; unsigned i; int rc; - rc = strs_init(&strs, SECINITSID_NUM+1); + rc = strs_init(&strs, num_sids+1); if (rc != 0) { goto exit; } for (isid = isids; isid != NULL; isid = isid->next) { i = isid->sid[0]; - rc = strs_add_at_index(strs, (char *)sid_to_str[i], i); + if (i < num_sids) { + sid = (char *)sid_to_str[i]; + } else { + snprintf(unknown, 17, "%s%u", "UNKNOWN", i); + sid = strdup(unknown); + } + rc = strs_add_at_index(strs, sid, i); if (rc != 0) { goto exit; } @@ -458,6 +466,10 @@ static int write_sids_to_conf(FILE *out, const char *const *sid_to_str, struct o } exit: + for (i=num_sids; itarget_platform == SEPOL_TARGET_SELINUX) { - rc = write_sids_to_conf(out, selinux_sid_to_str, pdb->ocontexts[0]); + rc = write_sids_to_conf(out, selinux_sid_to_str, SELINUX_SID_SZ, + pdb->ocontexts[0]); } else if (pdb->target_platform == SEPOL_TARGET_XEN) { - rc = write_sids_to_conf(out, xen_sid_to_str, pdb->ocontexts[0]); + rc = write_sids_to_conf(out, xen_sid_to_str, XEN_SID_SZ, + pdb->ocontexts[0]); } else { sepol_log_err("Unknown target platform: %i", pdb->target_platform); rc = -1; @@ -2339,11 +2353,12 @@ static char *context_to_str(struct policydb *pdb, struct context_struct *con) return ctx; } -static int write_sid_context_rules_to_conf(FILE *out, struct policydb *pdb, const char *const *sid_to_str) +static int write_sid_context_rules_to_conf(FILE *out, struct policydb *pdb, const char *const *sid_to_str, unsigned num_sids) { struct ocontext *isid; struct strs *strs; - const char *sid; + char *sid; + char unknown[17]; char *ctx, *rule; unsigned i; int rc; @@ -2355,7 +2370,13 @@ static int write_sid_context_rules_to_conf(FILE *out, struct policydb *pdb, cons for (isid = pdb->ocontexts[0]; isid != NULL; isid = isid->next) { i = isid->sid[0]; - sid = sid_to_str[i]; + if (i < num_sids) { + sid = (char *)sid_to_str[i]; + } else { + snprintf(unknown, 17, "%s%u", "UNKNOWN", i); + sid = unknown; + } + ctx = context_to_str(pdb, &isid->context[0]); if (!ctx) { rc = -1; @@ -2391,7 +2412,8 @@ exit: static int write_selinux_isid_rules_to_conf(FILE *out, struct policydb *pdb) { - return write_sid_context_rules_to_conf(out, pdb, selinux_sid_to_str); + return write_sid_context_rules_to_conf(out, pdb, selinux_sid_to_str, + SELINUX_SID_SZ); } static int write_selinux_fsuse_rules_to_conf(FILE *out, struct policydb *pdb) @@ -2745,7 +2767,7 @@ exit: static int write_xen_isid_rules_to_conf(FILE *out, struct policydb *pdb) { - return write_sid_context_rules_to_conf(out, pdb, xen_sid_to_str); + return write_sid_context_rules_to_conf(out, pdb, xen_sid_to_str, XEN_SID_SZ); } diff --git a/libsepol/src/module_to_cil.c b/libsepol/src/module_to_cil.c index 8ab0dfce..7fc29cbd 100644 --- a/libsepol/src/module_to_cil.c +++ b/libsepol/src/module_to_cil.c @@ -2548,23 +2548,33 @@ static int context_to_cil(struct policydb *pdb, struct context_struct *con) } static int ocontext_isid_to_cil(struct policydb *pdb, const char *const *sid_to_string, - struct ocontext *isids) + unsigned num_sids, struct ocontext *isids) { int rc = -1; struct ocontext *isid; struct sid_item { - const char *sid_key; + char *sid_key; struct sid_item *next; }; struct sid_item *head = NULL; struct sid_item *item = NULL; + char *sid; + char unknown[17]; + unsigned i; for (isid = isids; isid != NULL; isid = isid->next) { - cil_println(0, "(sid %s)", sid_to_string[isid->sid[0]]); - cil_printf("(sidcontext %s ", sid_to_string[isid->sid[0]]); + i = isid->sid[0]; + if (i < num_sids) { + sid = (char*)sid_to_string[i]; + } else { + snprintf(unknown, 17, "%s%u", "UNKNOWN", i); + sid = unknown; + } + cil_println(0, "(sid %s)", sid); + cil_printf("(sidcontext %s ", sid); context_to_cil(pdb, &isid->context[0]); cil_printf(")\n"); @@ -2576,7 +2586,7 @@ static int ocontext_isid_to_cil(struct policydb *pdb, const char *const *sid_to_ rc = -1; goto exit; } - item->sid_key = sid_to_string[isid->sid[0]]; + item->sid_key = strdup(sid); item->next = head; head = item; } @@ -2595,6 +2605,7 @@ exit: while(head) { item = head; head = item->next; + free(item->sid_key); free(item); } return rc; @@ -2604,7 +2615,7 @@ static int ocontext_selinux_isid_to_cil(struct policydb *pdb, struct ocontext *i { int rc = -1; - rc = ocontext_isid_to_cil(pdb, selinux_sid_to_str, isids); + rc = ocontext_isid_to_cil(pdb, selinux_sid_to_str, SELINUX_SID_SZ, isids); if (rc != 0) { goto exit; } @@ -2833,7 +2844,7 @@ static int ocontext_xen_isid_to_cil(struct policydb *pdb, struct ocontext *isids { int rc = -1; - rc = ocontext_isid_to_cil(pdb, xen_sid_to_str, isids); + rc = ocontext_isid_to_cil(pdb, xen_sid_to_str, XEN_SID_SZ, isids); if (rc != 0) { goto exit; } From patchwork Thu Oct 11 12:35:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Carter X-Patchwork-Id: 10636615 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E5F1216B1 for ; Thu, 11 Oct 2018 12:37:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9CE72B2F8 for ; Thu, 11 Oct 2018 12:37:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE13E2B45D; Thu, 11 Oct 2018 12:37:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from USFB19PA13.eemsg.mail.mil (uphb19pa10.eemsg.mail.mil [214.24.26.84]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA256 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 39E482B45B for ; Thu, 11 Oct 2018 12:37:39 +0000 (UTC) X-EEMSG-check-008: 202772390|USFB19PA13_EEMSG_MP9.csd.disa.mil Received: from emsm-gh1-uea11.ncsc.mil ([214.29.60.3]) by USFB19PA13.eemsg.mail.mil with ESMTP; 11 Oct 2018 12:37:38 +0000 X-IronPort-AV: E=Sophos;i="5.54,368,1534809600"; d="scan'208";a="19290148" IronPort-PHdr: 9a23:c8m6oxzkSD38rSbXCy+O+j09IxM/srCxBDY+r6Qd1uoVKvad9pjvdHbS+e9qxAeQG9mDtLQc06L/iOPJYSQ4+5GPsXQPItRndiQuroEopTEmG9OPEkbhLfTnPGQQFcVGU0J5rTngaRAGUMnxaEfPrXKs8DUcBgvwNRZvJuTyB4Xek9m72/q99pHPYQhEniaxba9vJxiqsAvdsdUbj5F/Iagr0BvJpXVIe+VSxWx2IF+Yggjx6MSt8pN96ipco/0u+dJOXqX8ZKQ4UKdXDC86PGAv5c3krgfMQA2S7XYBSGoWkx5IAw/Y7BHmW5r6ryX3uvZh1CScIMb5Q6o0WTC/5Kl1ThHmhjoMOzog/G3JlsB8iaRWqw+jqRNi2Y7ZeIGbOuRwcK3eet0VR2RBUNtJVyFDH4+xYYQAAPYOM+lGtInwvEcOoBmkCAWwHu7j1iFEi3nr1qM6yeQhFgTG0RQkEd0UtXTbss71P7oMXO+v1qnI0SvMb+lL0jr66ojJfAwuruuWXbJsb8bc0lUvFgPZgVWQrozpJTWV1v8XvGSB4OpgUvyvhnchpgpsoTav3t8hhpTGi48a0FzJ9Th1zJwrKdC3VkJ3e8OoHZ1NvC+ALYR2WNktQ2RwtSY/zb0JpIC0cTARyJQi2x7fc/uHc5WU4h77VOaePzN4hHV9dbKjnRmy60mgyvDnVsWuzFZLrjZKktnLtnwX0Rzc9tOHRedn8kek2DaP0xjf6uBCIU8qiarWM4Mtz7E/m5YJsUnPAzX6lFv5gaOIbEko5/Ck6+H9bbXnop+cOZV0igb7Mqk2gcywH+A4MgkIX2iG9uWwzabs/Urk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fLZ88HUKPy8eJ3YQMteNc/k85zViMC7P51xDHswMeckYM9TTlgxOjE3mRq1T/NLBGlCEE4dza9wo723vxTAx8Js8VPvg6TCvKZDb7lFNJO9DjD53mdLDvucVx/3SBDIQ4XmDZBh/2jmCxIWVC/bs4eWMz8nZV1YcESEqU4ddJTyC+Qu8S+qrlZXpVB2b6svygJI4aUKRSWa9nKMfsqZDCeRAkDn03iBCFoDpgPKYq9is53FUtl1AC4l+9gDFGKNDPpV7PhT4i8arRkhgBiflfsHbaAYusvKMxugQ++V+K1f+ZYgDLxIGzrL67mBVThFvSL7tpVuZW/geZN54R/PFtHxV7phgK6AXNliHuJPqtitIqEwxAAIxc78woDlaeVXPkQBWQKv0pqAPihEdUd94vk9MH3i8OGQg6DrbBuxpi/yKBfgU9CiDZrIBXl8uMS5kRR6xnpJ0dOiHh/dC50FPmy5m6NMjySBrXlPouzLnrrgRgxo86bq4s3MHonUDQeKAxXSbQW5fxegH2P9PQ03p7kaxNTxZNIY= X-IPAS-Result: A2B9AAAkQ79b/wHyM5BiGwEBAQEDAQEBBwMBAQGBVAMBAQELAYFZKoFlKIxqi1dMAQEBAQEBBoo1jhSBYSoTAYM/hVghNwoNAQMBAQEBAQECAWwogjYkgmADAwECNxQgCwMDCQEBQAgIAwEtFREOCwUYBIJAP4F1DadOhHeEYoclhCCBEIEHg3aEeQESAWyFCwKBKAGNSo8dBgOQSQsXkBGXaiJkcSsIAhgpSoEegU6QcVN7AQGJJoI+AQE Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by emsm-gh1-uea11.NCSC.MIL with ESMTP; 11 Oct 2018 12:37:37 +0000 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id w9BCbarb028251; Thu, 11 Oct 2018 08:37:37 -0400 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id w9BCZOHP030963 for ; Thu, 11 Oct 2018 08:35:24 -0400 Received: from moss-lions.infosec.tycho.ncsc.mil (moss-lions [192.168.25.4]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id w9BCZNWs028160; Thu, 11 Oct 2018 08:35:23 -0400 From: James Carter To: selinux@vger.kernel.org Date: Thu, 11 Oct 2018 08:35:49 -0400 Message-Id: <20181011123549.14875-5-jwcart2@tycho.nsa.gov> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181011123549.14875-1-jwcart2@tycho.nsa.gov> References: <20181011123549.14875-1-jwcart2@tycho.nsa.gov> Subject: [PATCH 4/4] libsepol: Add two new Xen initial SIDs X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: Cc: selinux@tycho.nsa.gov MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP Xen uses the initial SIDs domU and domDM in its toolstack, so it makes sense to add these to xen_sid_to_str[] in kernel_to_common.h Signed-off-by: James Carter --- libsepol/src/kernel_to_common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libsepol/src/kernel_to_common.h b/libsepol/src/kernel_to_common.h index dacfe97e..8aa483fa 100644 --- a/libsepol/src/kernel_to_common.h +++ b/libsepol/src/kernel_to_common.h @@ -57,6 +57,8 @@ static const char * const xen_sid_to_str[] = { "iomem", "irq", "device", + "domU", + "domDM", }; #define XEN_SID_SZ (sizeof(xen_sid_to_str)/sizeof(xen_sid_to_str[0]))