Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762359AbdLSLsd (ORCPT ); Tue, 19 Dec 2017 06:48:33 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:55776 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762318AbdLSLs2 (ORCPT ); Tue, 19 Dec 2017 06:48:28 -0500 Date: Tue, 19 Dec 2017 11:48:19 +0000 From: Al Viro To: Giuseppe Scrivano Cc: Andrew Morton , LKML , alexander.deucher@amd.com, broonie@kernel.org, chris@chris-wilson.co.uk, David Miller , deepa.kernel@gmail.com, Greg KH , luc.vanoostenryck@gmail.com, lucien xin , Ingo Molnar , Neil Horman , syzkaller-bugs@googlegroups.com, Vladislav Yasevich Subject: Re: [PATCH linux-next] mqueue: fix IPC namespace use-after-free Message-ID: <20171219114819.GQ21978@ZenIV.linux.org.uk> References: <20171219101440.19736-1-gscrivan@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171219101440.19736-1-gscrivan@redhat.com> User-Agent: Mutt/1.9.0 (2017-09-02) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 758 Lines: 15 On Tue, Dec 19, 2017 at 11:14:40AM +0100, Giuseppe Scrivano wrote: > mqueue_evict_inode() doesn't access the ipc namespace if it was > already freed. It can happen if in a new IPC namespace the inode was > created without a prior mq_open() which creates the vfsmount used to > access the superblock from mq_clear_sbinfo(). > > Keep a direct pointer to the superblock used by the inodes so we can > correctly reset the reference to the IPC namespace being destroyed. > > Bug introduced with 9c583773d03633 ("ipc, mqueue: lazy call > kern_mount_data in new namespaces") And just what will happen in the same scenario if you mount the damn thing in userland without ever calling mq_open(), touch a file there, then unmount and then leave the ipc namespace?