[OpenAFS-devel] Kernel BUG on Linux 6.5.3

Michael Laß lass@mail.upb.de
Thu, 14 Sep 2023 20:55:53 +0200


Hi,

on Arch Linux we are observing a kernel BUG with Linux 6.5.3 and a
patched OpenAFS 1.8.10. Patched means that it contains the following
changes on top of the 1.8.10 release:

fea2bd506 linux: Replace fop iterate with fop iterate_shared
01d7316f6 hcrypto: rename abort to _afscrypto_abort
aef0016df Linux 6.5: Use register_sysctl()
48e0bd7d9 LINUX: Make sysctl definitions more concise
04083bc9a Linux 6.5: Replace generic_file_splice_read

Here's an excerpt of the error:

Sep 13 19:57:54.727778 pcitds29 kernel: detected buffer overflow in
strlcpy
Sep 13 19:57:54.728304 pcitds29 kernel: ------------[ cut here ]-------
-----
Sep 13 19:57:54.740823 pcitds29 kernel: kernel BUG at
lib/string_helpers.c:1031!
Sep 13 19:57:54.740881 pcitds29 kernel: invalid opcode: 0000 [#1]
PREEMPT SMP NOPTI
[...]
Sep 13 19:57:54.741049 pcitds29 kernel: Call Trace:
Sep 13 19:57:54.741056 pcitds29 kernel:  <TASK>
Sep 13 19:57:54.741062 pcitds29 kernel:  ? die+0x128/0x130
Sep 13 19:57:54.741069 pcitds29 kernel:  ? do_trap+0xc9/0x170
Sep 13 19:57:54.741074 pcitds29 kernel:  ? fortify_panic+0x13/0x20
Sep 13 19:57:54.741080 pcitds29 kernel:  ? fortify_panic+0x13/0x20
Sep 13 19:57:54.741087 pcitds29 kernel:  ? exc_invalid_op+0x92/0xc0
Sep 13 19:57:54.741093 pcitds29 kernel:  ? fortify_panic+0x13/0x20
Sep 13 19:57:54.741099 pcitds29 kernel:  ? asm_exc_invalid_op+0x1a/0x20
Sep 13 19:57:54.741164 pcitds29 kernel:  ? fortify_panic+0x13/0x20
Sep 13 19:57:54.741172 pcitds29 kernel:  ? fortify_panic+0x13/0x20
Sep 13 19:57:54.741179 pcitds29 kernel: 
afs_dynroot_addDirEnt+0x1ef/0x210 [openafs
3f311692cd9b17721fc863c5e870abbfd609f083]
Sep 13 19:57:54.741185 pcitds29 kernel:  afs_GetDynroot+0x8dd/0xc50
[openafs 3f311692cd9b17721fc863c5e870abbfd609f083]
Sep 13 19:57:54.741192 pcitds29 kernel: 
afs_DynrootNewVnode+0x369/0x960 [openafs
3f311692cd9b17721fc863c5e870abbfd609f083]
Sep 13 19:57:54.741199 pcitds29 kernel:  afs_GetVCache+0x234/0x540
[openafs 3f311692cd9b17721fc863c5e870abbfd609f083]
Sep 13 19:57:54.741205 pcitds29 kernel:  afs_fill_super+0x2b0/0x3d0
[openafs 3f311692cd9b17721fc863c5e870abbfd609f083]
Sep 13 19:57:54.741210 pcitds29 kernel:  ?
__pfx_afs_fill_super+0x10/0x10 [openafs
3f311692cd9b17721fc863c5e870abbfd609f083]
Sep 13 19:57:54.741215 pcitds29 kernel:  mount_nodev+0x1a0/0x250
Sep 13 19:57:54.741223 pcitds29 kernel:  legacy_get_tree+0x28/0x50
Sep 13 19:57:54.741229 pcitds29 kernel:  vfs_get_tree+0x26/0xd0
Sep 13 19:57:54.741236 pcitds29 kernel:  path_mount+0x4bb/0xb70
Sep 13 19:57:54.741240 pcitds29 kernel:  __x64_sys_mount+0x11a/0x150
Sep 13 19:57:54.741245 pcitds29 kernel:  do_syscall_64+0x5d/0x90
Sep 13 19:57:54.741252 pcitds29 kernel:  ?
do_user_addr_fault+0x2cd/0x9e0
Sep 13 19:57:54.741259 pcitds29 kernel:  ? exc_page_fault+0x7f/0x180
Sep 13 19:57:54.741264 pcitds29 kernel: 
entry_SYSCALL_64_after_hwframe+0x6e/0xd8

The full error can be seen in this post:
https://aur.archlinux.org/packages/openafs#comment-933721

It might be that dirSize is not computed correctly in
afs_RebuildDynroot. Although this function is not shown in the trace, I
think it is the only way to go from afs_GetDynroot to
afs_dynroot_addDirEnt.

The strlcpy in afs_dynroot_addDirEnt was introduced in 14938 (15243 on
1.8.x) but it could very well be that this now only shows an error that
was there before.

Or did I maybe miss an important patch for 1.8.10 on Linux 6.5?

Sorry if this mail reaches the list twice. I'm always using the wrong
mail address on first attempt...

Best regards,
Michael