Received: by 10.223.185.116 with SMTP id b49csp1056642wrg; Fri, 23 Feb 2018 11:06:56 -0800 (PST) X-Google-Smtp-Source: AH8x226WvybugyYWeKnFpoECKVN1qxjMqxmw423WePyTPVGUgsgkZ54IWfYxtmnnAWfgxRZ2beKL X-Received: by 10.99.169.10 with SMTP id u10mr2206816pge.163.1519412816017; Fri, 23 Feb 2018 11:06:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519412815; cv=none; d=google.com; s=arc-20160816; b=mALP9klvmBt4IG7ND98tSayga6GGk1HASzc0f1Q9qqmE7wRO3KXIwI7jOvE2SKAUsx dk/9bCkyhtVl+9SbBI/z3No8VpEWz6S1l6PKfd4h3pcIdbnKxAzMK91ZKJs+MJUqCodq E4mEiStFtV4xtr1rrqm9n9lgnVa56zcbtaqEwcJM+JA/A3fak1NjeNo6DsqVWAr0qyw5 BoA68hAm3K8id42WmjA91/Mx/XgrqJPt2JKYB3RN5wJzEHuTdfaLACmAti4vJj5Tk1++ F1SKu55bX7NSLnGEdk3Ex9rgH7DnSpT7EXvMD4w1WsZbsIKQ7Mo0VoRxlC2+Sl+MMVzd eXgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=bb0t0a/v83LvNxKyNt5eggs8ypHSU/o/nkThbjMEJCA=; b=BdOt0hDde8aYUuGJTKpm2442HvEkoSRUhTzcfDtwLB0ika00YjAsu9gRaKHoYLvGSR rm6D4y1ma7vhoIggjka7ot04A9tUh8HPqTIM1Ad1fjXcuY3c/FQTwaePe8uH2VCVB8QX jb+XF43i5Aa0nfBtuIM91LhugK8KmIGMsqSCdNNv8RMN9RE48wuYVTkPM59TgiL4pWnH AyRZnjbGmgE5xf67v4NhimNWLNrtYntTEyRZbsuiymIDhn2brM+6dPUTseUeFJdgeeeA HUf88fnNKK45qinF0E3iJC0cMNewoorwuoqa3QHbKMWHpuTiHFu5DT7EAnU9oTt+Ai1I 612Q== 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 t14-v6si2180110plm.20.2018.02.23.11.06.42; Fri, 23 Feb 2018 11:06:55 -0800 (PST) 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 S935779AbeBWTFT (ORCPT + 99 others); Fri, 23 Feb 2018 14:05:19 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:50378 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965506AbeBWS56 (ORCPT ); Fri, 23 Feb 2018 13:57:58 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 458CC107C; Fri, 23 Feb 2018 18:57:57 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Paul Moore , Stephen Smalley , James Morris Subject: [PATCH 4.15 05/45] selinux: skip bounded transition processing if the policy isnt loaded Date: Fri, 23 Feb 2018 19:28:44 +0100 Message-Id: <20180223170716.098386257@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170715.197760019@linuxfoundation.org> References: <20180223170715.197760019@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paul Moore commit 4b14752ec4e0d87126e636384cf37c8dd9df157c upstream. We can't do anything reasonable in security_bounded_transition() if we don't have a policy loaded, and in fact we could run into problems with some of the code inside expecting a policy. Fix these problems like we do many others in security/selinux/ss/services.c by checking to see if the policy is loaded (ss_initialized) and returning quickly if it isn't. Reported-by: syzbot Signed-off-by: Paul Moore Acked-by: Stephen Smalley Reviewed-by: James Morris Signed-off-by: Greg Kroah-Hartman --- security/selinux/ss/services.c | 3 +++ 1 file changed, 3 insertions(+) --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -867,6 +867,9 @@ int security_bounded_transition(u32 old_ int index; int rc; + if (!ss_initialized) + return 0; + read_lock(&policy_rwlock); rc = -EINVAL;