Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1495111ybm; Sat, 30 May 2020 10:36:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQwF1G1ymUTstNin2b6rFVN/rV3WkKY8xp8+KKPxiVS0iKehiqPAdJb7Q6tljkxI/37dMy X-Received: by 2002:a17:906:51c9:: with SMTP id v9mr6063565ejk.337.1590860180227; Sat, 30 May 2020 10:36:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590860180; cv=none; d=google.com; s=arc-20160816; b=enBk89a1Sn2Oue19wF2nyGIXNhDxeqcxwUFIMJ3HnG2g6k+epZI/hdSrqWj9ZwhLLp 2B9Sw9bApNPEC95AZEff3Mv1E5Jy6h4YkboR759waqCFllwJQLseSsRx3a2e7ZsrtXI4 b6vaFoLDhEWzZ7kVwJ5W83nJeBrt7RGejYG4LIgTRwO8KN3LR27jOkQWdv14/bsf2DYz B7iz4qU1WGXMdRgGOWHHPdiv0ydZb8A7iH9RIUWzZF8DjYLNwAQg/niocdZVE8bEpjou 91BHGMajh25SAW4fxs1Um9y8XbrDu+XweKDwxDX9NqJepTgbH1Tc08ZQab+VxgLJXtTJ /LuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=PXvj5rBvBmvpa4rkFuOUlbBYTpoUR2R9/dzj0Hd9rUg=; b=UmJVdwnfPeisBXlPx4XrRhe2tWjiIjI4gaWqtIXa4IcUk5uwv12idNK09hIkIyVw0q BWh16E/IXCNHMl01DvfyyX6bMbqcOIjk7Di+8Ks9QmzNu0347hl8O0zk3i8xpSW8pPcj kyZhOI+lpWWOoiA8/orJ+AKGNbtcqKLUiy6ZOFnzdeInAQjDBQ4OF/S4Y+Pa3spO6nEc t37n1zlOh5IAmLsfisRmJAyidJ4/MypiAue7eYcFOm1MLUZrKullHWD4ULRs857VHnpx MDpcSxpabJSKVctItfBPzbff2gqfZXgQreKM/+NkMqdPepa1raO2KCyKdHlh4Jh+tR11 t/Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ONHZOgZx; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi4si7366712edb.411.2020.05.30.10.35.50; Sat, 30 May 2020 10:36:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ONHZOgZx; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728998AbgE3Rft (ORCPT + 99 others); Sat, 30 May 2020 13:35:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:46266 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725808AbgE3Rft (ORCPT ); Sat, 30 May 2020 13:35:49 -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 71A3C20774; Sat, 30 May 2020 17:35:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590860148; bh=Km+qsBMMCDWbNMm6RhJqYLEma5l3VL5pC1iVxzc9Ljc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ONHZOgZx3Q3+kUxk28asW/VTjbkXr6fmbkaCLfRocfasre//eQ8N+H8ow5bFn2xpc uzOcmb+LeGzNgVi+kWs1F9TLCQo0V1V/Cx5r4MEnnaZoz/2+E51ez9VyjQ8BaL47rD 3JZWi+c4WkS0ahXTI7RyIR2JEJ4iTPJZ2z9GX+tM= Date: Sat, 30 May 2020 10:35:47 -0700 From: Eric Biggers To: Matthew Wilcox Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, stable@vger.kernel.org, Al Viro , Daniel Rosenberg , Gabriel Krisman Bertazi Subject: Re: [PATCH] ext4: avoid utf8_strncasecmp() with unstable name Message-ID: <20200530173547.GA12299@sol.localdomain> References: <20200530060216.221456-1-ebiggers@kernel.org> <20200530171814.GD19604@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200530171814.GD19604@bombadil.infradead.org> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Sat, May 30, 2020 at 10:18:14AM -0700, Matthew Wilcox wrote: > On Fri, May 29, 2020 at 11:02:16PM -0700, Eric Biggers wrote: > > + if (len <= DNAME_INLINE_LEN - 1) { > > + unsigned int i; > > + > > + for (i = 0; i < len; i++) > > + strbuf[i] = READ_ONCE(str[i]); > > + strbuf[len] = 0; > > This READ_ONCE is going to force the compiler to use byte accesses. > What's wrong with using a plain memcpy()? > It's undefined behavior when the source can be concurrently modified. Compilers can assume that it's not, and remove the memcpy() (instead just using the source data directly) if they can prove that the destination array is never modified again before it goes out of scope. Do you have any suggestions that don't involve undefined behavior? - Eric