Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757257AbYG1Reg (ORCPT ); Mon, 28 Jul 2008 13:34:36 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750838AbYG1Re1 (ORCPT ); Mon, 28 Jul 2008 13:34:27 -0400 Received: from zombie.ncsc.mil ([144.51.88.131]:45735 "EHLO zombie.ncsc.mil" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750819AbYG1Re0 (ORCPT ); Mon, 28 Jul 2008 13:34:26 -0400 Subject: Re: BUG at security/selinux/avc.c:883 (was: Re: linux-next: Tree for July 17: early crash on x86-64) From: Stephen Smalley To: Al Viro Cc: Thomas Meyer , James Morris , "Rafael J. Wysocki" , Alexander Beregalov , Stephen Rothwell , linux-next@vger.kernel.org, LKML , Ingo Molnar , Kernel Testers List , Eric Paris In-Reply-To: <20080720121559.GV28946@ZenIV.linux.org.uk> References: <20080718012842.690b8346.sfr@canb.auug.org.au> <20080719035231.GU28946@ZenIV.linux.org.uk> <200807192042.06988.rjw@sisk.pl> <1216546973.3217.6.camel@dhcppc2> <20080720121559.GV28946@ZenIV.linux.org.uk> Content-Type: text/plain Organization: National Security Agency Date: Mon, 28 Jul 2008 13:32:38 -0400 Message-Id: <1217266358.20373.54.camel@moss-spartans.epoch.ncsc.mil> Mime-Version: 1.0 X-Mailer: Evolution 2.12.3 (2.12.3-5.fc8) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2374 Lines: 75 On Sun, 2008-07-20 at 13:15 +0100, Al Viro wrote: > On Sun, Jul 20, 2008 at 11:42:53AM +0200, Thomas Meyer wrote: > > Am Sonntag, den 20.07.2008, 05:54 +1000 schrieb James Morris: > > > On Sat, 19 Jul 2008, Rafael J. Wysocki wrote: > > > > > > > > vfs-next/net-next conflict; apply the patch below on top of the > > > merge. > > > > > > > > That helped, thanks. > > > > > > > > But next it ran into the BUG_ON() in line 883 of > > > security/selinux/avc.c . > > > > Disabling selinux made the kernel boot, finally. > > > > > > Ugh, that's not supposed to happen. Where was this in the boot? Do > > > you > > > have a console log? > > Argh... Fallout from ->permission() patch series. I've folded that into > rebase (along with Randy's compile fixes and missing bit in capability.c > in ->inode_permission() patch; AFAICS takes care of all mismerges as well). > In the meanwhile, see the patch below on top of next-20080718: > > diff --git a/fs/namei.c b/fs/namei.c > index a15c155..c0a64e2 100644 > --- a/fs/namei.c > +++ b/fs/namei.c > @@ -286,7 +286,8 @@ int permission(struct inode *inode, int mask, struct nameidata *nd) > if (retval) > return retval; > > - return security_inode_permission(inode, mask); > + return security_inode_permission(inode, > + mask & (MAY_READ|MAY_WRITE|MAY_EXEC)); > } > > /** SELinux needs MAY_APPEND to be passed down to the security hook. Otherwise, we get permission denials when only append permission is granted by policy even if the opening process specified O_APPEND. Shows up as a regression in the ltp selinux testsuite, fixed by this patch. Signed-off-by: Stephen Smalley --- fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/namei.c b/fs/namei.c index a7b0a0b..b91e973 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -274,7 +274,7 @@ int inode_permission(struct inode *inode, int mask) return retval; return security_inode_permission(inode, - mask & (MAY_READ|MAY_WRITE|MAY_EXEC)); + mask & (MAY_READ|MAY_WRITE|MAY_EXEC|MAY_APPEND)); } /** -- Stephen Smalley National Security Agency -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/