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.8 required=3.0 tests=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 E1F47C3B186 for ; Mon, 10 Feb 2020 23:42:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB5CD20708 for ; Mon, 10 Feb 2020 23:42:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727575AbgBJXmN (ORCPT ); Mon, 10 Feb 2020 18:42:13 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:38614 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727192AbgBJXmM (ORCPT ); Mon, 10 Feb 2020 18:42:12 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1j1Igp-00AcMq-LS; Mon, 10 Feb 2020 23:42:07 +0000 Date: Mon, 10 Feb 2020 23:42:07 +0000 From: Al Viro To: Daniel Rosenberg Cc: Theodore Ts'o , linux-ext4@vger.kernel.org, Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Eric Biggers , linux-fscrypt@vger.kernel.org, Richard Weinberger , linux-mtd@lists.infradead.org, Andreas Dilger , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Gabriel Krisman Bertazi , kernel-team@android.com Subject: Re: [PATCH v7 2/8] fs: Add standard casefolding support Message-ID: <20200210234207.GJ23230@ZenIV.linux.org.uk> References: <20200208013552.241832-1-drosen@google.com> <20200208013552.241832-3-drosen@google.com> <20200208021216.GE23230@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 10, 2020 at 03:11:13PM -0800, Daniel Rosenberg wrote: > On Fri, Feb 7, 2020 at 6:12 PM Al Viro wrote: > > > > On Fri, Feb 07, 2020 at 05:35:46PM -0800, Daniel Rosenberg wrote: > > > > > > Again, is that safe in case when the contents of the string str points to > > keeps changing under you? > > I'm not sure what you mean. I thought it was safe to use the str and > len passed into d_compare. Even if it gets changed under RCU > conditions I thought there was some code to ensure that the name/len > pair passed in is consistent, and any other inconsistencies would get > caught by d_seq later. Are there unsafe code paths that can follow? If you ever fetch the same byte twice, you might see different values. You need a fairly careful use of READ_ONCE() or equivalents to make sure that you don't get screwed over by that. Sure, ->d_seq mismatch will throw the result out, but you need to make sure you won't oops/step on uninitialized memory/etc. in process. It's not impossible to get right, but it's not trivial and you need all code working with that much more careful than normal for string handling.