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=-4.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 4164BC433E0 for ; Tue, 9 Jun 2020 20:28:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0FBFF20737 for ; Tue, 9 Jun 2020 20:28:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591734507; bh=H/1jyA2ENEl76fko3i9AUC1qpu0Coz7F0CswtYS3WFg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=KoiexH6eKoTtdJaR0NIg6zS8XgTlVl/XkvF7K6bWvGx1+xB3m01MsK1rudlmYa8O/ kTyobLKlUnl3tepgKs8zba4+vqj7Pl2OlDBpD1YwsrCWFxkDoOLBA+vmhkISPKgqRh MlhGz2rp1ybnSSrHhXJpJc1yHNMqO5GXIQvZ6kOA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387731AbgFIU20 (ORCPT ); Tue, 9 Jun 2020 16:28:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:44700 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733222AbgFIU2X (ORCPT ); Tue, 9 Jun 2020 16:28:23 -0400 Received: from sol.localdomain (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7DB8A206C3; Tue, 9 Jun 2020 20:28:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591734502; bh=H/1jyA2ENEl76fko3i9AUC1qpu0Coz7F0CswtYS3WFg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=P4T3MvRrVMmtF3DbaNR6Vf9oaL5Jydxxzs2uKXV09TAGaRgb3FsE2ef7SwvZALph5 oLzKqq/yk82ZVm20+xmwMUS0IlcojUDB+UExygverfwT7n9SSgELPQgUAZuSMTp3+/ zSn333TkeHIJXbPbfcPqt0I9lUR/Dp6eiEyNsjFA= Date: Tue, 9 Jun 2020 13:28:21 -0700 From: Eric Biggers To: Theodore Ts'o Cc: Daniel Rosenberg , stable@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Al Viro , linux-fsdevel@vger.kernel.org, Gabriel Krisman Bertazi Subject: Re: [PATCH v2] ext4: avoid utf8_strncasecmp() with unstable name Message-ID: <20200609202821.GB1105@sol.localdomain> References: <20200601200543.59417-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200601200543.59417-1-ebiggers@kernel.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, Jun 01, 2020 at 01:05:43PM -0700, Eric Biggers wrote: > From: Eric Biggers > > If the dentry name passed to ->d_compare() fits in dentry::d_iname, then > it may be concurrently modified by a rename. This can cause undefined > behavior (possibly out-of-bounds memory accesses or crashes) in > utf8_strncasecmp(), since fs/unicode/ isn't written to handle strings > that may be concurrently modified. > > Fix this by first copying the filename to a stack buffer if needed. > This way we get a stable snapshot of the filename. > > Fixes: b886ee3e778e ("ext4: Support case-insensitive file name lookups") > Cc: # v5.2+ > Cc: Al Viro > Cc: Daniel Rosenberg > Cc: Gabriel Krisman Bertazi > Signed-off-by: Eric Biggers > --- > > v2: use memcpy() + barrier() instead of a byte-by-byte copy. > > fs/ext4/dir.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) Ted, could you take this through the ext4 tree as a fix for 5.8? The f2fs patch has been merged already. - Eric