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 X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 504B0C43381 for ; Wed, 27 Mar 2019 12:08:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F40472087C for ; Wed, 27 Mar 2019 12:08:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=f-secure.com header.i=@f-secure.com header.b="BFsymkZt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726598AbfC0MIy (ORCPT ); Wed, 27 Mar 2019 08:08:54 -0400 Received: from helmsgmaster01.f-secure.com ([193.110.108.20]:37696 "EHLO helmsgmaster01.f-secure.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726233AbfC0MIy (ORCPT ); Wed, 27 Mar 2019 08:08:54 -0400 Received: from pps.filterd (helmsgmaster01.f-secure.com [127.0.0.1]) by helmsgmaster01.f-secure.com (8.16.0.27/8.16.0.27) with SMTP id x2RC0p0f020877 for ; Wed, 27 Mar 2019 14:08:52 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=f-secure.com; h=from : to : subject : date : message-id : mime-version : content-type; s=msg2048; bh=sZDzIj4Gr6St+vDg5DK1WjF4sGkZb+KKZaKDqZUcxMQ=; b=BFsymkZtl0AInbg74M96boFdMS0e3DgKRfBH5v/N3xD/boRNjeUSeo6tQmFCVmrPRaYm nks0XIkFE95vYLI4Laqt8bVeXLnYd6Q5GEVqChKGGXbtdyJG65as6g1zBI8bj5mu8pHT MxQ9FtBQJmaFZQwgSt53yi1t0zi/Ni/BQRuVh2fpVU6ILeIAuOLfyLpPp4sJeAGR5Kby gSWm3yMFS93uw88CAFHUnClMxkktHe9zp/4JaxANRwwKTNtABuatfcbh5MEWBaFO2NGE hWYUcL7GdEa4/5Pu0eJwHJ+z1osZOI21jVwSJ/csh8gswBOihwZjsheG8eelaZx2aijS 1A== Received: from helex02.fi.f-secure.com ([10.190.48.73]) by helmsgmaster01.f-secure.com with ESMTP id 2rd9tkdxsh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 27 Mar 2019 14:08:52 +0200 Received: from drapion.f-secure.com (10.128.132.96) by helex01.FI.F-Secure.com (10.190.48.70) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 27 Mar 2019 14:08:50 +0200 From: Marko Rauhamaa To: linux-fsdevel Subject: fanotify: surprising chain reaction -> deadlock Date: Wed, 27 Mar 2019 14:08:51 +0200 Message-ID: <87wokkecz0.fsf@drapion.f-secure.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Just an observation of an fanotify complication... We have just managed to analyze an interesting vicious circle (simplified): * disable IPv6 in the kernel * start a file monitor * during its initialization, the file monitor 1. marks file systems with OPEN_PERM 2. calls socket(PF_INET6) * the kernel executes this piece of code (socket.c): #ifdef CONFIG_MODULES /* Attempt to load a protocol module if the find failed. * * 12/09/1996 Marcin: But! this makes REALLY only sense, if the user * requested real, full-featured networking support upon configuration. * Otherwise module support will break! */ if (rcu_access_pointer(net_families[family]) == NULL) request_module("net-pf-%d", family); #endif * request_module spawns "modprobe" in the user space * opening "modprobe" is blocked by OPEN_PERM; however, the file monitor is still blocked in the socket(2) system call and can't release the "modprobe" process I'm not sure if there is a bug somewhere here but a surprising interaction nonetheless. Marko