Return-Path: Received: from mail-qt0-f177.google.com ([209.85.216.177]:35389 "EHLO mail-qt0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751052AbcGGOUU (ORCPT ); Thu, 7 Jul 2016 10:20:20 -0400 Received: by mail-qt0-f177.google.com with SMTP id f89so8972775qtd.2 for ; Thu, 07 Jul 2016 07:20:19 -0700 (PDT) Message-ID: <1467901217.3195.25.camel@redhat.com> Subject: Re: [PATCH] posix_acl: de-union a_refcount and a_rcu From: Jeff Layton To: David Howells Cc: Al Viro , Andreas Gruenbacher , linux-fsdevel@vger.kernel.org Date: Thu, 07 Jul 2016 10:20:17 -0400 In-Reply-To: <1426.1467900668@warthog.procyon.org.uk> References: <1467762904-4241-1-git-send-email-jlayton@redhat.com> <1426.1467900668@warthog.procyon.org.uk> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, 2016-07-07 at 15:11 +0100, David Howells wrote: > Jeff Layton wrote: > > > > > Currently the two are unioned together, but I don't think that's > > safe. > > > > It looks like get_cached_acl could race with the last put in > > posix_acl_release. get_cached_acl calls atomic_inc_not_zero on > > a_refcount, but that field could have already been clobbered by > > call_rcu, and may no longer be zero. Fix this by de-unioning the > > two > > fields. > > > > Fixes: b8a7a3a66747 (posix_acl: Inode acl caching fixes) > > Signed-off-by: Jeff Layton > Acked-by: David Howells Thanks David, I think we're spared in most cases, as long as the atomic_inc_not_zero occurs while the next pointer in the rcu_head is still NULL. If it's not though, then we're set up for a GPF and/or a use-after-free. AFAICT, this is a regression from v4.6, so I think we want this in v4.7. Al, do you mind picking this up? Or NAK it and propose an alternate fix? Thanks, -- Jeff Layton