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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 3C3D4C433F5 for ; Fri, 3 Sep 2021 21:45:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15BF1600CD for ; Fri, 3 Sep 2021 21:45:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235475AbhICVqx (ORCPT ); Fri, 3 Sep 2021 17:46:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230425AbhICVqv (ORCPT ); Fri, 3 Sep 2021 17:46:51 -0400 X-Greylist: delayed 383 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 03 Sep 2021 14:45:51 PDT Received: from cupdev.net (unknown [IPv6:2a01:4f9:2a:1861::4464:12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76C19C061575 for ; Fri, 3 Sep 2021 14:45:51 -0700 (PDT) To: linux-fsdevel@vger.kernel.org From: Karolin Varner Subject: =?UTF-8?Q?Proposal=3a_Allow_mounting_and_bind_mounting_over_symlink?= =?UTF-8?Q?s_=e2=80=93_flag_to_not_expand_symlinks?= Message-ID: Date: Fri, 3 Sep 2021 23:39:23 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Morning all! I would like to propose adding a flag to the syscall underlying mount(2) that disables symlink expansion. The motivating use case for this is as follows: I am trying to set up a netns namespace that requires a specific DNS setup, to this end, I am creating a mount namespace and replacing /etc/resolve.conf. Unfortunately, resolv.conf is a symlink provided by systemd-resolved. Bind mounting over said file with my replacement is impossible: With `-c` option, the `mount` command actually targets `/etc/resolv.conf` instead of the file it's pointing to, but the kernel expands it internally and seems to mount over the file being pointed to. I highly similar use cases exist. I have tried the nosymfollow option, which did not work. I think it affects only how symlinks are handled once the fs is mounted. Best, Karolin Varner