On Tuesday, 2021-09-21 10:18 Arnd Bergmann wrote: > On Mon, Sep 20, 2021 at 7:26 PM Linus Torvalds wrote: > > It sounds like we can avoid the gcc bug if we just always use > > "de->de_name[]". Then we don't need to depend on magical behavior > > about one particular gcc version and a strange empty array in front of > > it. > > > > IOW, something like the attached simpler thing that just does that > > "always use de_name[]" and has a comment about why we don't do the > > natural thing well, the code in question actually does not use anything from struct qnx4_inode_entry except di_fname and di_status; they are available at the same offsets in struct qnx4_link_info as well, so wouldn't it be even simpler to just always use the fields of the latter structure? Like in the attached patch which replaces b7213ffa0e58? ($me feeling bad for reverting Linus' patch!) That way, the compiler should never see any access to the (shorter) qnx4_inode_entry.di_fname BTW, in the process I noticed that fs/qnx4/namei.c was missed by 663f4deca76 back in 2013 and so is still calling strlen() on untrusted data; the second part of the patch takes care of that. > > Also, just what version of gcc is the broken one? You say "gcc-11", > > but I certainly don't see it with _my_ version of gcc-11, so can we > > (just for that comment) document more precisely what version you have > > (or possibly what config you use to trigger it). > > I'm using the gcc-11.1.0 that I uploaded to > https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/11.1.0/ I don't have that compiler version, so obviously I couldn't test if the patch solves the problem. Cheers Anders