* mainline build failure due to 5cfd69775eb5 ("bcachefs: Array bounds fixes")
@ 2023-10-31 22:15 Sudip Mukherjee (Codethink)
2023-10-31 22:24 ` Kent Overstreet
0 siblings, 1 reply; 4+ messages in thread
From: Sudip Mukherjee (Codethink) @ 2023-10-31 22:15 UTC (permalink / raw)
To: Kent Overstreet; +Cc: linux-bcachefs, linux-kernel, Linus Torvalds, regressions
Hi All,
The latest mainline kernel branch fails to build arm64 allmodconfig
with a native build on an arm64 host with the error:
In file included from fs/bcachefs/btree_io.c:11:
fs/bcachefs/btree_update_interior.h: In function 'want_new_bset':
fs/bcachefs/btree_update_interior.h:274:36: error: array subscript 0 is outside the bounds of an interior zero-length array 'struct bkey_packed[0]' [-Werror=zero-length-bounds]
274 | __bch_btree_u64s_remaining(c, b, &bne->keys.start[0]);
| ^~~~~~~~~~~~~~~~~~~
In file included from fs/bcachefs/bcachefs.h:206,
from fs/bcachefs/btree_io.c:3:
fs/bcachefs/bcachefs_format.h:2344:21: note: while referencing 'start'
2344 | struct bkey_packed start[0];
| ^~~~~
git bisect pointed to 5cfd69775eb5 ("bcachefs: Array bounds fixes").
I will be happy to test any patch or provide any extra log if needed.
#regzbot introduced: 5cfd69775eb5460ef78bb5034a37eb0dc52ab65d
--
Regards
Sudip
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: mainline build failure due to 5cfd69775eb5 ("bcachefs: Array bounds fixes") 2023-10-31 22:15 mainline build failure due to 5cfd69775eb5 ("bcachefs: Array bounds fixes") Sudip Mukherjee (Codethink) @ 2023-10-31 22:24 ` Kent Overstreet 2023-11-01 5:18 ` Sudip Mukherjee 0 siblings, 1 reply; 4+ messages in thread From: Kent Overstreet @ 2023-10-31 22:24 UTC (permalink / raw) To: Sudip Mukherjee (Codethink) Cc: linux-bcachefs, linux-kernel, Linus Torvalds, regressions On Tue, Oct 31, 2023 at 10:15:09PM +0000, Sudip Mukherjee (Codethink) wrote: > Hi All, > > The latest mainline kernel branch fails to build arm64 allmodconfig > with a native build on an arm64 host with the error: > > In file included from fs/bcachefs/btree_io.c:11: > fs/bcachefs/btree_update_interior.h: In function 'want_new_bset': > fs/bcachefs/btree_update_interior.h:274:36: error: array subscript 0 is outside the bounds of an interior zero-length array 'struct bkey_packed[0]' [-Werror=zero-length-bounds] > 274 | __bch_btree_u64s_remaining(c, b, &bne->keys.start[0]); > | ^~~~~~~~~~~~~~~~~~~ > In file included from fs/bcachefs/bcachefs.h:206, > from fs/bcachefs/btree_io.c:3: > fs/bcachefs/bcachefs_format.h:2344:21: note: while referencing 'start' > 2344 | struct bkey_packed start[0]; > | ^~~~~ > > git bisect pointed to 5cfd69775eb5 ("bcachefs: Array bounds fixes"). > > I will be happy to test any patch or provide any extra log if needed. Following patch should resolve everything: -- >8 -- From ad77f25f730ec9a0eb04be5adc591628654b85ae Mon Sep 17 00:00:00 2001 From: Kent Overstreet <kent.overstreet@linux.dev> Date: Tue, 31 Oct 2023 18:05:22 -0400 Subject: [PATCH] bcachefs: Fix build errors with gcc 10 gcc 10 seems to complain about array bounds in situations where gcc 11 does not - curious. This unfortunately requires adding some casts for now; we may investigate getting rid of our __u64 _data[] VLA in a future patch so that our start[0] members can be VLAs. Reported-by: John Stoffel <john@stoffel.org> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h index 29b000c6b7e1..5b44598b9df9 100644 --- a/fs/bcachefs/bcachefs_format.h +++ b/fs/bcachefs/bcachefs_format.h @@ -1617,9 +1617,7 @@ struct journal_seq_blacklist_entry { struct bch_sb_field_journal_seq_blacklist { struct bch_sb_field field; - - struct journal_seq_blacklist_entry start[0]; - __u64 _data[]; + struct journal_seq_blacklist_entry start[]; }; struct bch_sb_field_errors { diff --git a/fs/bcachefs/btree_trans_commit.c b/fs/bcachefs/btree_trans_commit.c index 8140b6e6e9a6..32693f7c6221 100644 --- a/fs/bcachefs/btree_trans_commit.c +++ b/fs/bcachefs/btree_trans_commit.c @@ -681,7 +681,7 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags, BCH_JSET_ENTRY_overwrite, i->btree_id, i->level, i->old_k.u64s); - bkey_reassemble(&entry->start[0], + bkey_reassemble((struct bkey_i *) entry->start, (struct bkey_s_c) { &i->old_k, i->old_v }); } @@ -689,7 +689,7 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags, BCH_JSET_ENTRY_btree_keys, i->btree_id, i->level, i->k->k.u64s); - bkey_copy(&entry->start[0], i->k); + bkey_copy((struct bkey_i *) entry->start, i->k); } trans_for_each_wb_update(trans, wb) { @@ -697,7 +697,7 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags, BCH_JSET_ENTRY_btree_keys, wb->btree, 0, wb->k.k.u64s); - bkey_copy(&entry->start[0], &wb->k); + bkey_copy((struct bkey_i *) entry->start, &wb->k); } if (trans->journal_seq) diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c index d029e0348c91..89ada89eafe7 100644 --- a/fs/bcachefs/btree_update_interior.c +++ b/fs/bcachefs/btree_update_interior.c @@ -2411,7 +2411,7 @@ void bch2_journal_entry_to_btree_root(struct bch_fs *c, struct jset_entry *entry r->level = entry->level; r->alive = true; - bkey_copy(&r->key, &entry->start[0]); + bkey_copy(&r->key, (struct bkey_i *) entry->start); mutex_unlock(&c->btree_root_lock); } diff --git a/fs/bcachefs/btree_update_interior.h b/fs/bcachefs/btree_update_interior.h index 5e0a467fe905..d92b3cf5f5e0 100644 --- a/fs/bcachefs/btree_update_interior.h +++ b/fs/bcachefs/btree_update_interior.h @@ -271,7 +271,7 @@ static inline struct btree_node_entry *want_new_bset(struct bch_fs *c, struct btree_node_entry *bne = max(write_block(b), (void *) btree_bkey_last(b, bset_tree_last(b))); ssize_t remaining_space = - __bch_btree_u64s_remaining(c, b, &bne->keys.start[0]); + __bch_btree_u64s_remaining(c, b, bne->keys.start); if (unlikely(bset_written(b, bset(b, t)))) { if (remaining_space > (ssize_t) (block_bytes(c) >> 3)) diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c index f73338f37bf1..9600b8083175 100644 --- a/fs/bcachefs/recovery.c +++ b/fs/bcachefs/recovery.c @@ -226,7 +226,7 @@ static int journal_replay_entry_early(struct bch_fs *c, if (entry->u64s) { r->level = entry->level; - bkey_copy(&r->key, &entry->start[0]); + bkey_copy(&r->key, (struct bkey_i *) entry->start); r->error = 0; } else { r->error = -EIO; ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: mainline build failure due to 5cfd69775eb5 ("bcachefs: Array bounds fixes") 2023-10-31 22:24 ` Kent Overstreet @ 2023-11-01 5:18 ` Sudip Mukherjee 2023-11-01 7:24 ` Linux regression tracking (Thorsten Leemhuis) 0 siblings, 1 reply; 4+ messages in thread From: Sudip Mukherjee @ 2023-11-01 5:18 UTC (permalink / raw) To: Kent Overstreet; +Cc: linux-bcachefs, linux-kernel, Linus Torvalds, regressions On Tue, 31 Oct 2023 at 22:24, Kent Overstreet <kent.overstreet@linux.dev> wrote: > > On Tue, Oct 31, 2023 at 10:15:09PM +0000, Sudip Mukherjee (Codethink) wrote: > > Hi All, > > > > The latest mainline kernel branch fails to build arm64 allmodconfig > > with a native build on an arm64 host with the error: > > > > In file included from fs/bcachefs/btree_io.c:11: > > fs/bcachefs/btree_update_interior.h: In function 'want_new_bset': > > fs/bcachefs/btree_update_interior.h:274:36: error: array subscript 0 is outside the bounds of an interior zero-length array 'struct bkey_packed[0]' [-Werror=zero-length-bounds] > > 274 | __bch_btree_u64s_remaining(c, b, &bne->keys.start[0]); > > | ^~~~~~~~~~~~~~~~~~~ > > In file included from fs/bcachefs/bcachefs.h:206, > > from fs/bcachefs/btree_io.c:3: > > fs/bcachefs/bcachefs_format.h:2344:21: note: while referencing 'start' > > 2344 | struct bkey_packed start[0]; > > | ^~~~~ > > > > git bisect pointed to 5cfd69775eb5 ("bcachefs: Array bounds fixes"). > > > > I will be happy to test any patch or provide any extra log if needed. > > Following patch should resolve everything: Thanks, and I can confirm that fixes the build for me too on the arm hosts. > > -- >8 -- > From ad77f25f730ec9a0eb04be5adc591628654b85ae Mon Sep 17 00:00:00 2001 > From: Kent Overstreet <kent.overstreet@linux.dev> > Date: Tue, 31 Oct 2023 18:05:22 -0400 > Subject: [PATCH] bcachefs: Fix build errors with gcc 10 > > gcc 10 seems to complain about array bounds in situations where gcc 11 > does not - curious. > > This unfortunately requires adding some casts for now; we may > investigate getting rid of our __u64 _data[] VLA in a future patch so > that our start[0] members can be VLAs. > > Reported-by: John Stoffel <john@stoffel.org> > Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> -- Regards Sudip ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mainline build failure due to 5cfd69775eb5 ("bcachefs: Array bounds fixes") 2023-11-01 5:18 ` Sudip Mukherjee @ 2023-11-01 7:24 ` Linux regression tracking (Thorsten Leemhuis) 0 siblings, 0 replies; 4+ messages in thread From: Linux regression tracking (Thorsten Leemhuis) @ 2023-11-01 7:24 UTC (permalink / raw) To: Sudip Mukherjee, Kent Overstreet Cc: linux-bcachefs, linux-kernel, Linus Torvalds, regressions On 01.11.23 06:18, Sudip Mukherjee wrote: > On Tue, 31 Oct 2023 at 22:24, Kent Overstreet <kent.overstreet@linux.dev> wrote: >> On Tue, Oct 31, 2023 at 10:15:09PM +0000, Sudip Mukherjee (Codethink) wrote: >>> >>> The latest mainline kernel branch fails to build arm64 allmodconfig >>> with a native build on an arm64 host with the error: >>[...] >> Following patch should resolve everything: >[...] > Thanks, and I can confirm that fixes the build for me too on the arm hosts. >> -- >8 -- >> From ad77f25f730ec9a0eb04be5adc591628654b85ae Mon Sep 17 00:00:00 2001 >> From: Kent Overstreet <kent.overstreet@linux.dev> >> Date: Tue, 31 Oct 2023 18:05:22 -0400 >> Subject: [PATCH] bcachefs: Fix build errors with gcc 10 >> >> gcc 10 seems to complain about array bounds in situations where gcc 11 >> does not - curious. >> >> This unfortunately requires adding some casts for now; we may >> investigate getting rid of our __u64 _data[] VLA in a future patch so >> that our start[0] members can be VLAs. >> >> Reported-by: John Stoffel <john@stoffel.org> >> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> > > Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> Kent, thx for handling this so quickly. If you want to do me a favor, please in the future include a "Link:" or "Closes:" tag with a URL to the report in cases like this, as explained in the docs (it's important for regression tracking, but also for future code archeologists); checkpatch should have pointed this out for this patch. Anyway, no big deal here, let me tell regzbot directly about the fix: #regzbot fix: bcachefs: Fix build errors with gcc 10 Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) -- Everything you wanna know about Linux kernel regression tracking: https://linux-regtracking.leemhuis.info/about/#tldr If I did something stupid, please tell me, as explained on that page. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-11-01 7:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31 22:15 mainline build failure due to 5cfd69775eb5 ("bcachefs: Array bounds fixes") Sudip Mukherjee (Codethink)
2023-10-31 22:24 ` Kent Overstreet
2023-11-01 5:18 ` Sudip Mukherjee
2023-11-01 7:24 ` Linux regression tracking (Thorsten Leemhuis)
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.