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=-0.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 49B04C3A59E for ; Wed, 4 Sep 2019 22:25:41 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 848F5208E4 for ; Wed, 4 Sep 2019 22:25:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="hfyCSdKg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 848F5208E4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46Nz0x3RfPzDqww for ; Thu, 5 Sep 2019 08:25:37 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=linuxfoundation.org (client-ip=2a00:1450:4864:20::144; helo=mail-lf1-x144.google.com; envelope-from=torvalds@linuxfoundation.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="hfyCSdKg"; dkim-atps=neutral Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46Nyyk2PTtzDqtn for ; Thu, 5 Sep 2019 08:23:40 +1000 (AEST) Received: by mail-lf1-x144.google.com with SMTP id u29so276253lfk.7 for ; Wed, 04 Sep 2019 15:23:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=L+6eZ5jXr9FHa9aXBFBl0ghBEbFlLODFrE967a3DFmE=; b=hfyCSdKgCY/Fe6ZhOgmUuzH+l1Av9MeoieBRJhOHgspd/HlfkJB3tRok9F33ql8Uzt YCi53+gSbOv7WH3zYmMiTF0zGBnANwxV7c7oClcZwaNIXXqds0cxD5Xcu535ms7QpKLP zDVTwLMuj95aI+DpS0Y7tzdH7BHLTHU6tmSJs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=L+6eZ5jXr9FHa9aXBFBl0ghBEbFlLODFrE967a3DFmE=; b=udGCmfLiy5482A0rjWNAV7817RZow25M+k9RRBIJ4Y5b3LfajWGfgGEiZb/bqM2CH8 asrKPdRbXR4G5kAy2aUuYVTV4OobOMO+NK3+9Tz0m3cACRtaL5EtskPNGTgYaaXhFjYr GTVdLUBlAawYWDenUudBHOpm0RVJ1lHw2pDzf2DJFnZ+3zUYh6sINcAq8mcx/HwY9079 IMUJF6vXGcuI3vwz1xZwJ0YjpvPm4/adp/dKxURfZ+AbAt1vnyLa1/xHPMaEwrEmmHmo bmbsubF+rmQpGnxeu60/WZ9jVN2sP/QrG5sHwOgfrvhUjmD85uU8Iwyl1tCqjjBp0eTm KGDQ== X-Gm-Message-State: APjAAAXlQ4QpPC1QI5K4sDAJiatSWso/4PmWPaZsOXFOjytYYMFNuuSy YVUURwSi7u1RJCmO3cVKp93f0peA9vg= X-Google-Smtp-Source: APXvYqw3nYXMkhDof9AvRlU7pGPB2cgawy+wpygAP+b4JtNqK+889IeDR6yb864AxmdfOxIk4gj14g== X-Received: by 2002:a19:381a:: with SMTP id f26mr244567lfa.168.1567635815750; Wed, 04 Sep 2019 15:23:35 -0700 (PDT) Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com. [209.85.208.173]) by smtp.gmail.com with ESMTPSA id j5sm36311lfm.29.2019.09.04.15.23.35 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Sep 2019 15:23:35 -0700 (PDT) Received: by mail-lj1-f173.google.com with SMTP id x18so338468ljh.1 for ; Wed, 04 Sep 2019 15:23:35 -0700 (PDT) X-Received: by 2002:a2e:9a84:: with SMTP id p4mr24283824lji.52.1567635425244; Wed, 04 Sep 2019 15:17:05 -0700 (PDT) MIME-Version: 1.0 References: <20190904201933.10736-1-cyphar@cyphar.com> <20190904201933.10736-11-cyphar@cyphar.com> <20190904214856.vnvom7h5xontvngq@yavin.dot.cyphar.com> In-Reply-To: <20190904214856.vnvom7h5xontvngq@yavin.dot.cyphar.com> From: Linus Torvalds Date: Wed, 4 Sep 2019 15:16:49 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v12 10/12] namei: aggressively check for nd->root escape on ".." resolution To: Aleksa Sarai Content-Type: text/plain; charset="UTF-8" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-ia64@vger.kernel.org, Linux-sh list , Peter Zijlstra , Rasmus Villemoes , Alexei Starovoitov , Linux List Kernel Mailing , David Howells , "open list:KERNEL SELFTEST FRAMEWORK" , sparclinux@vger.kernel.org, Shuah Khan , linux-arch , linux-s390 , Tycho Andersen , Aleksa Sarai , Jiri Olsa , Alexander Shishkin , Ingo Molnar , Linux ARM , linux-mips@vger.kernel.org, linux-xtensa@linux-xtensa.org, Kees Cook , Arnd Bergmann , Jann Horn , linux-m68k , Al Viro , Andy Lutomirski , Shuah Khan , Namhyung Kim , David Drysdale , Christian Brauner , "J. Bruce Fields" , linux-parisc@vger.kernel.org, Linux API , Chanho Min , Jeff Layton , Oleg Nesterov , Eric Biederman , alpha , linux-fsdevel , Andrew Morton , linuxppc-dev@lists.ozlabs.org, Linux Containers Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Wed, Sep 4, 2019 at 2:49 PM Aleksa Sarai wrote: > > Hinting to userspace to do a retry (with -EAGAIN as you mention in your > other mail) wouldn't be a bad thing at all, though you'd almost > certainly get quite a few spurious -EAGAINs -- &{mount,rename}_lock are > global for the entire machine, after all. I'd hope that we have some future (possibly very long-term) alternative that is not quite system-global, but yes, right now they are. Which is one reason I'd rather see EAGAIN in user space - yes, it probably makes it even easier to trigger, but it also means that user space might be able to do something about it when it does trigger. For example, maybe user space can first just use an untrusted path as-is, and if it gets EAGAIN or EXDEV, it may be that user space can simplify the path (ie turn "xyz/.../abc" into just "abc". And even if user space doesn't do anything like that, I suspect a performance problem is going to be a whole lot easier to debug and report when somebody ends up seeing excessive retries happening. As a developer you'll see it in profiles or in system call traces, rather than it resulting in very odd possible slowdowns for the kernel. And yeah, it would probably be best to then at least delay doing option 3 indefinitely, just to make sure user space knows about and actually has a test-case for that EAGAIN happening. Linus