From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE57AC433FE for ; Wed, 23 Feb 2022 23:24:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244788AbiBWXYm (ORCPT ); Wed, 23 Feb 2022 18:24:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235909AbiBWXYk (ORCPT ); Wed, 23 Feb 2022 18:24:40 -0500 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6636F4BFFB; Wed, 23 Feb 2022 15:24:11 -0800 (PST) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nN0zQ-004Ozy-UT; Wed, 23 Feb 2022 23:24:09 +0000 Date: Wed, 23 Feb 2022 23:24:08 +0000 From: Al Viro To: Levi Yun Cc: keescook@chromium.org, ebiederm@xmission.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] fs/exec.c: Avoid a race in formats Message-ID: References: <20220223231752.52241-1-ppbuk5246@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220223231752.52241-1-ppbuk5246@gmail.com> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 24, 2022 at 08:17:52AM +0900, Levi Yun wrote: > Suppose a module registers its own binfmt (custom) and formats is like: > > +---------+ +----------+ +---------+ > | custom | -> | format1 | -> | format2 | > +---------+ +----------+ +---------+ > > and try to call unregister_binfmt with custom NOT in __exit stage. Explain, please. Why would anyone do that? And how would such module decide when it's safe to e.g. dismantle data structures used by methods of that binfmt, etc.? Could you give more detailed example? Because it looks like papering over an inherently unsafe use of binfmt interfaces...