lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cj26hlynh6wiluvn5cg5qdzlcpxxyjirzgr3oho5244k7xzy4v@3p433x77w7nf>
Date: Tue, 21 Jan 2025 13:01:05 -0500
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: Jann Horn <jannh@...gle.com>
Cc: linux-bcachefs@...r.kernel.org, 
	kernel list <linux-kernel@...r.kernel.org>
Subject: Re: kernel build error due to large stack frame in
 __bch2_str_hash_check_key

On Tue, Jan 21, 2025 at 05:01:26PM +0100, Jann Horn wrote:
> Hi!
> 
> I'm trying to build the mainline kernel at commit
> 95ec54a420b8f445e04a7ca0ea8deb72c51fe1d3 (upstream git master), but
> the build fails with the following error:
> 
> ```
> [...]/fs/bcachefs/str_hash.c: In function ‘__bch2_str_hash_check_key’:
> [...]/fs/bcachefs/str_hash.c:295:1: error: the frame size of 2400
> bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
>   295 | }
>       | ^
> cc1: all warnings being treated as errors
> ```
> 
> I am building with "gcc (Debian 14.2.0-3+build3) 14.2.0", using the
> attached kernel config. I think this used to work with the mainline
> kernel before the 6.14 merge window opened.

Well, your kernel config has something that doubles stack frame size,
it's 1200 bytes here.

I'm pushing this to my master branch to reduce it further, it'll be in
the next pull request.


>From f917016f69ba5a0c42a3a3327792707315f2a937 Mon Sep 17 00:00:00 2001
From: Kent Overstreet <kent.overstreet@...ux.dev>
Date: Tue, 21 Jan 2025 12:56:00 -0500
Subject: [PATCH] bcachefs: Reduce stack frame size of
 __bch2_str_hash_check_key()

We don't need all the helpers inlined here.

Signed-off-by: Kent Overstreet <kent.overstreet@...ux.dev>

diff --git a/fs/bcachefs/str_hash.c b/fs/bcachefs/str_hash.c
index 8c2c5539de2e..d78451c2a0c6 100644
--- a/fs/bcachefs/str_hash.c
+++ b/fs/bcachefs/str_hash.c
@@ -31,11 +31,11 @@ static int bch2_dirent_has_target(struct btree_trans *trans, struct bkey_s_c_dir
 	}
 }
 
-static int fsck_rename_dirent(struct btree_trans *trans,
-			      struct snapshots_seen *s,
-			      const struct bch_hash_desc desc,
-			      struct bch_hash_info *hash_info,
-			      struct bkey_s_c_dirent old)
+static noinline int fsck_rename_dirent(struct btree_trans *trans,
+				       struct snapshots_seen *s,
+				       const struct bch_hash_desc desc,
+				       struct bch_hash_info *hash_info,
+				       struct bkey_s_c_dirent old)
 {
 	struct qstr old_name = bch2_dirent_get_name(old);
 	struct bkey_i_dirent *new = bch2_trans_kmalloc(trans, bkey_bytes(old.k) + 32);
@@ -71,11 +71,11 @@ static int fsck_rename_dirent(struct btree_trans *trans,
 	return bch2_fsck_update_backpointers(trans, s, desc, hash_info, &new->k_i);
 }
 
-static int hash_pick_winner(struct btree_trans *trans,
-			    const struct bch_hash_desc desc,
-			    struct bch_hash_info *hash_info,
-			    struct bkey_s_c k1,
-			    struct bkey_s_c k2)
+static noinline int hash_pick_winner(struct btree_trans *trans,
+				     const struct bch_hash_desc desc,
+				     struct bch_hash_info *hash_info,
+				     struct bkey_s_c k1,
+				     struct bkey_s_c k2)
 {
 	if (bkey_val_bytes(k1.k) == bkey_val_bytes(k2.k) &&
 	    !memcmp(k1.v, k2.v, bkey_val_bytes(k1.k)))
@@ -142,8 +142,8 @@ static int repair_inode_hash_info(struct btree_trans *trans,
  * All versions of the same inode in different snapshots must have the same hash
  * seed/type: verify that the hash info we're using matches the root
  */
-static int check_inode_hash_info_matches_root(struct btree_trans *trans, u64 inum,
-					      struct bch_hash_info *hash_info)
+static noinline int check_inode_hash_info_matches_root(struct btree_trans *trans, u64 inum,
+						       struct bch_hash_info *hash_info)
 {
 	struct bch_fs *c = trans->c;
 	struct btree_iter iter;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ