From patchwork Thu Jun 13 15:59:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Sm9ra2UgSMOkbcOkbMOkaW5lbg==?= X-Patchwork-Id: 10992609 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 C619713AF for ; Thu, 13 Jun 2019 15:59:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B534D2267B for ; Thu, 13 Jun 2019 15:59:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A990522B27; Thu, 13 Jun 2019 15:59:08 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 561DD23B24 for ; Thu, 13 Jun 2019 15:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732645AbfFMP7H (ORCPT ); Thu, 13 Jun 2019 11:59:07 -0400 Received: from 48.23.240.77.static.louhi.net ([77.240.23.48]:37830 "EHLO kolttonen.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731464AbfFMP7G (ORCPT ); Thu, 13 Jun 2019 11:59:06 -0400 Received: from 34-41-5D-CA-59-C7 (82-203-159-32.bb.dnainternet.fi [82.203.159.32]) (authenticated bits=0) by vcust561.louhi.net (8.14.7/8.14.7/0) with ESMTP id x5DFwTCR030721 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 13 Jun 2019 18:58:30 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 vcust561.louhi.net x5DFwTCR030721 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolttonen.fi; s=mail; t=1560441510; bh=kFIqmoF1y1FmmcCtfN0cG3SJeQ30V50WPy1BzAZ1ND8=; h=Date:From:To:Subject:From; b=0xAxUTEbr/NHASNu05SC8o8GfKLJJisv9NXUtgh65X5SnhUIVszGBVboWM8F71q91 SVuV6v+6aFKithbzKiTV70CWyEBmDoH6uiDFaSEG1P3L2UahB3mCcEk2lteU/6IW8E rtVoBb2OnJu1j4HGbObMjCRiNHNabJv6NNRzOwl1pagLejmIHArHskLqibeh33BeZE 17rynwU+E1eGEuJ+0v0fJidQ115Q036q4fFLrE9KMlyrkP295WeTgWvYQyXPIr217r yRGSi4VRW5H7x8X+N+XgJuPfn7L3IAJQLNzTFAPZa6tCtzTvJqz6vaPoDWVO0s5SiI glS5WMVsOKtKQ== Date: Thu, 13 Jun 2019 18:59:03 +0300 (EEST) From: =?iso-8859-15?q?Jokke_H=E4m=E4l=E4inen?= To: selinux@vger.kernel.org Subject: [PATCH 1/3] libsepol: more accurate error messages Message-ID: User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Sender: selinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When reporting errors, differetiate between source and target SIDs. Signed-off-by: Unto Sten --- libsepol/src/services.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libsepol/src/services.c b/libsepol/src/services.c index 303a138c..3758436f 100644 --- a/libsepol/src/services.c +++ b/libsepol/src/services.c @@ -1134,13 +1134,13 @@ int hidden sepol_compute_av_reason(sepol_security_id_t ssid, scontext = sepol_sidtab_search(sidtab, ssid); if (!scontext) { - ERR(NULL, "unrecognized SID %d", ssid); + ERR(NULL, "unrecognized source SID %d", ssid); rc = -EINVAL; goto out; } tcontext = sepol_sidtab_search(sidtab, tsid); if (!tcontext) { - ERR(NULL, "unrecognized SID %d", tsid); + ERR(NULL, "unrecognized target SID %d", tsid); rc = -EINVAL; goto out; } @@ -1170,13 +1170,13 @@ int hidden sepol_compute_av_reason_buffer(sepol_security_id_t ssid, scontext = sepol_sidtab_search(sidtab, ssid); if (!scontext) { - ERR(NULL, "unrecognized SID %d", ssid); + ERR(NULL, "unrecognized source SID %d", ssid); rc = -EINVAL; goto out; } tcontext = sepol_sidtab_search(sidtab, tsid); if (!tcontext) { - ERR(NULL, "unrecognized SID %d", tsid); + ERR(NULL, "unrecognized target SID %d", tsid); rc = -EINVAL; goto out; } From patchwork Thu Jun 13 15:59:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Sm9ra2UgSMOkbcOkbMOkaW5lbg==?= X-Patchwork-Id: 10992613 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 EF3E0924 for ; Thu, 13 Jun 2019 15:59:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF7B922ADC for ; Thu, 13 Jun 2019 15:59:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D437026223; Thu, 13 Jun 2019 15:59:58 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FCFA22ADC for ; Thu, 13 Jun 2019 15:59:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729212AbfFMP75 (ORCPT ); Thu, 13 Jun 2019 11:59:57 -0400 Received: from 48.23.240.77.static.louhi.net ([77.240.23.48]:37850 "EHLO kolttonen.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731602AbfFMP7k (ORCPT ); Thu, 13 Jun 2019 11:59:40 -0400 Received: from 34-41-5D-CA-59-C7 (82-203-159-32.bb.dnainternet.fi [82.203.159.32]) (authenticated bits=0) by vcust561.louhi.net (8.14.7/8.14.7/0) with ESMTP id x5DFx35q030732 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 13 Jun 2019 18:59:04 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 vcust561.louhi.net x5DFx35q030732 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolttonen.fi; s=mail; t=1560441544; bh=6cr3IMvqiRwzVFxhQr3QxeiexnFljXbYmJGvD9nd2h4=; h=Date:From:To:Subject:From; b=h/QxzUGvu9uGgbFHCqOkAX4ic9EVh8Eik4BlvDiWYatkG/4eclv1ZwQPW6ghFRIXn VBMzUETrkSpSqUrxkpxE70gkbMDIi3tPPtCAmQgUjKvzuUUqjEYELPx978XQWtQsr1 GJkKOT4iBeQ/xIqG4cuOLwUdoe4kuSTOBtFCObh8NmSFMBK4Pl5TuPeodr/brBKqsY 1vZgFhQEWR93OP6Zqy+f2YjovNnM2KijRmXhpOsYtztiQJyefu74zYtAmhuAST3cyQ bx4L0NMVKDWwp3DUmYHAACh/Qwq29/faBdlkV5hxVJdwJW1JJiVmBvXJckKyJLPb5r lBewltJGEbfmg== Date: Thu, 13 Jun 2019 18:59:37 +0300 (EEST) From: =?iso-8859-15?q?Jokke_H=E4m=E4l=E4inen?= To: selinux@vger.kernel.org Subject: [PATCH 2/3] checkpolicy: remove redundant if-clause Message-ID: User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Sender: selinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Remove redundant if-clause because the check already has been done earlier. Signed-off-by: Unto Sten --- checkpolicy/parse_util.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/checkpolicy/parse_util.c b/checkpolicy/parse_util.c index 9fda5b42..f2809b48 100644 --- a/checkpolicy/parse_util.c +++ b/checkpolicy/parse_util.c @@ -69,9 +69,6 @@ int read_source_policy(policydb_t * p, const char *file, const char *progname) } queue_destroy(id_queue); - if (policydb_errors) - return -1; - fclose(yyin); return 0; From patchwork Thu Jun 13 16:00:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Sm9ra2UgSMOkbcOkbMOkaW5lbg==?= X-Patchwork-Id: 10992619 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 CFAF013AD for ; Thu, 13 Jun 2019 16:00:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0514212BE for ; Thu, 13 Jun 2019 16:00:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B497D206AF; Thu, 13 Jun 2019 16:00:22 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64C9220881 for ; Thu, 13 Jun 2019 16:00:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730250AbfFMQAV (ORCPT ); Thu, 13 Jun 2019 12:00:21 -0400 Received: from 48.23.240.77.static.louhi.net ([77.240.23.48]:37868 "EHLO kolttonen.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728066AbfFMQAU (ORCPT ); Thu, 13 Jun 2019 12:00:20 -0400 Received: from 34-41-5D-CA-59-C7 (82-203-159-32.bb.dnainternet.fi [82.203.159.32]) (authenticated bits=0) by vcust561.louhi.net (8.14.7/8.14.7/0) with ESMTP id x5DFxiNN030743 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 13 Jun 2019 18:59:45 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 vcust561.louhi.net x5DFxiNN030743 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolttonen.fi; s=mail; t=1560441585; bh=7esMgPpTrLfZWdE5aLB3vP85piPp/kAwX3li/gGK5Dw=; h=Date:From:To:Subject:From; b=gCvh3J4yd1YDscIio0TR20gmKs9iKwBA1QDIu4TBDlY1OR4edzrfj85iKpyQwCnkE vxVE9UQK5F6m2uvYEo9XIizmObVb3cAIwpsZPXRfjXpCqxtA4UossV4oEwQK5iY4t1 rtFx2EY4JcDbHcm4JCK8Epr8Ecre5Dqul6BLB896qZB36EqonXIJLkdsLJ3erTUUB/ K9+pNZO/HoCp+ocH/6D3T7Uh97Re6OdpYca6tVCtq23BXgVmztLTW9XS89U4nZYcT5 dOZrBDLTM1lPC+OmyHkBp+yGXDkPiQ2chUlz8P1nZyDZuFqXYWv/edBOnhjPRpbt1V K2PrQIS6jwaLg== Date: Thu, 13 Jun 2019 19:00:18 +0300 (EEST) From: =?iso-8859-15?q?Jokke_H=E4m=E4l=E4inen?= To: selinux@vger.kernel.org Subject: [PATCH 3/3] libsepol: remove unneeded int Message-ID: User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Sender: selinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Replace int ret with a constant 1 because it is only used when returning from function and is never modified. Signed-off-by: Unto Sten --- libsepol/src/context.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libsepol/src/context.c b/libsepol/src/context.c index a88937fc..e81b28c6 100644 --- a/libsepol/src/context.c +++ b/libsepol/src/context.c @@ -38,7 +38,6 @@ int context_is_valid(const policydb_t * p, const context_struct_t * c) role_datum_t *role; user_datum_t *usrdatum; ebitmap_t types, roles; - int ret = 1; ebitmap_init(&types); ebitmap_init(&roles); @@ -75,7 +74,7 @@ int context_is_valid(const policydb_t * p, const context_struct_t * c) if (!mls_context_isvalid(p, c)) return 0; - return ret; + return 1; } /*