Received: by 10.213.65.68 with SMTP id h4csp959533imn; Fri, 23 Mar 2018 22:43:35 -0700 (PDT) X-Google-Smtp-Source: AG47ELtVjBOS5F58CgXB1rmD7iITscwQN6S2FutBFTljCXZDSdU3Yby0YYiThOQM0uHNqs9v3v5J X-Received: by 2002:a17:902:a610:: with SMTP id u16-v6mr31793229plq.293.1521870215276; Fri, 23 Mar 2018 22:43:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521870215; cv=none; d=google.com; s=arc-20160816; b=IKqpjp0ubVDo++6IvdELhTbChuGhK4zsF6PpDH6T9b6Ljnhog4RxjQeIDRSIS+Doyu SClSaXrv6D732pb3NlfD2kGkhh+bhR4QCzav/plXBePVwpVAU8SjqV7FtmRKFFiHL/03 ENsTQtt+pq0P7Nx/NXNCYXeeCfXUioFm5C31skpTTjTTWCYo8wUqWiJ1VT+eFw4RUbAV snYhO0Oca+3UoxlfiJkofEwPmb4kKQusb+xToZqpKJM9lK8sQzOThX5H7ik531cjuKnN eUXn2F8tVkfzR2epHmnr7055vdNTZ96bSqNgqpvLG9XJQQsX6Txzgl7A0QotJFYnwf4y GGfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from :arc-authentication-results; bh=KDnD0QLKIbb6VF/9NM8wmJZ7sJVIhd8bJKhC2j5VNhU=; b=Pm8PQUUpVmZ86QKKLaDT4CfEev2Q/Q8hLGTr29uT7XSuOxbTMDbZhPkdzj3HUn16zq OZ+mdP1eTFkAw5AyOSZGb0drm/A4K8l5P8euwAIvmMcyDNnLtCKoRJ/enPgZeG+L4hD5 q3rRwIZf8h5inqf9+JFulxDMnaONoqNk+h9I2xohDsLPDsLOBPbqifqqIYtdC8Rz94JT douA6gf5dHYclZBHAJ+KP1Oy+t6gRH8ueJJB6jt31EG739HpcdFF/p6Myd4q3v29K8pJ uDP3wx/SDvsgLXf6CncqzZB9oLY1uWilrgEYSsetUo2dwIfCDFNhamCGVw9mE9dKo+2C 3Zwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 13si12069pfj.30.2018.03.23.22.43.21; Fri, 23 Mar 2018 22:43:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751784AbeCXFmR (ORCPT + 99 others); Sat, 24 Mar 2018 01:42:17 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:56456 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750763AbeCXFmO (ORCPT ); Sat, 24 Mar 2018 01:42:14 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out03.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ezbvq-0002lI-1y; Fri, 23 Mar 2018 23:41:34 -0600 Received: from 97-119-121-173.omah.qwest.net ([97.119.121.173] helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ezbvp-0002Ur-DC; Fri, 23 Mar 2018 23:41:33 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Linux Containers Cc: esyr@redhat.com, jannh@google.com, khlebnikov@yandex-team.ru, linux-api@vger.kernel.org, serge.hallyn@ubuntu.com, linux-kernel@vger.kernel.org, prakash.sangappa@oracle.com, linux-security-module@vger.kernel.org, luto@kernel.org, oleg@redhat.com, akpm@linux-foundation.org, Nagarathnam Muthusamy , Pavel Emelyanov References: <1520875093-18174-1-git-send-email-nagarathnam.muthusamy@oracle.com> <87vadzqqq6.fsf@xmission.com> <990e88fa-ab50-9645-b031-14e1afbf7ccc@oracle.com> <877eqejowd.fsf@xmission.com> <3a46a03d-e4dd-59b6-e25f-0020be1b1dc9@oracle.com> <87a7v2z2qa.fsf@xmission.com> <87vadmobdw.fsf_-_@xmission.com> Date: Sat, 24 Mar 2018 00:40:36 -0500 In-Reply-To: <87vadmobdw.fsf_-_@xmission.com> (Eric W. Biederman's message of "Fri, 23 Mar 2018 14:11:23 -0500") Message-ID: <877eq2m3or.fsf_-_@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1ezbvp-0002Ur-DC;;;mid=<877eq2m3or.fsf_-_@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.119.121.173;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19LsWhkGARHkMZnkpNheHNw7Vk+a/gCXgw= X-SA-Exim-Connect-IP: 97.119.121.173 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa06.xmission.com X-Spam-Level: *** X-Spam-Status: No, score=3.6 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TR_Symld_Words,TVD_RCVD_IP,T_TooManySym_01,T_TooManySym_02, XMNoVowels,XMSolicitRefs_0,XMSubLong autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 1.5 TR_Symld_Words too many words that have symbols inside * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.0 T_TooManySym_02 5+ unique symbols in subject * 0.1 XMSolicitRefs_0 Weightloss drug X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ***;Linux Containers X-Spam-Relay-Country: X-Spam-Timing: total 263 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 3.4 (1.3%), b_tie_ro: 2.5 (0.9%), parse: 1.08 (0.4%), extract_message_metadata: 12 (4.6%), get_uri_detail_list: 2.2 (0.8%), tests_pri_-1000: 6 (2.2%), tests_pri_-950: 1.13 (0.4%), tests_pri_-900: 0.98 (0.4%), tests_pri_-400: 22 (8.2%), check_bayes: 21 (7.9%), b_tokenize: 8 (2.9%), b_tok_get_all: 7 (2.6%), b_comp_prob: 1.56 (0.6%), b_tok_touch_all: 2.8 (1.1%), b_finish: 0.64 (0.2%), tests_pri_0: 207 (79.0%), check_dkim_signature: 0.47 (0.2%), check_dkim_adsp: 2.6 (1.0%), tests_pri_500: 6 (2.3%), rewrite_mail: 0.00 (0.0%) Subject: [REVIEW][PATCH 12/11] ipc: Directly call the security hook in ipc_ops.associate X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After the last round of cleanups the shm, sem, and msg associate operations just became trivial wrappers around the appropriate security method. Simplify things further by just calling the security method directly. Signed-off-by: "Eric W. Biederman" --- ipc/msg.c | 10 +--------- ipc/sem.c | 10 +--------- ipc/shm.c | 10 +--------- 3 files changed, 3 insertions(+), 27 deletions(-) diff --git a/ipc/msg.c b/ipc/msg.c index 825ad585a6ff..d667dd8e97ab 100644 --- a/ipc/msg.c +++ b/ipc/msg.c @@ -272,20 +272,12 @@ static void freeque(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp) ipc_rcu_putref(&msq->q_perm, msg_rcu_free); } -/* - * Called with msg_ids.rwsem and ipcp locked. - */ -static inline int msg_security(struct kern_ipc_perm *ipcp, int msgflg) -{ - return security_msg_queue_associate(ipcp, msgflg); -} - SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg) { struct ipc_namespace *ns; static const struct ipc_ops msg_ops = { .getnew = newque, - .associate = msg_security, + .associate = security_msg_queue_associate, }; struct ipc_params msg_params; diff --git a/ipc/sem.c b/ipc/sem.c index 47b263960524..09d54af076a4 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -564,14 +564,6 @@ static int newary(struct ipc_namespace *ns, struct ipc_params *params) } -/* - * Called with sem_ids.rwsem and ipcp locked. - */ -static inline int sem_security(struct kern_ipc_perm *ipcp, int semflg) -{ - return security_sem_associate(ipcp, semflg); -} - /* * Called with sem_ids.rwsem and ipcp locked. */ @@ -592,7 +584,7 @@ SYSCALL_DEFINE3(semget, key_t, key, int, nsems, int, semflg) struct ipc_namespace *ns; static const struct ipc_ops sem_ops = { .getnew = newary, - .associate = sem_security, + .associate = security_sem_associate, .more_checks = sem_more_checks, }; struct ipc_params sem_params; diff --git a/ipc/shm.c b/ipc/shm.c index 932b7e411c6c..018db3d0e70e 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -656,14 +656,6 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) return error; } -/* - * Called with shm_ids.rwsem and ipcp locked. - */ -static inline int shm_security(struct kern_ipc_perm *ipcp, int shmflg) -{ - return security_shm_associate(ipcp, shmflg); -} - /* * Called with shm_ids.rwsem and ipcp locked. */ @@ -684,7 +676,7 @@ SYSCALL_DEFINE3(shmget, key_t, key, size_t, size, int, shmflg) struct ipc_namespace *ns; static const struct ipc_ops shm_ops = { .getnew = newseg, - .associate = shm_security, + .associate = security_shm_associate, .more_checks = shm_more_checks, }; struct ipc_params shm_params; -- 2.14.1