Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1970682ybv; Thu, 6 Feb 2020 13:18:33 -0800 (PST) X-Google-Smtp-Source: APXvYqwkq9VbeyJV7UzJhhxzbOQB5zFPtCUfrlbQgpSH9U+LChxhirUgarcz9cIz+sXQqp0OvJoV X-Received: by 2002:a05:6808:251:: with SMTP id m17mr31164oie.15.1581023913311; Thu, 06 Feb 2020 13:18:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581023913; cv=none; d=google.com; s=arc-20160816; b=VnH1evmfuJAPOnVLc+ZPVBLQFYlISFRjaoU3jEvArrE0LYNOAP4GiJIen69aUSWfFq OCXzFXNn3olA6KxXwTaxOCqHsSOczt6dcbpVMQVrcUcR3SBIvweh543BiisU8mUjiYMP XDMRocsHrMSSgKs+Eg39WcCP2Wqvt7WoeuXv/MwsJvob6oZzPASDhTOZoVRvfKZ+uEUw rTdVPL+/sU2swnEKZ4wxYADXhzL0i31/OOjyZLSsnlco9zjxUaiJUHsQUB6fKMWYgnNc kmlxC4/ea9z5+SRo4xINsgcOoHQ9XcCpl1Pz53ZpKGMvjXSwlB6BABSclt0zTMIsvbSd 5SLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=6zFcQXxOd0AoSDoUqg6z5isQ/0sW7jX3LPLgTPoylbY=; b=DxbfBw3foU5GRD4TBhS9oy9B0fc0sQhudjNeAe7Z7ehMlEyfBHGnyaSUfcQlp4fkEV I81jtyUE01hVSNZdGcz1rD7CnYDfS6LrzT0qeWHfdb0Zrs9wBKXfi+hoWxP/d+ywsLyw lE3k1xxyWGyNvMuuxEyTnF+CkI1J1EUY9aCdarFXpbWVUvhwuEe6awfnHqfcp9jjjhMn QchSXV1FuOEFT0otz2/tiLIdmD+o2AJgWhmCEL+Wkla/Dogpx7c81UNrtJH32RLS4ziQ e16EUyyrWszuOts6o4FSDwnRF6A/D0CvG468iEepEbzKh53PApSgdSKFm/mRr52w3feS NJTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vP4Bf8wH; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e8si2637760oie.96.2020.02.06.13.18.19; Thu, 06 Feb 2020 13:18:33 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=vP4Bf8wH; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727512AbgBFVRW (ORCPT + 99 others); Thu, 6 Feb 2020 16:17:22 -0500 Received: from mail-pl1-f202.google.com ([209.85.214.202]:38360 "EHLO mail-pl1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726765AbgBFVRW (ORCPT ); Thu, 6 Feb 2020 16:17:22 -0500 Received: by mail-pl1-f202.google.com with SMTP id t17so3930047ply.5 for ; Thu, 06 Feb 2020 13:17:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=6zFcQXxOd0AoSDoUqg6z5isQ/0sW7jX3LPLgTPoylbY=; b=vP4Bf8wHbtqzl59NmCRJTaPR2n5wX4ZSrXrJNID22SE8DI55UfIBhBJh3luYclTmHA 6e1aPnCGZt9aluu6/yuB4QOEGRi/vd75bY80CqYK3NRmimEjHTd44VL3InyfFxAtRbWr Nppf17834U0//WH8jjkqkffz9CpSvfJF+l2cXIm6iUbiIME2GoY9N1rbEKsmaHTyOYRU TWkJVCvaFoHovqGTp/ssYzmB2KYd3cRJRpIbl8BFSxCOgriT7scP7xKCnjCZvzv4VyWo nKLuBdDmjP7JKyEGSVXIE8rBuHZzDdY7BVR5GAiYJ40PBmjje8DTZ0j1t60/jJN4wh1F BxuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=6zFcQXxOd0AoSDoUqg6z5isQ/0sW7jX3LPLgTPoylbY=; b=Clt97UCBC0xYYg8Z307yJu0avFaSMicHFsXZAPJaL0tX+4fcR8FXIMT/wLmhD6yIGG nLHuPsi+TabN+uG8Fs9QT9idnG15ytSe7pKtRsUls6SFE039caKUFk3YUJbwu7r+OuWm 5L0W2IJebmAn04+j7e93S/A5Ln0baVRid5QAMWsKUt9rgdBNwgMuS1Jk39uYFgYIG4Gs zJKtuXouqLPNUqFQiUOBBh/rJPudGA1vxlQ9GZxDr4EKRPH8ITLB03yd0Fdz8n8HXmpL HfZ2SP6JOM1BpRt6cCvKriDKBWQVSFgEM6nsfDIgmrFaVWky0VnAoqSYJQqUgpP2qFQY s0iQ== X-Gm-Message-State: APjAAAUm74sma3J+i30NgfGxvdjkRKztJHpXFL4qe1pV1kb8tF9o06t5 uoIgNbywFgtrWsKLzZGQ+2tQAeBb+mh+ZjQ= X-Received: by 2002:a63:381a:: with SMTP id f26mr6083736pga.40.1581023841400; Thu, 06 Feb 2020 13:17:21 -0800 (PST) Date: Thu, 6 Feb 2020 13:14:31 -0800 Message-Id: <20200206211430.150615-1-smoreland@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog Subject: [PATCH v2] security: selinux: allow per-file labeling for bpffs From: Steven Moreland To: paul@paul-moore.com, sds@tycho.nsa.gov, eparis@parisplace.org, keescook@chromium.org, anton@enomsg.org, ccross@android.com, tony.luck@intel.com, selinux@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@android.com Cc: "Connor O'Brien" , Steven Moreland 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 From: Connor O'Brien Add support for genfscon per-file labeling of bpffs files. This allows for separate permissions for different pinned bpf objects, which may be completely unrelated to each other. Signed-off-by: Connor O'Brien Signed-off-by: Steven Moreland --- security/selinux/hooks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 116b4d644f68..d7b11188dc8d 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -750,7 +750,8 @@ static int selinux_set_mnt_opts(struct super_block *sb, if (strcmp(sb->s_type->name, "proc") == 0) sbsec->flags |= SE_SBPROC | SE_SBGENFS; - if (!strcmp(sb->s_type->name, "debugfs") || + if (!strcmp(sb->s_type->name, "bpf") || + !strcmp(sb->s_type->name, "debugfs") || !strcmp(sb->s_type->name, "tracefs") || !strcmp(sb->s_type->name, "pstore")) sbsec->flags |= SE_SBGENFS; -- 2.25.0.341.g760bfbb309-goog v1 -> v2 - Rebased to be on upstream selinux tree - Removed Android specific 'Change-Id'