Revision e512a59b472684d8585125101ab03b86c2c1348a authored by Anjali K on 14 June 2024, 17:38:44 UTC, committed by Greg Kroah-Hartman on 25 July 2024, 07:50:53 UTC
[ Upstream commit 1a14150e1656f7a332a943154fc486504db4d586 ]

Reading the dispatch trace log from /sys/kernel/debug/powerpc/dtl/cpu-*
results in a BUG() when the config CONFIG_HARDENED_USERCOPY is enabled as
shown below.

    kernel BUG at mm/usercopy.c:102!
    Oops: Exception in kernel mode, sig: 5 [#1]
    LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
    Modules linked in: xfs libcrc32c dm_service_time sd_mod t10_pi sg ibmvfc
    scsi_transport_fc ibmveth pseries_wdt dm_multipath dm_mirror dm_region_hash dm_log dm_mod fuse
    CPU: 27 PID: 1815 Comm: python3 Not tainted 6.10.0-rc3 #85
    Hardware name: IBM,9040-MRX POWER10 (raw) 0x800200 0xf000006 of:IBM,FW1060.00 (NM1060_042) hv:phyp pSeries
    NIP:  c0000000005d23d4 LR: c0000000005d23d0 CTR: 00000000006ee6f8
    REGS: c000000120c078c0 TRAP: 0700   Not tainted  (6.10.0-rc3)
    MSR:  8000000000029033 <SF,EE,ME,IR,DR,RI,LE>  CR: 2828220f  XER: 0000000e
    CFAR: c0000000001fdc80 IRQMASK: 0
    [ ... GPRs omitted ... ]
    NIP [c0000000005d23d4] usercopy_abort+0x78/0xb0
    LR [c0000000005d23d0] usercopy_abort+0x74/0xb0
    Call Trace:
     usercopy_abort+0x74/0xb0 (unreliable)
     __check_heap_object+0xf8/0x120
     check_heap_object+0x218/0x240
     __check_object_size+0x84/0x1a4
     dtl_file_read+0x17c/0x2c4
     full_proxy_read+0x8c/0x110
     vfs_read+0xdc/0x3a0
     ksys_read+0x84/0x144
     system_call_exception+0x124/0x330
     system_call_vectored_common+0x15c/0x2ec
    --- interrupt: 3000 at 0x7fff81f3ab34

Commit 6d07d1cd300f ("usercopy: Restrict non-usercopy caches to size 0")
requires that only whitelisted areas in slab/slub objects can be copied to
userspace when usercopy hardening is enabled using CONFIG_HARDENED_USERCOPY.
Dtl contains hypervisor dispatch events which are expected to be read by
privileged users. Hence mark this safe for user access.
Specify useroffset=0 and usersize=DISPATCH_LOG_BYTES to whitelist the
entire object.

Co-developed-by: Vishal Chourasia <vishalc@linux.ibm.com>
Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com>
Signed-off-by: Anjali K <anjalik@linux.ibm.com>
Reviewed-by: Srikar Dronamraju <srikar@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240614173844.746818-1-anjalik@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent cf3f203
History
File Mode Size
partitions
Kconfig -rw-r--r-- 6.9 KB
Kconfig.iosched -rw-r--r-- 1.4 KB
Makefile -rw-r--r-- 1.7 KB
badblocks.c -rw-r--r-- 14.1 KB
bdev.c -rw-r--r-- 27.8 KB
bfq-cgroup.c -rw-r--r-- 40.0 KB
bfq-iosched.c -rw-r--r-- 264.5 KB
bfq-iosched.h -rw-r--r-- 40.5 KB
bfq-wf2q.c -rw-r--r-- 52.4 KB
bio-integrity.c -rw-r--r-- 12.5 KB
bio.c -rw-r--r-- 48.4 KB
blk-cgroup-fc-appid.c -rw-r--r-- 1.4 KB
blk-cgroup-rwstat.c -rw-r--r-- 3.4 KB
blk-cgroup-rwstat.h -rw-r--r-- 3.9 KB
blk-cgroup.c -rw-r--r-- 57.6 KB
blk-cgroup.h -rw-r--r-- 15.4 KB
blk-core.c -rw-r--r-- 33.3 KB
blk-crypto-fallback.c -rw-r--r-- 19.0 KB
blk-crypto-internal.h -rw-r--r-- 6.1 KB
blk-crypto-profile.c -rw-r--r-- 16.4 KB
blk-crypto-sysfs.c -rw-r--r-- 4.5 KB
blk-crypto.c -rw-r--r-- 12.7 KB
blk-flush.c -rw-r--r-- 15.9 KB
blk-ia-ranges.c -rw-r--r-- 8.5 KB
blk-integrity.c -rw-r--r-- 10.4 KB
blk-ioc.c -rw-r--r-- 10.4 KB
blk-iocost.c -rw-r--r-- 98.4 KB
blk-iolatency.c -rw-r--r-- 29.4 KB
blk-ioprio.c -rw-r--r-- 6.1 KB
blk-ioprio.h -rw-r--r-- 540 bytes
blk-lib.c -rw-r--r-- 9.0 KB
blk-map.c -rw-r--r-- 18.2 KB
blk-merge.c -rw-r--r-- 31.5 KB
blk-mq-cpumap.c -rw-r--r-- 1.3 KB
blk-mq-debugfs-zoned.c -rw-r--r-- 453 bytes
blk-mq-debugfs.c -rw-r--r-- 20.9 KB
blk-mq-debugfs.h -rw-r--r-- 2.4 KB
blk-mq-pci.c -rw-r--r-- 1.2 KB
blk-mq-sched.c -rw-r--r-- 13.9 KB
blk-mq-sched.h -rw-r--r-- 2.3 KB
blk-mq-sysfs.c -rw-r--r-- 6.4 KB
blk-mq-tag.c -rw-r--r-- 18.6 KB
blk-mq-virtio.c -rw-r--r-- 1.3 KB
blk-mq.c -rw-r--r-- 123.8 KB
blk-mq.h -rw-r--r-- 12.7 KB
blk-pm.c -rw-r--r-- 6.6 KB
blk-pm.h -rw-r--r-- 763 bytes
blk-rq-qos.c -rw-r--r-- 8.1 KB
blk-rq-qos.h -rw-r--r-- 4.6 KB
blk-settings.c -rw-r--r-- 30.6 KB
blk-stat.c -rw-r--r-- 5.2 KB
blk-stat.h -rw-r--r-- 4.8 KB
blk-sysfs.c -rw-r--r-- 23.4 KB
blk-throttle.c -rw-r--r-- 67.0 KB
blk-throttle.h -rw-r--r-- 6.6 KB
blk-timeout.c -rw-r--r-- 4.1 KB
blk-wbt.c -rw-r--r-- 21.9 KB
blk-wbt.h -rw-r--r-- 747 bytes
blk-zoned.c -rw-r--r-- 16.9 KB
blk.h -rw-r--r-- 15.6 KB
bounce.c -rw-r--r-- 6.8 KB
bsg-lib.c -rw-r--r-- 9.8 KB
bsg.c -rw-r--r-- 6.3 KB
disk-events.c -rw-r--r-- 12.6 KB
early-lookup.c -rw-r--r-- 8.4 KB
elevator.c -rw-r--r-- 18.5 KB
elevator.h -rw-r--r-- 5.6 KB
fops.c -rw-r--r-- 20.8 KB
genhd.c -rw-r--r-- 37.0 KB
holder.c -rw-r--r-- 3.8 KB
ioctl.c -rw-r--r-- 16.8 KB
ioprio.c -rw-r--r-- 5.8 KB
kyber-iosched.c -rw-r--r-- 27.9 KB
mq-deadline.c -rw-r--r-- 34.9 KB
opal_proto.h -rw-r--r-- 9.8 KB
sed-opal.c -rw-r--r-- 76.9 KB
t10-pi.c -rw-r--r-- 12.5 KB

back to top