From patchwork Sat Dec 27 20:43:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1082 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766868256; bh=3xdOSEm15Lnj9cuI0InLuICzX3JWwwnVkA5FayeVoRU=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=nzjvt2hFlXmwxDEmV0HDY71r60b6Un6svG+AInS6mJaE4y9tFVXjZ/x6epq88j6qE gx6PY/ynZCEkqK8n3lLEoT+6ODPIUr9fXlq+FR7q7fH2KvkGMIG+yStcnIpUz/N3o2 eLZ6pEDJLGwlnWWM8GoOdn2gp3378ZdtS4lhQpcZCocGX4Id3bufisRHw3IgCt0KRl KMAjhi3qvZirH86eUUnL5yZrFV/g0SA+Vg8lgrASKZV8ATw9en9RuNitKEoln3km1q r7mIm000k+BOSrZ4wZPZYR3SnKocob2yJaGj8rPAES1hks+CYyQdHE3diVohi47jVt 5T0AP3QTmTiaQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 046DF68BEF for ; Sat, 27 Dec 2025 13:44:16 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id HSYK2HGv7WP7 for ; Sat, 27 Dec 2025 13:44:15 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766868255; bh=3xdOSEm15Lnj9cuI0InLuICzX3JWwwnVkA5FayeVoRU=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=vD6luIoH4JnA1sTFdMwqICBgKE//Lqu4rA0MGBLRFVC5f3rhrGUdbaA5q3MDmgLC1 V/kDTLBKbSa5ZsL73TBP/Kr0XaR3tbCnrFT+Vsw16ezZ3RY5uHlp0H1h/POZ4bAVoK JhPAr4tAyQ+aLBjJwUFgm1GM6SZipyorND1MMzvI5p7LcyVwUTzG8JHhz34UItErCR ljXJW9mGF49561BxuM7i/c4yP1aotLZp5covRoDYzwJ6+Ppop84S0Styxtz8VHiqeN U9o5XmOD62xaKk3A/Zu9t3IaCigTY/c1aeyVxro+5hBLEDycldPf+eCu/AUb0vZyCG +TCo2yUF/PU1w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E62AB65079 for ; Sat, 27 Dec 2025 13:44:15 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766868253; bh=ypqJLizzZ712+KB0wIUTjeCQtbX5r/7hvZ6nTGpJtXs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ktZpQ2F8G2W+w8e0fGFQeFGK5obO4vsxPzQX1cRAqTuJF/Wzr2ui3gfLGaEiAnpNc lv1VgRxjWi2p8PGozHiedSpOid8QF4D5K0gCdGpHTx8P8t06b8Rk3NwPF4gIFhdBlx x+ZhYLOb9lnKGWnky9xaB33qm9P1mirQdgE3NS7rkt8C/NzUJFJLs8qrqPEB0ETt+L 23nrU7WZco07YfK+fI50GojVY6Mb+ncBTMBkmHm/vsiNgE5ferZazmGI/nX1NfGb6w 7isUH33/fHaUDM7CZUOjL4BPdbDzdsIo0oM+HNb2w9HbLVi/sxz4lzEeJub3eQIAG8 EU14qfhNLGX+Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F144264C0C; Sat, 27 Dec 2025 13:44:13 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id DCaicj660dKb; Sat, 27 Dec 2025 13:44:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766868249; bh=GKwGvJK2cNX6bmkNVa6uAKheztn0zRB0aUbqgw/rrYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GqJWWZ3m4AidKomQogWS8OSzgHukLL94Frkc9OQ0eSDLTdM3Jasn3vtnPpA6QO8/V 9XKzOiwvaq6A9W7XAiD7s5VifO7Maz50ePEgEOPL4h8vh1m2Jbxj+/6Xgqv73MQA77 /Lb5y9PHS8mr5bsRtXKjsJOn2vzTQTaDphGm8BgtqlMolIz88fQE/w0UnBMxc+M5ZP QsNvof5Y0BBhXxOtYrHUwB4bx8TRyHXjUnT2BTD9OjlOl/imqGx8owM5AUxLPD+e7f tV+DNrfq5dWaxVaNrt835M+O8ASspsygpDtNOjAZRG07GHc2NjjcATjoqxCChYDmZP bYwbwJMsGIzIw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9169364E1F; Sat, 27 Dec 2025 13:44:09 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 27 Dec 2025 13:43:00 -0700 Message-ID: <20251227204318.886983-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251227204318.886983-1-sjg@u-boot.org> References: <20251227204318.886983-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: R6MCWQFOM5BOOIDKHK73IM76WW7Y4CL3 X-Message-ID-Hash: R6MCWQFOM5BOOIDKHK73IM76WW7Y4CL3 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 05/16] ext4l: Fix path lookup by implementing dentry operations List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The fscrypt_match_name stub macro always returns 1, causing every directory entry to match regardless of name. Also d_splice_alias is a no-op that returns NULL, so the inode found by ext4_lookup is never associated with the dentry. Fix fscrypt_match_name to properly compare name lengths and contents. Fix d_splice_alias, d_instantiate and d_instantiate_new to set d->d_inode. Co-developed-by: Claude Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 52f479e9673..a90289c8fa5 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1426,10 +1426,10 @@ typedef unsigned int projid_t; #define d_find_any_alias(i) ({ (void)(i); (struct dentry *)NULL; }) #define dget_parent(d) ({ (void)(d); (struct dentry *)NULL; }) #define dput(d) do { (void)(d); } while (0) -#define d_splice_alias(i, d) ({ (void)(i); (void)(d); (struct dentry *)NULL; }) +#define d_splice_alias(i, d) ({ (d)->d_inode = (i); (d); }) #define d_obtain_alias(i) ({ (void)(i); (struct dentry *)NULL; }) -#define d_instantiate_new(d, i) do { (void)(d); (void)(i); } while (0) -#define d_instantiate(d, i) do { (void)(d); (void)(i); } while (0) +#define d_instantiate_new(d, i) ((void)((d)->d_inode = (i))) +#define d_instantiate(d, i) ((void)((d)->d_inode = (i))) #define d_tmpfile(f, i) do { (void)(f); (void)(i); } while (0) #define d_invalidate(d) do { (void)(d); } while (0) #define finish_open_simple(f, e) (e) @@ -1555,7 +1555,6 @@ static inline char *d_path(const struct path *path, char *buf, int buflen) #define fscrypt_limit_io_blocks(i, lb, l) (l) #define fscrypt_prepare_setattr(d, a) ({ (void)(d); (void)(a); 0; }) #define fscrypt_dio_supported(i) (1) -#define fscrypt_match_name(f, n, l) ({ (void)(f); (void)(n); (void)(l); 1; }) #define fscrypt_has_permitted_context(p, c) ({ (void)(p); (void)(c); 1; }) #define fscrypt_is_nokey_name(d) ({ (void)(d); 0; }) #define fscrypt_prepare_symlink(d, s, l, m, dl) ({ (void)(d); (void)(s); (void)(l); (void)(m); (void)(dl); 0; }) @@ -1572,6 +1571,15 @@ struct fscrypt_name { bool is_nokey_name; }; +static inline int fscrypt_match_name(const struct fscrypt_name *fname, + const u8 *de_name, u32 de_name_len) +{ + if (fname->usr_fname->len != de_name_len) + return 0; + + return !memcmp(fname->usr_fname->name, de_name, de_name_len); +} + /* fsverity stubs */ #define fsverity_prepare_setattr(d, a) ({ (void)(d); (void)(a); 0; }) #define fsverity_active(i) (0)