Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7418483rwl; Fri, 30 Dec 2022 08:11:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXvFz+S7+ExN8fbqQYMZXygVQq0uW9aH2+0YcceHxqMyKYkM98ScB7BVPW8Ge/r9daz5b7IP X-Received: by 2002:a17:90a:c781:b0:225:f2aa:cf9c with SMTP id gn1-20020a17090ac78100b00225f2aacf9cmr19011754pjb.31.1672416693784; Fri, 30 Dec 2022 08:11:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672416693; cv=none; d=google.com; s=arc-20160816; b=u+3vvyy05wvjuL0p0vM/57NJHltHUxO1ncA8Wk6Rsmf1AVairclra4lKAnk2yl43+I d7Dij2TogvRXqNIwNCWwCx5BeZPf5WMrmXZSe6IfEzLMMVCBFW9OjcvwljrCIPbK48ad 5OGhevXUZe1RF4tBgSPLwvsvmCemw9lWoZInU2sN3/WwgaVMIaNpG8m+/eAMFmy1+HC2 TEw0sE/Ty0ARMJju+N18VXYrpymxoFrk6xl5lalJPzWvUtagdxGzpBYyXbKY2qAHTQYv DdXR5h5/FsGx3jBJlmqo0laKw0vYmM0m4Xz6nce2vLx+TQmTHDh1GS+/qBLxJGh754bV Gopw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=SHmMGPOul62+Z0/ERMSGp+9rZyPe5WGgrTVF6WNIw9c=; b=SKFnDocQWwGW1wMc9aUZatG0jBimUR9/mz/DV/edXSjbBGZhPpSDOcg0JCDkO9iQrb YKDKytgi7iuDFohHqtUHN+eVWXx+gli3fyssjqhS6Wp3aqEjwFOEbI2WBTtgQXYfKFjR guMjBcnd+9PhnunrLgdYNIXYa/IYrkiKvX/DGVwBHsy58ziyECca37DTDn0p7btYtGzf N8s/TDvqBEz8dYClNjyxlFGIuSnrMPZV3nbT3OgskjkdBDsfTECKaEBC6F7qfWiXTbEW /Zyt/CFBSWlSEUj76anOb08kRB3s+RElXapxVc3z3kg2ESi2v1CPjuROW8dUlZh9HF8Q T+Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cjMPoHfU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u18-20020a63f652000000b004827ef5f0bbsi22900007pgj.373.2022.12.30.08.11.25; Fri, 30 Dec 2022 08:11:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cjMPoHfU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S235203AbiL3Phk (ORCPT + 63 others); Fri, 30 Dec 2022 10:37:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235344AbiL3PhA (ORCPT ); Fri, 30 Dec 2022 10:37:00 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D47451BEA3; Fri, 30 Dec 2022 07:36:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 1291FCE18A9; Fri, 30 Dec 2022 15:36:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF6F4C433EF; Fri, 30 Dec 2022 15:36:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672414586; bh=XE8ifSxGfXq/BFysAeNhRttsfdgdwDk0kodQg7Og6jM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cjMPoHfU3+7aBFL/0XLFhmvT0RSC175bUbdlNZhNo14EO1phL9KOvNtQsUJ5RLCZN OEGso1R4DwwVGCqBy+fTcceh64gSEccbzbYCzQLD7VHNCiXi6bpWu3jyXBIBsRnrfJ B2owNiM3jiQwUfi6ZW65ZeWiuCOeJQyHjALrKMsLLO9/BEMgMXIIzlSApjPt1dEW3q aIqvu5rhG8yJQuXHuM0Whui4kzXuJtKolZ81n6bhrQi9OHIa9rnuGhmwqPPZQr4TE1 HNTvGGFikKIRvS3cHBR8cWW+pjqCd6p+nu94bzMLmbrwEmBPZOABToOC1Yzubj9s6d SRKrpUN7BMUjg== Date: Fri, 30 Dec 2022 16:36:19 +0100 From: Christian Brauner To: Linus Torvalds Cc: kernel test robot , "Jason A. Donenfeld" , oe-lkp@lists.linux.dev, lkp@intel.com, Masahiro Yamada , Kees Cook , Andrew Morton , Andy Shevchenko , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Theodore Ts'o Subject: Re: [linus:master] [kbuild] 3bc753c06d: xfstests.generic.454.fail Message-ID: <20221230153619.itewmvrtoxqkugx2@wittgenstein> References: <202212291509.704a11c9-oliver.sang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 29, 2022 at 10:55:05AM -0800, Linus Torvalds wrote: > On Thu, Dec 29, 2022 at 12:49 AM kernel test robot > wrote: > > > > generic/454 _check_generic_filesystem: filesystem on /dev/sda4 is inconsistent > > The commentary on that test is: > > Create xattrs with multiple keys that all appear the same > (in unicode, anyway) but point to different values. In theory all > Linux filesystems should allow this (filenames are a sequence of > arbitrary bytes) even if the user implications are horrifying. > > and looking at the script it seems to indeed just do setfattr and > getfattr with some unusual data (ie high bit set). > > Adding Ted, since this is apparently all on ext4. I guess it could be > the vfs layer too, but it really doesn't tend to look very much at the > xattr data, so.. Adding Christian Brauner anyway, since he's been > working in this area for other reasons. The test uses the user.* xattr namespace which should be unaffected by the xattr changes we did the last few cycles. > > Ted, Christian - I cut down the report mercilessly. It's not really > all that interesting, apart from the basic information of "xfstest > generic/454 started failing consistently on ext4 at commit > 3bc753c06dd0 ('kbuild: treat char as always unsigned')". > > If you think you need more, see > > https://lore.kernel.org/all/202212291509.704a11c9-oliver.sang@intel.com/ > > Also, I'm surprised this hasn't been an issue earlier - 'char' has > always been unsigned on arm (among other architectures), so if this > test started failing now on x86-64 due to -funsigned-char, it has > presumably been failing on arm the whole time. > > I assume it's something that compares a 'char *name' by value, but the > ones I looked at (eg xattr_find_entry() used strlen()/memcmp() which > should be all good). > > Oh, I think I see one potential problem in ext4: > > ext4_xattr_hash_entry() is hot garbage. Lookie here: > > while (name_len--) { > hash = (hash << NAME_HASH_SHIFT) ^ > (hash >> (8*sizeof(hash) - NAME_HASH_SHIFT)) ^ > *name++; > } > > so that hash will now depend on the sign of that 'char *name' pointer. > > If that hash ever has any long-term meaning (ie saved on disk or > exposed some other way), that would be problematic. If the xattrs aren't storable in the inode then they are stored in a separate block. The consist of a header and after that is an array of struct ext4_xattr_entry entries. Each of the entries store a hash value e_hash which is a hash of the xattr name and xattr value. The aforementioned header contains another h_hash field which seems to be a hash of all e_hash fields of all xattrs. For in-inode/ea-inode xattrs a hash for xattr name and value is stored on disk as well but there's no header. The i_atime field contains a checksum of only the value that is stored in the inode. IOW, the bug might also depend on how the xattrs are stored. For example, what xattrs might be stored in the inode depends on the inode size that is chosen when the filesystem is created. But if I'm not mistaken, it also depends on the block size. So if the block size chosen for x86 differs from arm that might have an impact on how the xattrs are stored and thus make the bug more or less likely to appear?...