# git rev-parse -q --verify 4b8397a2335c31dac90f9f9cdf9380836bec0cfb^{commit} 4b8397a2335c31dac90f9f9cdf9380836bec0cfb already have revision, skipping fetch # git checkout -q -f -B kisskb 4b8397a2335c31dac90f9f9cdf9380836bec0cfb # git clean -qxdf # < git log -1 # commit 4b8397a2335c31dac90f9f9cdf9380836bec0cfb # Author: Michael Ellerman # Date: Fri Feb 1 22:03:58 2019 +1100 # # powerpc/64: Fix memcmp reading past the end of src/dest # # Chandan reported that fstests' generic/026 test hit a crash: # # BUG: Unable to handle kernel data access at 0xc00000062ac40000 # Faulting instruction address: 0xc000000000092240 # Oops: Kernel access of bad area, sig: 11 [#1] # LE SMP NR_CPUS=2048 DEBUG_PAGEALLOC NUMA pSeries # CPU: 0 PID: 27828 Comm: chacl Not tainted 5.0.0-rc2-next-20190115-00001-g6de6dba64dda #1 # NIP: c000000000092240 LR: c00000000066a55c CTR: 0000000000000000 # REGS: c00000062c0c3430 TRAP: 0300 Not tainted (5.0.0-rc2-next-20190115-00001-g6de6dba64dda) # MSR: 8000000002009033 CR: 44000842 XER: 20000000 # CFAR: 00007fff7f3108ac DAR: c00000062ac40000 DSISR: 40000000 IRQMASK: 0 # GPR00: 0000000000000000 c00000062c0c36c0 c0000000017f4c00 c00000000121a660 # GPR04: c00000062ac3fff9 0000000000000004 0000000000000020 00000000275b19c4 # GPR08: 000000000000000c 46494c4500000000 5347495f41434c5f c0000000026073a0 # GPR12: 0000000000000000 c0000000027a0000 0000000000000000 0000000000000000 # GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 # GPR20: c00000062ea70020 c00000062c0c38d0 0000000000000002 0000000000000002 # GPR24: c00000062ac3ffe8 00000000275b19c4 0000000000000001 c00000062ac30000 # GPR28: c00000062c0c38d0 c00000062ac30050 c00000062ac30058 0000000000000000 # NIP memcmp+0x120/0x690 # LR xfs_attr3_leaf_lookup_int+0x53c/0x5b0 # Call Trace: # xfs_attr3_leaf_lookup_int+0x78/0x5b0 (unreliable) # xfs_da3_node_lookup_int+0x32c/0x5a0 # xfs_attr_node_addname+0x170/0x6b0 # xfs_attr_set+0x2ac/0x340 # __xfs_set_acl+0xf0/0x230 # xfs_set_acl+0xd0/0x160 # set_posix_acl+0xc0/0x130 # posix_acl_xattr_set+0x68/0x110 # __vfs_setxattr+0xa4/0x110 # __vfs_setxattr_noperm+0xac/0x240 # vfs_setxattr+0x128/0x130 # setxattr+0x248/0x600 # path_setxattr+0x108/0x120 # sys_setxattr+0x28/0x40 # system_call+0x5c/0x70 # Instruction dump: # 7d201c28 7d402428 7c295040 38630008 38840008 408201f0 4200ffe8 2c050000 # 4182ff6c 20c50008 54c61838 7d201c28 <7d402428> 7d293436 7d4a3436 7c295040 # # The instruction dump decodes as: # subfic r6,r5,8 # rlwinm r6,r6,3,0,28 # ldbrx r9,0,r3 # ldbrx r10,0,r4 <- # # Which shows us doing an 8 byte load from c00000062ac3fff9, which # crosses the page boundary at c00000062ac40000 and faults. # # It's not OK for memcmp to read past the end of the source or # destination buffers if that would cross a page boundary, because we # don't know that the next page is mapped. It's also a little fishy to # read past the end of the source or destination buffers in general, it # will annoy valgrind for example (which can run on this code via our # stringloops selftest). # # The bug is in the code at the .Lcmp_rest_lt8bytes label. To fix it # test if we have at least 4 bytes to compare and if so do a 4 byte load # and compare. Otherwise, and/or if we have anything left, jump to the # existing code that does byte at a time comparison. # # Fixes: 2d9ee327adce ("powerpc/64: Align bytes before fall back to .Lshort in powerpc64 memcmp()") # Cc: stable@vger.kernel.org # v4.19+ # Reported-by: Chandan Rajendra # Tested-by: Chandan Rajendra # Signed-off-by: Michael Ellerman # < /opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux-gcc --version # < /opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux-ld --version # < git log --format=%s --max-count=1 4b8397a2335c31dac90f9f9cdf9380836bec0cfb # < make -s -j 48 ARCH=powerpc O=/kisskb/build/powerpc-next_ppc6xx_defconfig_powerpc-gcc4.6 CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux- ppc6xx_defconfig # make -s -j 48 ARCH=powerpc O=/kisskb/build/powerpc-next_ppc6xx_defconfig_powerpc-gcc4.6 CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux- /kisskb/src/kernel/printk/printk.c: In function 'devkmsg_sysctl_set_loglvl': /kisskb/src/kernel/printk/printk.c:186:16: warning: 'old' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/kernel/cgroup/cgroup-v1.c: In function 'cgroup1_mount': /kisskb/src/kernel/cgroup/cgroup-v1.c:1263:20: warning: 'root' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/kernel/trace/trace_dynevent.c: In function 'create_dyn_event': /kisskb/src/kernel/trace/trace_dynevent.c:89:5: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/base/regmap/regmap.c: In function 'regmap_raw_read': /kisskb/src/drivers/base/regmap/regmap.c:2594:6: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/base/regmap/regmap.c: In function '_regmap_raw_write': /kisskb/src/drivers/base/regmap/regmap.c:1855:6: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/i2c/i2c-core-base.c: In function 'i2c_generic_scl_recovery': /kisskb/src/drivers/i2c/i2c-core-base.c:235:5: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/proc/inode.c: In function 'proc_reg_open': /kisskb/src/include/linux/list.h:65:12: warning: 'pdeo' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/proc/inode.c:339:21: note: 'pdeo' was declared here /kisskb/src/fs/nfsd/nfs4xdr.c: In function 'nfsd4_encode_components_esc': /kisskb/src/fs/nfsd/nfs4xdr.c:2076:9: warning: 'str' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/tty/serial/8250/8250_core.c: In function 'univ8250_release_irq': /kisskb/src/drivers/tty/serial/8250/8250_core.c:247:18: warning: 'i' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/tty/serial/8250/8250_core.c:227:19: note: 'i' was declared here /kisskb/src/fs/udf/unicode.c: In function 'udf_name_conv_char': /kisskb/src/fs/udf/unicode.c:132:8: warning: 'c' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/sound/ppc/awacs.c: In function 'snd_pmac_awacs_init': /kisskb/src/include/sound/control.h:223:2: warning: 'speaker_vol' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/sound/ppc/awacs.c:886:36: note: 'speaker_vol' was declared here /kisskb/src/net/bridge/br_netlink.c: In function 'br_afspec.isra.28': /kisskb/src/net/bridge/br_netlink.c:652:7: warning: 'err' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/net/mac80211/mlme.c: In function 'ieee80211_rx_mgmt_beacon': /kisskb/src/net/mac80211/mlme.c:1522:3: warning: 'pwr_level_cisco' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/net/mac80211/mlme.c:1479:6: note: 'pwr_level_cisco' was declared here /kisskb/src/drivers/net/tun.c: In function 'tun_get_user': /kisskb/src/drivers/net/tun.c:1843:30: warning: 'copylen' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/net/tun.c:1753:46: warning: 'linear' may be used uninitialized in this function [-Wuninitialized] INFO: Uncompressed kernel (size 0xa95140) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa95140) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa95140) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa95140) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa95140) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa95140) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa95140) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa95140) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa95140) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa95140) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa84a5c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) INFO: Uncompressed kernel (size 0xa84a5c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xb00000) Image Name: Linux-5.0.0-rc2+ Created: Sat Feb 16 23:05:36 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5063835 Bytes = 4945.15 KiB = 4.83 MiB Load Address: 00b00000 Entry Point: 00b00888 Image Name: Linux-5.0.0-rc2+ Created: Sat Feb 16 23:05:36 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5062887 Bytes = 4944.23 KiB = 4.83 MiB Load Address: 00b00000 Entry Point: 00b00290 Image Name: Linux-5.0.0-rc2+ Created: Sat Feb 16 23:05:37 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5031899 Bytes = 4913.96 KiB = 4.80 MiB Load Address: 00000000 Entry Point: 00000000 Image Name: Linux-5.0.0-rc2+ Created: Sat Feb 16 23:05:37 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5062789 Bytes = 4944.13 KiB = 4.83 MiB Load Address: 00b00000 Entry Point: 00b00290 Image Name: Linux-5.0.0-rc2+ Created: Sat Feb 16 23:05:37 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5062749 Bytes = 4944.09 KiB = 4.83 MiB Load Address: 00b00000 Entry Point: 00b00290 Image Name: Linux-5.0.0-rc2+ Created: Sat Feb 16 23:05:37 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5063522 Bytes = 4944.85 KiB = 4.83 MiB Load Address: 00b00000 Entry Point: 00b00290 Image Name: Linux-5.0.0-rc2+ Created: Sat Feb 16 23:05:37 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5063234 Bytes = 4944.56 KiB = 4.83 MiB Load Address: 00b00000 Entry Point: 00b00290 Image Name: Linux-5.0.0-rc2+ Created: Sat Feb 16 23:05:37 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5064065 Bytes = 4945.38 KiB = 4.83 MiB Load Address: 00b00000 Entry Point: 00b00888 Image Name: Linux-5.0.0-rc2+ Created: Sat Feb 16 23:05:37 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5062192 Bytes = 4943.55 KiB = 4.83 MiB Load Address: 00b00000 Entry Point: 00b00290 Completed OK # rm -rf /kisskb/build/powerpc-next_ppc6xx_defconfig_powerpc-gcc4.6 # Build took: 0:02:47.911432