# git rev-parse -q --verify d1dc87763f406d4e67caf16dbe438a5647692395^{commit} # git fetch -q -n -f git://fs.ozlabs.ibm.com/kernel/linus master warning: The last gc run reported the following. Please correct the root cause and remove .git/gc.log. Automatic cleanup will not be performed until the file is removed. warning: There are too many unreachable loose objects; run 'git prune' to remove them. # git rev-parse -q --verify d1dc87763f406d4e67caf16dbe438a5647692395^{commit} d1dc87763f406d4e67caf16dbe438a5647692395 # git checkout -q -f -B kisskb d1dc87763f406d4e67caf16dbe438a5647692395 # git clean -qxdf # < git log -1 # commit d1dc87763f406d4e67caf16dbe438a5647692395 # Author: Stephen Brennan # Date: Thu May 19 09:50:30 2022 +0100 # # assoc_array: Fix BUG_ON during garbage collect # # A rare BUG_ON triggered in assoc_array_gc: # # [3430308.818153] kernel BUG at lib/assoc_array.c:1609! # # Which corresponded to the statement currently at line 1593 upstream: # # BUG_ON(assoc_array_ptr_is_meta(p)); # # Using the data from the core dump, I was able to generate a userspace # reproducer[1] and determine the cause of the bug. # # [1]: https://github.com/brenns10/kernel_stuff/tree/master/assoc_array_gc # # After running the iterator on the entire branch, an internal tree node # looked like the following: # # NODE (nr_leaves_on_branch: 3) # SLOT [0] NODE (2 leaves) # SLOT [1] NODE (1 leaf) # SLOT [2..f] NODE (empty) # # In the userspace reproducer, the pr_devel output when compressing this # node was: # # -- compress node 0x5607cc089380 -- # free=0, leaves=0 # [0] retain node 2/1 [nx 0] # [1] fold node 1/1 [nx 0] # [2] fold node 0/1 [nx 2] # [3] fold node 0/2 [nx 2] # [4] fold node 0/3 [nx 2] # [5] fold node 0/4 [nx 2] # [6] fold node 0/5 [nx 2] # [7] fold node 0/6 [nx 2] # [8] fold node 0/7 [nx 2] # [9] fold node 0/8 [nx 2] # [10] fold node 0/9 [nx 2] # [11] fold node 0/10 [nx 2] # [12] fold node 0/11 [nx 2] # [13] fold node 0/12 [nx 2] # [14] fold node 0/13 [nx 2] # [15] fold node 0/14 [nx 2] # after: 3 # # At slot 0, an internal node with 2 leaves could not be folded into the # node, because there was only one available slot (slot 0). Thus, the # internal node was retained. At slot 1, the node had one leaf, and was # able to be folded in successfully. The remaining nodes had no leaves, # and so were removed. By the end of the compression stage, there were 14 # free slots, and only 3 leaf nodes. The tree was ascended and then its # parent node was compressed. When this node was seen, it could not be # folded, due to the internal node it contained. # # The invariant for compression in this function is: whenever # nr_leaves_on_branch < ASSOC_ARRAY_FAN_OUT, the node should contain all # leaf nodes. The compression step currently cannot guarantee this, given # the corner case shown above. # # To fix this issue, retry compression whenever we have retained a node, # and yet nr_leaves_on_branch < ASSOC_ARRAY_FAN_OUT. This second # compression will then allow the node in slot 1 to be folded in, # satisfying the invariant. Below is the output of the reproducer once the # fix is applied: # # -- compress node 0x560e9c562380 -- # free=0, leaves=0 # [0] retain node 2/1 [nx 0] # [1] fold node 1/1 [nx 0] # [2] fold node 0/1 [nx 2] # [3] fold node 0/2 [nx 2] # [4] fold node 0/3 [nx 2] # [5] fold node 0/4 [nx 2] # [6] fold node 0/5 [nx 2] # [7] fold node 0/6 [nx 2] # [8] fold node 0/7 [nx 2] # [9] fold node 0/8 [nx 2] # [10] fold node 0/9 [nx 2] # [11] fold node 0/10 [nx 2] # [12] fold node 0/11 [nx 2] # [13] fold node 0/12 [nx 2] # [14] fold node 0/13 [nx 2] # [15] fold node 0/14 [nx 2] # internal nodes remain despite enough space, retrying # -- compress node 0x560e9c562380 -- # free=14, leaves=1 # [0] fold node 2/15 [nx 0] # after: 3 # # Changes # ======= # DH: # - Use false instead of 0. # - Reorder the inserted lines in a couple of places to put retained before # next_slot. # # ver #2) # - Fix typo in pr_devel, correct comparison to "<=" # # Fixes: 3cb989501c26 ("Add a generic associative array implementation.") # Cc: # Signed-off-by: Stephen Brennan # Signed-off-by: David Howells # cc: Andrew Morton # cc: keyrings@vger.kernel.org # Link: https://lore.kernel.org/r/20220511225517.407935-1-stephen.s.brennan@oracle.com/ # v1 # Link: https://lore.kernel.org/r/20220512215045.489140-1-stephen.s.brennan@oracle.com/ # v2 # Reviewed-by: Jarkko Sakkinen # Signed-off-by: Linus Torvalds # < /opt/cross/kisskb/korg/gcc-11.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-11.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld --version # < git log --format=%s --max-count=1 d1dc87763f406d4e67caf16dbe438a5647692395 # < make -s -j 32 ARCH=powerpc O=/kisskb/build/linus-rand_powerpc-randconfig_powerpc-gcc11 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-11.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux- randconfig # Added to kconfig CONFIG_STANDALONE=y # Added to kconfig CONFIG_BUILD_DOCSRC=n # Added to kconfig CONFIG_MODULE_SIG=n # Added to kconfig CONFIG_CPU_BIG_ENDIAN=y # Added to kconfig CONFIG_PPC64=y # Added to kconfig CONFIG_PPC_DISABLE_WERROR=y # Added to kconfig CONFIG_SECTION_MISMATCH_WARN_ONLY=y # Added to kconfig CONFIG_PREVENT_FIRMWARE_BUILD=y # Added to kconfig CONFIG_CC_STACKPROTECTOR_STRONG=n # Added to kconfig CONFIG_GCC_PLUGINS=n # Added to kconfig CONFIG_LD_HEAD_STUB_CATCH=y # Added to kconfig CONFIG_TRIM_UNUSED_KSYMS=n # Added to kconfig CONFIG_UBSAN=n # < make -s -j 32 ARCH=powerpc O=/kisskb/build/linus-rand_powerpc-randconfig_powerpc-gcc11 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-11.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux- help # make -s -j 32 ARCH=powerpc O=/kisskb/build/linus-rand_powerpc-randconfig_powerpc-gcc11 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-11.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux- olddefconfig .config:4417:warning: override: reassigning to symbol STANDALONE .config:4419:warning: override: reassigning to symbol MODULE_SIG .config:4421:warning: override: reassigning to symbol PPC64 .config:4424:warning: override: reassigning to symbol PREVENT_FIRMWARE_BUILD .config:4429:warning: override: reassigning to symbol UBSAN # make -s -j 32 ARCH=powerpc O=/kisskb/build/linus-rand_powerpc-randconfig_powerpc-gcc11 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-11.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux- /kisskb/src/arch/powerpc/mm/book3s64/slice.c: In function 'slice_get_unmapped_area': /kisskb/src/arch/powerpc/mm/book3s64/slice.c:635:1: warning: the frame size of 1072 bytes is larger than 1024 bytes [-Wframe-larger-than=] 635 | } | ^ /kisskb/src/fs/ntfs/aops.c: In function 'ntfs_read_block': /kisskb/src/fs/ntfs/aops.c:358:1: warning: the frame size of 1168 bytes is larger than 1024 bytes [-Wframe-larger-than=] 358 | } | ^ /kisskb/src/fs/fat/dir.c: In function 'fat_alloc_new_dir': /kisskb/src/fs/fat/dir.c:1195:1: warning: the frame size of 1056 bytes is larger than 1024 bytes [-Wframe-larger-than=] 1195 | } | ^ /kisskb/src/fs/fat/dir.c: In function 'fat_add_new_entries': /kisskb/src/fs/fat/dir.c:1279:1: warning: the frame size of 1088 bytes is larger than 1024 bytes [-Wframe-larger-than=] 1279 | } | ^ /kisskb/src/fs/fat/fatent.c: In function 'fat_free_clusters': /kisskb/src/fs/fat/fatent.c:634:1: warning: the frame size of 1152 bytes is larger than 1024 bytes [-Wframe-larger-than=] 634 | } | ^ /kisskb/src/fs/fat/fatent.c: In function 'fat_alloc_clusters': /kisskb/src/fs/fat/fatent.c:552:1: warning: the frame size of 1200 bytes is larger than 1024 bytes [-Wframe-larger-than=] 552 | } | ^ /kisskb/src/fs/ext4/move_extent.c: In function 'mext_page_mkuptodate': /kisskb/src/fs/ext4/move_extent.c:232:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=] 232 | } | ^ /kisskb/src/fs/ext4/readpage.c: In function 'ext4_mpage_readpages': /kisskb/src/fs/ext4/readpage.c:407:1: warning: the frame size of 1200 bytes is larger than 1024 bytes [-Wframe-larger-than=] 407 | } | ^ /kisskb/src/fs/mpage.c: In function '__mpage_writepage': /kisskb/src/fs/mpage.c:638:1: warning: the frame size of 1248 bytes is larger than 1024 bytes [-Wframe-larger-than=] 638 | } | ^ /kisskb/src/fs/mpage.c: In function 'do_mpage_readpage': /kisskb/src/fs/mpage.c:303:1: warning: the frame size of 1104 bytes is larger than 1024 bytes [-Wframe-larger-than=] 303 | } | ^ /kisskb/src/fs/buffer.c: In function 'block_read_full_folio': /kisskb/src/fs/buffer.c:2340:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=] 2340 | } | ^ Completed OK # rm -rf /kisskb/build/linus-rand_powerpc-randconfig_powerpc-gcc11 # Build took: 0:07:54.893507