From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.181 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796166633; b=5eLGxl6pkhlrOUX8tO0W+H02ZgRIC8LIlajvAbuB3r9lOWUa7Z4BkOGXD7C9TxQShaVi 9fL8PEywk0v7veH5LF2+0yu2/GdfB5f2uxo8Ipsd6olaMK/P7/3DJlQ3vLK2gEVi9swgf Me0xWURFiz9C2ZUaTZRqS7XoUZro3VIsC1+B30sPeQojnoY/KkAMjsmb46idvjfuucDp0 HCUT++3CQbTTkCyVPK5efBYUQqBBhbDBCzBaV7VTxud8hF+S2qypSe+FnOwmvO6i2KLr1 f10Dx9Fv/LYQF1OKnlUouq7556eErg42oA5wVxuyQzRJxE4BRR5BkI8RYVaBJIaunmA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796166633; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References:Autocrypt: Content-Type:Content-Transfer-Encoding:User-Agent:MIME-Version; bh=HIMpt8M90KyEgiDJIY4Ld+fnf9EncOC9VN9HF3zO5XY=; b=EH3WkwyT8HAK5KPpCQiNHhTUDe6z+iCqt/vrn6WbQPkgVYJpRhQcQERntKYLze+tovAc 7gMiM5ROFyrTnHOAFmhgnvS7rOFKZ3u3y5UvJqThO9/R4nOpdRVu4zMU2B/a4YqCu/xqV whXwPZFRLfHKhQ1IQ0hXGaaDe7MIEMVdFsVlI36VrxOOhiC9jssvLmjLMU2cDTzN24QXW 1XVWYvh8SM4xXGsPHld1vOcpRuU7PldbYwsoGaD5YjDfk4PULzsQc9Zl0syOcHKqtyhCx H/v1chb+pyjd59NEdXdiHC8y5KMN/zveqgmFe2no1qkgSwUdHYmtdatPQo2PrMl9qlQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=dubeyko.com; spf=pass smtp.mailfrom=dubeyko.com; dkim=pass header.d=dubeyko-com.20260707.gappssmtp.com header.i=@dubeyko-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=pS5eRS5y; arc=none smtp.remote-ip=209.85.128.181 Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC672606A31A for ; Tue, 1 Dec 2026 23:10:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CC672606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dubeyko.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dubeyko.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dubeyko-com.20260707.gappssmtp.com header.i=@dubeyko-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=pS5eRS5y Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-8b4dd5cb4f6so91615047b3.2 for ; Tue, 01 Dec 2026 15:10:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dubeyko-com.20260707.gappssmtp.com; s=20260707; t=1796166632; x=1796771432; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:content-type :autocrypt:references:in-reply-to:date:cc:to:from:subject:message-id :from:to:cc:subject:date:message-id:reply-to:content-type; bh=HIMpt8M90KyEgiDJIY4Ld+fnf9EncOC9VN9HF3zO5XY=; b=pS5eRS5yKKvcpy41qgPeEJ1SYLW0EnidIFKoseKDjXV0OcwYEKvSWbPjUgJfkmSoUM 2YAlRCKdU7FVzvpHx8443OQEi4eqGdCZqkc5H/ytWFBWkAYgpjrq0mcRoLKTPK56BUZ5 D5CqaeAA38pUSJRMb2zNBTJUnzsx4UecIR4/sPDMz6cWcHqd4zGRPamQDDdX461KqjVz 6d2bARSejz5j4di1yArKj4V2bPGzbPTAT7BTqkZmBANZOmMlPd0JFyww9Ravph0sLZuL +KA4hruGo3v+G/7nDPzcGvwhTnkPOGovPAUmq6Se6tLbNZEpaIzoLa1vjd1rXiieuY/6 2U9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796166632; x=1796771432; h=mime-version:user-agent:content-transfer-encoding:content-type :autocrypt:references:in-reply-to:date:cc:to:from:subject:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=HIMpt8M90KyEgiDJIY4Ld+fnf9EncOC9VN9HF3zO5XY=; b=hi6q/WNY9rHIGE6aw51Lw3gCbJPc4uDs7l7/06MvZuu2LTLNU7jai700GQnOGX1U9g dNIUlx3Oz/kSwCHIbpr8Nqa7FFwvhIGexmgaVC4L7UUvaR4WJ8l2onOHWE+KOcktqeZb ABEVKyilMMkXHQViAz6EpcuG6KcWxJUBuRe0v/9uZVGh4nJ4UvnfCdm/VMjCoBtMr9du gp1psV0727yF/UJdP+zRUQIQWwWuyxsf+osSskWvRSOoC/18S8XblaAo7gbJx5pMWMoK 1K627AHhFbwr7hVumEPqL2w5RwmvZ4ev3XOkdUttzCq2RT3t68l2a399Ck82b7GHCqhr IFmw== X-Forwarded-Encrypted: i=1; AL+hErHKwgmYN71iUl5EcsmIyoXWgtOidm+otihhI6SFJ22VGF11OTVek616VbBsjqU9h6rq+O7Qlm9V1bF+pxc=@vger.kernel.org X-Gm-Message-State: APuU4Z9o5iljsMVH3deEqfAwWBmpcA1OWdLQx1+7NeJMP25hpCY7ogRu aDYaxtbQ+NQQ8QNrt+bM3XHNBwfUjZqp9D44GbDwKZ3pGU+SLROdqulrlX6JsBtzKcI= X-Gm-Gg: AZFdTZdmmzCne3ysIy/0mjVVN6ZwMDOK6pgpYt9fOYYS+rR3N9k/nUpbP6Y/m6owb8w CLZQgIjgWN3qxlnDZGsdz/hdTcWOvmFgoOuWgtwCtz02HxLHsT0+FXLoDnBgXGo0h3av7ZY5y6c 2qW9PWbxOeQTMcsaNVi8X8waT1deq89biVfLpuZaINb+lf0QRF+UTZEelpRpe3pvfBibQwQikfO slyH+Hy9MZNTzZtUO9eJ4/q112oAb4tcLH1F1IbgVQYPoawh+8vcrt9SHUVHfyTbRnlf5vMqunQ wDhSeJVqt0vuTxOeS5rNCxZRiGbKa5Nn75VMWgsIB67CkpyUh1Pyasev7Z/4wW3Hl8EoAb9Mms5 3pEtMDOjoyIF21pjDBcc4iGmqyUYaGst90+PuzAKzp/2MOnBSNsjHfKzJJ4IDp2CgVfrLW5zC9V OFCQivOiEKin05B4FScehsaBHaBKjF/6yWLu1z5w9v1ysUNIAfr97yYZWU6QLzc4rXNiGYr+L2X uwaqkLuzgGA8HW/h1cMovfN/9+jFhOF/2SGRsjyO4zQpwEs3wVTey8FSpI1MRR5cVgGRhOUUnEb Rvyrc00bnV9hLuKGtu5BEiazgRD0KSwpXEetey1RnDqlYrjz1sYCewWkl2zByogqokqSG1951kU qFIVlhO/mZE5ToAHt0wdUAqOXSKPuu41XkyI3cfzl1BHY7ZyJkWkSAyseQt08HYsto6JIX+8jPJ 6M1QQh1rYmGp4OuDqF X-Received: by 2002:a05:690c:6307:b0:8b3:22c:b40c with SMTP id 00721157ae682-8b520329badmr176315917b3.7.1796166631951; Tue, 01 Dec 2026 15:10:31 -0800 (PST) Received: from ?IPv6:2600:1700:6476:1430:f726:86c4:c7ef:c27? ([2600:1700:6476:1430:f726:86c4:c7ef:c27]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b5201b8cdbsm147642237b3.1.2026.12.01.15.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 15:10:31 -0800 (PST) Message-ID: Subject: Re: [PATCH v5 2/3] hfs: pass the key buffer size to hfs_bnode_read_key() From: Viacheslav Dubeyko To: Ozgun Kultekin , glaubitz@physik.fu-berlin.de, frank.li@vivo.com Cc: linux-fsdevel@vger.kernel.org, yangguikun19@qq.com, stable@vger.kernel.org, linux-kernel@vger.kernel.org, kovalev@altlinux.org, brauner@kernel.org, cengiz.can@canonical.com Date: Tue, 01 Dec 2026 15:10:29 -0800 In-Reply-To: <20261201094246.80197-3-ozgunkultekin@gmail.com> References: <20261127045416.1160-1-ozgunkultekin@gmail.com> <20261201094246.80197-1-ozgunkultekin@gmail.com> <20261201094246.80197-3-ozgunkultekin@gmail.com> Autocrypt: addr=slava@dubeyko.com; prefer-encrypt=mutual; keydata=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 NFdvziOa4FgUBC4X71upsZIoZJeii2V/Jtc3B4g== Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2-9 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 On Tue, 2026-12-01 at 01:42 -0800, Ozgun Kultekin wrote: > hfs_bnode_read_key() reads the key length of leaf records (and of all > records of variable-key trees) from disk and only checks it against > sizeof(hfs_btree_key). The destination is always one of the two key > buffers hfs_find_init() allocates, each tree->max_key_len + 2 bytes > long: max_key_len in the b-tree header record does not count the key > length field, as hfs_btree_open() checks (HFS_MAX_EXT_KEYLEN is > sizeof(struct hfs_ext_key) - sizeof(u8)). For the extents tree > max_key_len is 7, so the whole allocation is 18 bytes and a crafted > leaf > key writes up to 256 bytes from the image past it. The error path > clears sizeof(hfs_btree_key) bytes of the same buffer. >=20 > hfs_brec_insert() and hfs_brec_update_parent() reach this with keys > that were never validated, the same way as in hfsplus. >=20 > Store the capacity of each key buffer in struct hfs_find_data as > key_capacity in hfs_find_init(), allocate the two buffers from it, > and > pass it to every hfs_bnode_read_key() call. Keys longer than the > buffer > are rejected as before, and the error path clears only the buffer. >=20 > The allocation size does not change: max_key_len * 2 + 4 is now > key_capacity * 2, where key_capacity is max_key_len plus sizeof(u16), > room for the 16-bit key length of HFS_TREE_BIGKEYS trees. > key_capacity > goes after bnode, where it pairs with record, so struct hfs_find_data > stays 56 bytes on 64-bit. >=20 > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Fixes: bb5e07cb9277 ("hfs/hfsplus: fix slab-out-of-bounds in > hfs_bnode_read_key") > Reported-by: Guikun Yang > Closes: > https://lore.kernel.org/all/tencent_F85118A9AFDF9B230D4E8FA672510A3E2F08@= qq.com/ > Suggested-by: Viacheslav Dubeyko > Cc: stable@vger.kernel.org > Signed-off-by: Ozgun Kultekin > --- >=20 > Notes: > =C2=A0=C2=A0=C2=A0 v5: the same changes as in the hfsplus patch: key_capa= city * 2 > with a > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 comment, a local key_len_size,= HFS_FIND_KEY_BUFS and > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 HFS_KEY_LEN_MAX_SIZE are gone.= Rebased on the hfs tree for- > next > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 branch. As suggested by Viache= slav. > =C2=A0=C2=A0=C2=A0 v4: > https://lore.kernel.org/all/20261127045416.1160-3-ozgunkultekin@gmail.com= / > =C2=A0=C2=A0=C2=A0 v3: > https://lore.kernel.org/all/20261119005943.37851-4-ozgunkultekin@gmail.co= m/ > =C2=A0=C2=A0=C2=A0 v2: > https://lore.kernel.org/all/20261118013337.67813-1-ozgunkultekin@gmail.co= m/ > =C2=A0=C2=A0=C2=A0 v1: > https://lore.kernel.org/all/20261114043522.48764-1-ozgunkultekin@gmail.co= m/ >=20 > =C2=A0fs/hfs/bfind.c | 15 +++++++++++++-- > =C2=A0fs/hfs/bnode.c |=C2=A0 7 ++++--- > =C2=A0fs/hfs/brec.c=C2=A0 | 12 ++++++++---- > =C2=A0fs/hfs/btree.h |=C2=A0 4 +++- > =C2=A04 files changed, 28 insertions(+), 10 deletions(-) >=20 > diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c > index d56e47bdc5..98e2774fd6 100644 > --- a/fs/hfs/bfind.c > +++ b/fs/hfs/bfind.c > @@ -14,6 +14,11 @@ > =C2=A0 > =C2=A0int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) > =C2=A0{ > + /* > + * The key length field is a u8, or a u16 in > HFS_TREE_BIGKEYS trees > + * (see hfs_brec_keylen()); leave room for the larger one. > + */ I don't think that this comment is useful. And, anyway, it is wrong place for comment. Let's simply remove it. > + const size_t key_len_size =3D sizeof(u16); > =C2=A0 void *ptr; > =C2=A0 > =C2=A0 if (!tree || !fd) > @@ -21,11 +26,17 @@ int hfs_find_init(struct hfs_btree *tree, struct > hfs_find_data *fd) > =C2=A0 > =C2=A0 fd->tree =3D tree; > =C2=A0 fd->bnode =3D NULL; > - ptr =3D kzalloc(tree->max_key_len * 2 + 4, GFP_KERNEL); > + /* > + * max_key_len does not count the key length field at the > start of > + * every key, so each key buffer needs max_key_len + > key_len_size > + * bytes. search_key and key share one allocation of two > buffers. > + */ > + fd->key_capacity =3D tree->max_key_len + key_len_size; > + ptr =3D kzalloc(fd->key_capacity * 2, GFP_KERNEL); > =C2=A0 if (!ptr) > =C2=A0 return -ENOMEM; > =C2=A0 fd->search_key =3D ptr; > - fd->key =3D ptr + tree->max_key_len + 2; > + fd->key =3D ptr + fd->key_capacity; > =C2=A0 hfs_dbg("cnid %d, caller %ps\n", > =C2=A0 tree->cnid, __builtin_return_address(0)); > =C2=A0 switch (tree->cnid) { > diff --git a/fs/hfs/bnode.c b/fs/hfs/bnode.c > index ec1b0189a4..f2781afea7 100644 > --- a/fs/hfs/bnode.c > +++ b/fs/hfs/bnode.c > @@ -71,7 +71,8 @@ u8 hfs_bnode_read_u8(struct hfs_bnode *node, u32 > off) > =C2=A0 return data; > =C2=A0} > =C2=A0 > -void hfs_bnode_read_key(struct hfs_bnode *node, void *key, u32 off) > +void hfs_bnode_read_key(struct hfs_bnode *node, void *key, u32 off, > + u32 key_capacity) > =C2=A0{ > =C2=A0 struct hfs_btree *tree; > =C2=A0 u32 key_len; > @@ -83,8 +84,8 @@ void hfs_bnode_read_key(struct hfs_bnode *node, > void *key, u32 off) > =C2=A0 else > =C2=A0 key_len =3D tree->max_key_len + 1; > =C2=A0 > - if (key_len > sizeof(hfs_btree_key) || key_len < 1) { > - memset(key, 0, sizeof(hfs_btree_key)); > + if (key_len > key_capacity || key_len < 1) { Ditto. > + memset(key, 0, key_capacity); > =C2=A0 pr_err("hfs: Invalid key length: %u\n", key_len); > =C2=A0 return; > =C2=A0 } > diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c > index 1ca1ee9f73..15520b2b15 100644 > --- a/fs/hfs/brec.c > +++ b/fs/hfs/brec.c > @@ -138,7 +138,8 @@ int hfs_brec_insert(struct hfs_find_data *fd, > void *entry, u32 entry_len) > =C2=A0 * at the start of the node and it is not the new node > =C2=A0 */ > =C2=A0 if (!rec && new_node !=3D node) { > - hfs_bnode_read_key(node, fd->search_key, data_off + > size); > + hfs_bnode_read_key(node, fd->search_key, data_off + > size, > + =C2=A0=C2=A0 fd->key_capacity); > =C2=A0 hfs_brec_update_parent(fd); > =C2=A0 } > =C2=A0 > @@ -156,7 +157,8 @@ int hfs_brec_insert(struct hfs_find_data *fd, > void *entry, u32 entry_len) > =C2=A0 entry_len =3D sizeof(cnid); > =C2=A0 > =C2=A0 /* get index key */ > - hfs_bnode_read_key(new_node, fd->search_key, 14); > + hfs_bnode_read_key(new_node, fd->search_key, 14, > + =C2=A0=C2=A0 fd->key_capacity); > =C2=A0 __hfs_brec_find(fd->bnode, fd); > =C2=A0 > =C2=A0 hfs_bnode_put(new_node); > @@ -458,7 +460,8 @@ static int hfs_brec_update_parent(struct > hfs_find_data *fd) > =C2=A0 } > =C2=A0 fd->bnode =3D hfs_bnode_find(tree, new_node->parent); > =C2=A0 /* create index key and entry */ > - hfs_bnode_read_key(new_node, fd->search_key, 14); > + hfs_bnode_read_key(new_node, fd->search_key, 14, > + =C2=A0=C2=A0 fd->key_capacity); > =C2=A0 cnid =3D cpu_to_be32(new_node->this); > =C2=A0 > =C2=A0 __hfs_brec_find(fd->bnode, fd); > @@ -470,7 +473,8 @@ static int hfs_brec_update_parent(struct > hfs_find_data *fd) > =C2=A0 if (new_node =3D=3D node) > =C2=A0 goto out; > =C2=A0 /* restore search_key */ > - hfs_bnode_read_key(node, fd->search_key, > 14); > + hfs_bnode_read_key(node, fd->search_key, 14, > + =C2=A0=C2=A0 fd->key_capacity); > =C2=A0 } > =C2=A0 new_node =3D NULL; > =C2=A0 } > diff --git a/fs/hfs/btree.h b/fs/hfs/btree.h > index 1f703f2c53..b42c47b212 100644 > --- a/fs/hfs/btree.h > +++ b/fs/hfs/btree.h > @@ -79,6 +79,7 @@ struct hfs_find_data { > =C2=A0 btree_key *search_key; > =C2=A0 struct hfs_btree *tree; > =C2=A0 struct hfs_bnode *bnode; > + u32 key_capacity; > =C2=A0 int record; > =C2=A0 int keyoffset, keylength; > =C2=A0 int entryoffset, entrylength; > @@ -117,7 +118,8 @@ extern void hfs_bmap_free(struct hfs_bnode > *node); > =C2=A0extern void hfs_bnode_read(struct hfs_bnode *node, void *buf, u32 > off, u32 len); > =C2=A0extern u16 hfs_bnode_read_u16(struct hfs_bnode *node, u32 off); > =C2=A0extern u8 hfs_bnode_read_u8(struct hfs_bnode *node, u32 off); > -extern void hfs_bnode_read_key(struct hfs_bnode *node, void *key, > u32 off); > +extern void hfs_bnode_read_key(struct hfs_bnode *node, void *key, > u32 off, > + =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 u32 key_capacity); > =C2=A0extern void hfs_bnode_write(struct hfs_bnode *node, void *buf, u32 > off, u32 len); > =C2=A0extern void hfs_bnode_write_u16(struct hfs_bnode *node, u32 off, u1= 6 > data); > =C2=A0extern void hfs_bnode_write_u8(struct hfs_bnode *node, u32 off, u8 > data); Please, delete the comment. I am going to run xfstests for patchset. Thanks, Slava.