From patchwork Thu Feb 28 22:18:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Casey Schaufler X-Patchwork-Id: 10833801 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 46E0E188E for ; Thu, 28 Feb 2019 22:19:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FC3F2F26E for ; Thu, 28 Feb 2019 22:19:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BB572F278; Thu, 28 Feb 2019 22:19:48 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 AE9C62F245 for ; Thu, 28 Feb 2019 22:19:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729312AbfB1WTr (ORCPT ); Thu, 28 Feb 2019 17:19:47 -0500 Received: from sonic302-28.consmr.mail.gq1.yahoo.com ([98.137.68.154]:42818 "EHLO sonic302-28.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729181AbfB1WTq (ORCPT ); Thu, 28 Feb 2019 17:19:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1551392386; bh=kdtislM8E8h74/k7iD5aHOq6AYv+fS3/ejHJ7LD5ioI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject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vWifci1vGs8nonkZ4QMEQE43pvB3 qE.hw9gdqzVQI0YwrEZAArXqoKVUtvnCnM9SNds5XEez6Cds6B82gRsT8UG0WIn9TXOCcXc.polz ibxi8vK7QpES8XnrI37rvKrL2SbqPmhhxRrfW0v971NO6BqYxkKq1Dl3fqHa5gRSHLeAav9xopie oIN6avkljfrruwoHhaRKqhQdlCSM8hMm5m2ArEjaWXbfWjkO5ZllGupa1jg16htJAQdyTMFCrno7 IENywvAzeUpmS_JnzP0EKNTrw8QdVYSiukOmPKd7Z2CKroBQvr27QK7ik_EaB_LFpeHBF9Bqs8oh rbHFl6uB4Si6mTChF8CY6RLUW.UeIMyUXj822E717zonNEg0UPcbswlp_1gqZU_1os9K9693P1ul lVU1SG41nzLnV8e43z3FcbTSoybv448XPiHUJxg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.gq1.yahoo.com with HTTP; Thu, 28 Feb 2019 22:19:46 +0000 Received: from c-67-169-65-224.hsd1.ca.comcast.net (EHLO localhost.localdomain) ([67.169.65.224]) by smtp403.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID eca90f2e660dab57d5d3726b0a8f0373; Thu, 28 Feb 2019 22:19:45 +0000 (UTC) From: Casey Schaufler To: jmorris@namei.org, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Cc: keescook@chromium.org, john.johansen@canonical.com, penguin-kernel@i-love.sakura.ne.jp, paul@paul-moore.com Subject: [PATCH 04/97] SCAFFOLD: Move sock_graft out of sock.h Date: Thu, 28 Feb 2019 14:18:00 -0800 Message-Id: <20190228221933.2551-5-casey@schaufler-ca.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190228221933.2551-1-casey@schaufler-ca.com> References: <20190228221933.2551-1-casey@schaufler-ca.com> Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Move sock_graft out of sock.h so that sock.h doesn't need security.h. This makes Casey's life easier as lots less recompiles after a change to security.h. DO NOT TAKE THIS PATCH! Signed-off-by: Casey Schaufler --- include/net/sock.h | 14 ++------------ net/socket.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index 2b229f7be8eb..2beeda35e39f 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -51,7 +51,7 @@ #include #include /* struct sk_buff */ #include -#include +//CBS #include #include #include #include @@ -1800,17 +1800,7 @@ static inline void sock_orphan(struct sock *sk) write_unlock_bh(&sk->sk_callback_lock); } -static inline void sock_graft(struct sock *sk, struct socket *parent) -{ - WARN_ON(parent->sk); - write_lock_bh(&sk->sk_callback_lock); - rcu_assign_pointer(sk->sk_wq, parent->wq); - parent->sk = sk; - sk_set_socket(sk, parent); - sk->sk_uid = SOCK_INODE(parent)->i_uid; - security_sock_graft(sk, parent); - write_unlock_bh(&sk->sk_callback_lock); -} +void sock_graft(struct sock *sk, struct socket *parent); kuid_t sock_i_uid(struct sock *sk); unsigned long sock_i_ino(struct sock *sk); diff --git a/net/socket.c b/net/socket.c index e89884e2197b..d5da935302a7 100644 --- a/net/socket.c +++ b/net/socket.c @@ -3425,3 +3425,20 @@ u32 kernel_sock_ip_overhead(struct sock *sk) } } EXPORT_SYMBOL(kernel_sock_ip_overhead); + +//CBS - HACK TO SPEED COMPILES + +void sock_graft(struct sock *sk, struct socket *parent) +{ + WARN_ON(parent->sk); + write_lock_bh(&sk->sk_callback_lock); + rcu_assign_pointer(sk->sk_wq, parent->wq); + parent->sk = sk; + sk_set_socket(sk, parent); + sk->sk_uid = SOCK_INODE(parent)->i_uid; + security_sock_graft(sk, parent); + write_unlock_bh(&sk->sk_callback_lock); +} +EXPORT_SYMBOL(sock_graft); + +//CBS - HACK TO SPEED COMPILES