LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Reading `/sys/kernel/debug/kmemleak` takes 3 s and content not shown
From: Paul Menzel @ 2019-02-19  9:44 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linuxppc-dev, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 4739 bytes --]

Dear Linux folks,


On a the IBM S822LC (8335-GTA) with Ubuntu 18.10, and Linux 5.0-rc5+
accessing `/sys/kernel/debug/kmemleak` takes a long time. According to
strace it takes three seconds.

```
$ sudo strace -tt -T cat /sys/kernel/debug/kmemleak
10:35:49.861641 execve("/bin/cat", ["cat", "/sys/kernel/debug/kmemleak"], 0x7ffffdbcb518 /* 16 vars */) = 0 <0.000293>
10:35:49.862112 brk(NULL)               = 0x75b12a50000 <0.000012>
10:35:49.862190 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) <0.000015>
10:35:49.862261 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) <0.000015>
10:35:49.862324 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 <0.000018>
10:35:49.862389 fstat(3, {st_mode=S_IFREG|0644, st_size=143482, ...}) = 0 <0.000011>
10:35:49.862444 mmap(NULL, 143482, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7ce4a1150000 <0.000017>
10:35:49.862501 close(3)                = 0 <0.000011>
10:35:49.862550 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) <0.000015>
10:35:49.862615 openat(AT_FDCWD, "/lib/powerpc64le-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 <0.000019>
10:35:49.862676 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0\25\0\1\0\0\0pN\2\0\0\0\0\0"..., 832) = 832 <0.000011>
10:35:49.862731 fstat(3, {st_mode=S_IFREG|0755, st_size=2310856, ...}) = 0 <0.000011>
10:35:49.862783 mmap(NULL, 2380672, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7ce4a0f00000 <0.000018>
10:35:49.862842 mprotect(0x7ce4a1120000, 65536, PROT_NONE) = 0 <0.000019>
10:35:49.862899 mmap(0x7ce4a1130000, 131072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x220000) = 0x7ce4a1130000 <0.000019>
10:35:49.862990 close(3)                = 0 <0.000010>
10:35:49.863110 mprotect(0x7ce4a1130000, 65536, PROT_READ) = 0 <0.000017>
10:35:49.863192 mprotect(0x75ad43b0000, 65536, PROT_READ) = 0 <0.000016>
10:35:49.863252 mprotect(0x7ce4a11e0000, 65536, PROT_READ) = 0 <0.000015>
10:35:49.863305 munmap(0x7ce4a1150000, 143482) = 0 <0.000022>
10:35:49.863446 brk(NULL)               = 0x75b12a50000 <0.000011>
10:35:49.863495 brk(0x75b12a80000)      = 0x75b12a80000 <0.000014>
10:35:49.863561 openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 <0.000019>
10:35:49.863624 fstat(3, {st_mode=S_IFREG|0644, st_size=6035920, ...}) = 0 <0.000010>
10:35:49.863677 mmap(NULL, 6035920, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7ce4a0930000 <0.000017>
10:35:49.863736 close(3)                = 0 <0.000011>
10:35:49.863828 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 <0.000010>
10:35:49.863881 openat(AT_FDCWD, "/sys/kernel/debug/kmemleak", O_RDONLY) = 3 <0.000034>
10:35:49.863956 fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 <0.000029>
10:35:49.864028 fadvise64(3, 0, 0, POSIX_FADV_SEQUENTIAL) = 0 <0.000011>
10:35:49.864076 mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ce4a08f0000 <0.000017>
10:35:49.864146 read(3, "", 131072)     = 0 <3.528503>
10:35:53.392797 munmap(0x7ce4a08f0000, 262144) = 0 <0.000092>
10:35:53.392957 close(3)                = 0 <0.000029>
10:35:53.393038 close(1)                = 0 <0.000010>
10:35:53.393078 close(2)                = 0 <0.000009>
10:35:53.393123 exit_group(0)           = ?
10:35:53.393280 +++ exited with 0 +++
$ uname -a
Linux flughafenberlinbrandenburgwillybrandt 5.0.0-rc5+ #1 SMP Thu Feb 7 11:23:11 CET 2019 ppc64le ppc64le ppc64le GNU/Linux
$ more /proc/version
Linux version 5.0.0-rc5+ (pmenzel@flughafenberlinbrandenburgwillybrandt) (gcc version 8.2.0 (Ubuntu 8.2.0-7ubuntu1)) #1 SMP Thu Feb 7 11:23:11 CET 2019
$ more /proc/cmdline
root=UUID=2c3dd738-785a-469b-843e-9f0ba8b47b0d ro rootflags=subvol=@ quiet splash
$ grep KMEMLEAK /boot/config-5.0.0-rc5+
CONFIG_HAVE_DEBUG_KMEMLEAK=y
CONFIG_DEBUG_KMEMLEAK=y
CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=10000
# CONFIG_DEBUG_KMEMLEAK_TEST is not set
# CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF is not set
CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN=y
$ grep KMEMLEAK /boot/config-4.18.0-rc4+
CONFIG_HAVE_DEBUG_KMEMLEAK=y
CONFIG_DEBUG_KMEMLEAK=y
CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=10000
# CONFIG_DEBUG_KMEMLEAK_TEST is not set
# CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF is not set
$ dmesg | grep leak
[    4.407957] kmemleak: Kernel memory leak detector initialized
[    4.407959] kmemleak: Automatic memory scanning thread started
[745989.625624] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[1002619.951902] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
```

Unfortunately, the leaks supposedly stored in that file are not shown
either.


Kind regards,

Paul

[-- Attachment #1.2: 20190219–linux-5.0-rc5+–messages.txt --]
[-- Type: text/plain, Size: 78023 bytes --]

[    0.000000] hash-mmu: Page sizes from device-tree:
[    0.000000] hash-mmu: base_shift=12: shift=12, sllp=0x0000, avpnm=0x00000000, tlbiel=1, penc=0
[    0.000000] hash-mmu: base_shift=12: shift=16, sllp=0x0000, avpnm=0x00000000, tlbiel=1, penc=7
[    0.000000] hash-mmu: base_shift=12: shift=24, sllp=0x0000, avpnm=0x00000000, tlbiel=1, penc=56
[    0.000000] hash-mmu: base_shift=16: shift=16, sllp=0x0110, avpnm=0x00000000, tlbiel=1, penc=1
[    0.000000] hash-mmu: base_shift=16: shift=24, sllp=0x0110, avpnm=0x00000000, tlbiel=1, penc=8
[    0.000000] hash-mmu: base_shift=20: shift=20, sllp=0x0130, avpnm=0x00000000, tlbiel=0, penc=2
[    0.000000] hash-mmu: base_shift=24: shift=24, sllp=0x0100, avpnm=0x00000001, tlbiel=0, penc=0
[    0.000000] hash-mmu: base_shift=34: shift=34, sllp=0x0120, avpnm=0x000007ff, tlbiel=0, penc=3
[    0.000000] Page orders: linear mapping = 24, virtual = 16, io = 16, vmemmap = 24
[    0.000000] Using 1TB segments
[    0.000000] hash-mmu: Initializing hash mmu with SLB
[    0.000000] Linux version 5.0.0-rc5+ (pmenzel@flughafenberlinbrandenburgwillybrandt) (gcc version 8.2.0 (Ubuntu 8.2.0-7ubuntu1)) #1 SMP Thu Feb 7 11:23:11 CET 2019
[    0.000000] Found initrd at 0xc000000003670000:0xc000000007498f84
[    0.000000] OPAL: Found non-mapped LPC bus on chip 0
[    0.000000] Using PowerNV machine description
[    0.000000] printk: bootconsole [udbg0] enabled
[    0.000000] CPU maps initialized for 8 threads per core
[    0.000000]  (thread shift is 3)
[    0.000000] Allocated 5760 bytes for 160 pacas
[    0.000000] -----------------------------------------------------
[    0.000000] ppc64_pft_size    = 0x0
[    0.000000] phys_mem_size     = 0x10000000000
[    0.000000] dcache_bsize      = 0x80
[    0.000000] icache_bsize      = 0x80
[    0.000000] cpu_features      = 0x000000ff8f5db1a7
[    0.000000]   possible        = 0x0000fbffcf5fb1a7
[    0.000000]   always          = 0x00000003800081a1
[    0.000000] cpu_user_features = 0xdc0065c2 0xef000000
[    0.000000] mmu_features      = 0x7c006001
[    0.000000] firmware_features = 0x0000000110000000
[    0.000000] htab_address      = 0x(____ptrval____)
[    0.000000] htab_hash_mask    = 0x7fffff
[    0.000000] -----------------------------------------------------
[    0.000000] cma: Reserved 52432 MiB at 0x000000f2b3000000
[    0.000000] numa:   NODE_DATA [mem 0x7fff95c980-0x7fff963fff]
[    0.000000] numa:   NODE_DATA [mem 0xffff080980-0xffff087fff]
[    0.000000] Section 65534 and 65535 (node 8) have a circular dependency on usemap and pgdat allocations
[    0.000000] rfi-flush: ori type flush available
[    0.000000] rfi-flush: patched 9 locations (ori type flush)
[    0.000000] count-cache-flush: software flush disabled.
[    0.000000] stf-barrier: hwsync barrier available
[    0.000000] stf-barrier: patched 61 entry locations (hwsync barrier)
[    0.000000] stf-barrier: patched 9 exit locations (hwsync barrier)
[    0.000000] Initializing IODA2 PHB (/pciex@3fffe40000000)
[    0.000000] PCI host bridge /pciex@3fffe40000000 (primary) ranges:
[    0.000000]  MEM 0x00003fe000000000..0x00003fe07ffeffff -> 0x0000000080000000 
[    0.000000]  MEM 0x0000200000000000..0x000020ffffffffff -> 0x0000200000000000 (M64 #0..15)
[    0.000000]  Using M64 #15 as default window
[    0.000000]   256 (255) PE's M32: 0x80000000 [segment=0x800000]
[    0.000000]                  M64: 0x10000000000 [segment=0x100000000]
[    0.000000]   Allocated bitmap for 2040 MSIs (base IRQ 0x800)
[    0.000000] Initializing IODA2 PHB (/pciex@3fffe40100000)
[    0.000000] PCI host bridge /pciex@3fffe40100000  ranges:
[    0.000000]  MEM 0x00003fe080000000..0x00003fe0fffeffff -> 0x0000000080000000 
[    0.000000]  MEM 0x0000210000000000..0x000021ffffffffff -> 0x0000210000000000 (M64 #0..15)
[    0.000000]  Using M64 #15 as default window
[    0.000000]   256 (255) PE's M32: 0x80000000 [segment=0x800000]
[    0.000000]                  M64: 0x10000000000 [segment=0x100000000]
[    0.000000]   Allocated bitmap for 2040 MSIs (base IRQ 0x1000)
[    0.000000] Initializing IODA2 PHB (/pciex@3fffe41000000)
[    0.000000] PCI host bridge /pciex@3fffe41000000  ranges:
[    0.000000]  MEM 0x00003fe800000000..0x00003fe87ffeffff -> 0x0000000080000000 
[    0.000000]  MEM 0x0000240000000000..0x000024ffffffffff -> 0x0000240000000000 (M64 #0..15)
[    0.000000]  Using M64 #15 as default window
[    0.000000]   256 (255) PE's M32: 0x80000000 [segment=0x800000]
[    0.000000]                  M64: 0x10000000000 [segment=0x100000000]
[    0.000000]   Allocated bitmap for 2040 MSIs (base IRQ 0x10800)
[    0.000000] Initializing IODA2 PHB (/pciex@3fffe41100000)
[    0.000000] PCI host bridge /pciex@3fffe41100000  ranges:
[    0.000000]  MEM 0x00003fe880000000..0x00003fe8fffeffff -> 0x0000000080000000 
[    0.000000]  MEM 0x0000250000000000..0x000025ffffffffff -> 0x0000250000000000 (M64 #0..15)
[    0.000000]  Using M64 #15 as default window
[    0.000000]   256 (255) PE's M32: 0x80000000 [segment=0x800000]
[    0.000000]                  M64: 0x10000000000 [segment=0x100000000]
[    0.000000]   Allocated bitmap for 2040 MSIs (base IRQ 0x11000)
[    0.000000] Initializing IODA2 PHB (/pciex@3fffe41200000)
[    0.000000] PCI host bridge /pciex@3fffe41200000  ranges:
[    0.000000]  MEM 0x00003fe900000000..0x00003fe97ffeffff -> 0x0000000080000000 
[    0.000000]  MEM 0x0000260000000000..0x000026ffffffffff -> 0x0000260000000000 (M64 #0..15)
[    0.000000]  Using M64 #15 as default window
[    0.000000]   256 (255) PE's M32: 0x80000000 [segment=0x800000]
[    0.000000]                  M64: 0x10000000000 [segment=0x100000000]
[    0.000000]   Allocated bitmap for 2040 MSIs (base IRQ 0x11800)
[    0.000000] OPAL nvram setup, 589824 bytes
[    0.000000] barrier-nospec: using ORI speculation barrier
[    0.000000] barrier-nospec: patched 532 locations
[    0.000000] Top of RAM: 0x10000000000, Total RAM: 0x10000000000
[    0.000000] Memory hole size: 0MB
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000ffffffffff]
[    0.000000]   Device   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000007fffffffff]
[    0.000000]   node   8: [mem 0x0000008000000000-0x000000ffffffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000007fffffffff]
[    0.000000] On node 0 totalpages: 8388608
[    0.000000]   Normal zone: 8192 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 8388608 pages, LIFO batch:3
[    0.000000] Initmem setup node 8 [mem 0x0000008000000000-0x000000ffffffffff]
[    0.000000] On node 8 totalpages: 8388608
[    0.000000]   Normal zone: 8192 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 8388608 pages, LIFO batch:3
[    0.000000] random: get_random_u64 called from start_kernel+0xbc/0x6b8 with crng_init=0
[    0.000000] percpu: Embedded 4 pages/cpu @(____ptrval____) s173336 r0 d88808 u262144
[    0.000000] pcpu-alloc: s173336 r0 d88808 u262144 alloc=1*1048576
[    0.000000] pcpu-alloc: [0] 000 001 002 003 [0] 004 005 006 007 
[    0.000000] pcpu-alloc: [0] 008 009 010 011 [0] 012 013 014 015 
[    0.000000] pcpu-alloc: [0] 016 017 018 019 [0] 020 021 022 023 
[    0.000000] pcpu-alloc: [0] 024 025 026 027 [0] 028 029 030 031 
[    0.000000] pcpu-alloc: [0] 032 033 034 035 [0] 036 037 038 039 
[    0.000000] pcpu-alloc: [0] 040 041 042 043 [0] 044 045 046 047 
[    0.000000] pcpu-alloc: [0] 048 049 050 051 [0] 052 053 054 055 
[    0.000000] pcpu-alloc: [0] 056 057 058 059 [0] 060 061 062 063 
[    0.000000] pcpu-alloc: [0] 064 065 066 067 [0] 068 069 070 071 
[    0.000000] pcpu-alloc: [0] 072 073 074 075 [0] 076 077 078 079 
[    0.000000] pcpu-alloc: [1] 080 081 082 083 [1] 084 085 086 087 
[    0.000000] pcpu-alloc: [1] 088 089 090 091 [1] 092 093 094 095 
[    0.000000] pcpu-alloc: [1] 096 097 098 099 [1] 100 101 102 103 
[    0.000000] pcpu-alloc: [1] 104 105 106 107 [1] 108 109 110 111 
[    0.000000] pcpu-alloc: [1] 112 113 114 115 [1] 116 117 118 119 
[    0.000000] pcpu-alloc: [1] 120 121 122 123 [1] 124 125 126 127 
[    0.000000] pcpu-alloc: [1] 128 129 130 131 [1] 132 133 134 135 
[    0.000000] pcpu-alloc: [1] 136 137 138 139 [1] 140 141 142 143 
[    0.000000] pcpu-alloc: [1] 144 145 146 147 [1] 148 149 150 151 
[    0.000000] pcpu-alloc: [1] 152 153 154 155 [1] 156 157 158 159 
[    0.000000] Built 2 zonelists, mobility grouping on.  Total pages: 16760832
[    0.000000] Policy zone: Normal
[    0.000000] Kernel command line: root=UUID=2c3dd738-785a-469b-843e-9f0ba8b47b0d ro rootflags=subvol=@ quiet splash
[    0.000000] printk: log_buf_len individual max cpu contribution: 4096 bytes
[    0.000000] printk: log_buf_len total cpu_extra contributions: 651264 bytes
[    0.000000] printk: log_buf_len min size: 131072 bytes
[    0.000000] printk: log_buf_len: 1048576 bytes
[    0.000000] printk: early log buf free: 121908(93%)
[    0.000000] Memory: 1017704704K/1073741824K available (15872K kernel code, 2944K rwdata, 3968K rodata, 8320K init, 3097K bss, 2346752K reserved, 53690368K cma-reserved)
[    0.000000] SLUB: HWalign=128, Order=0-3, MinObjects=0, CPUs=160, Nodes=9
[    0.000000] ftrace: allocating 36618 entries in 14 pages
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=2048 to nr_cpu_ids=160.
[    0.000000] 	Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=160
[    0.000000] NR_IRQS: 512, nr_irqs: 512, preallocated irqs: 16
[    0.000000] ICS OPAL backend registered
[    0.000000] time_init: decrementer frequency = 512.000000 MHz
[    0.000000] time_init: processor frequency   = 2926.000000 MHz
[    0.000005] clocksource: timebase: mask: 0xffffffffffffffff max_cycles: 0x761537d007, max_idle_ns: 440795202126 ns
[    0.000009] clocksource: timebase mult[1f40000] shift[24] registered
[    0.000020] clockevent: decrementer mult[83126e98] shift[32] cpu[0]
[    0.000511] Console: colour dummy device 80x25
[    0.000689] printk: console [hvc0] enabled
[    0.000692] printk: bootconsole [udbg0] disabled
[    0.020961] mempolicy: Enabling automatic NUMA balancing. Configure with numa_balancing= or the kernel.numa_balancing sysctl
[    0.020970] pid_max: default: 163840 minimum: 1280
[    0.025956] LSM: Security Framework initializing
[    0.025963] Yama: becoming mindful.
[    0.026454] AppArmor: AppArmor initialized
[    0.048865] Dentry cache hash table entries: 33554432 (order: 12, 268435456 bytes)
[    0.060111] Inode-cache hash table entries: 16777216 (order: 11, 134217728 bytes)
[    0.061420] Mount-cache hash table entries: 524288 (order: 6, 4194304 bytes)
[    0.061769] Mountpoint-cache hash table entries: 524288 (order: 6, 4194304 bytes)
[    0.072031] EEH: PowerNV platform initialized
[    0.072037] POWER8 performance monitor hardware support registered
[    0.072556] rcu: Hierarchical SRCU implementation.
[    0.078629] smp: Bringing up secondary CPUs ...
[    1.117888] smp: Brought up 2 nodes, 160 CPUs
[    1.117895] numa: Node 0 CPUs: 0-79
[    1.117907] numa: Node 8 CPUs: 80-159
[    1.117920] Using standard scheduler topology
[    1.207749] devtmpfs: initialized
[    1.868929] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    1.869115] futex hash table entries: 65536 (order: 7, 8388608 bytes)
[    1.952040] pinctrl core: initialized pinctrl subsystem
[    1.961759] NET: Registered protocol family 16
[    1.963387] audit: initializing netlink subsys (disabled)
[    1.963937] audit: type=2000 audit(1549541641.960:1): state=initialized audit_enabled=0 res=1
[    1.965754] cpuidle: using governor ladder
[    1.966601] cpuidle: using governor menu
[    1.966920] pstore: Registered nvram as persistent store backend
[    2.359146] PCI: Probing PCI hardware
[    2.359419] PCI host bridge to bus 0000:00
[    2.359439] pci_bus 0000:00: root bus resource [mem 0x3fe000000000-0x3fe07ffeffff] (bus address [0x80000000-0xfffeffff])
[    2.359451] pci_bus 0000:00: root bus resource [mem 0x200000000000-0x20fdffffffff 64bit pref]
[    2.359462] pci_bus 0000:00: root bus resource [bus 00-ff]
[    2.359473] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to ff
[    2.359561] pci 0000:00:00.0: [1014:03dc] type 01 class 0x060400
[    2.359888] pci 0000:00:00.0: PME# supported from D0 D3hot D3cold
[    2.377240] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[    2.377327] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to ff
[    2.377586] PCI host bridge to bus 0001:00
[    2.377601] pci_bus 0001:00: root bus resource [mem 0x3fe080000000-0x3fe0fffeffff] (bus address [0x80000000-0xfffeffff])
[    2.377612] pci_bus 0001:00: root bus resource [mem 0x210000000000-0x21fdffffffff 64bit pref]
[    2.377623] pci_bus 0001:00: root bus resource [bus 00-ff]
[    2.377632] pci_bus 0001:00: busn_res: [bus 00-ff] end is updated to ff
[    2.377695] pci 0001:00:00.0: [1014:03dc] type 01 class 0x060400
[    2.378005] pci 0001:00:00.0: PME# supported from D0 D3hot D3cold
[    2.387148] pci 0001:01:00.0: [14e4:168a] type 00 class 0x020000
[    2.387279] pci 0001:01:00.0: reg 0x10: [mem 0x210000000000-0x2100007fffff 64bit pref]
[    2.387334] pci 0001:01:00.0: reg 0x18: [mem 0x210000800000-0x210000ffffff 64bit pref]
[    2.387388] pci 0001:01:00.0: reg 0x20: [mem 0x210004000000-0x21000400ffff 64bit pref]
[    2.387426] pci 0001:01:00.0: reg 0x30: [mem 0x00000000-0x0003ffff pref]
[    2.387784] pci 0001:01:00.0: PME# supported from D0 D3hot D3cold
[    2.388379] pci 0001:01:00.1: [14e4:168a] type 00 class 0x020000
[    2.388505] pci 0001:01:00.1: reg 0x10: [mem 0x210001000000-0x2100017fffff 64bit pref]
[    2.388562] pci 0001:01:00.1: reg 0x18: [mem 0x210001800000-0x210001ffffff 64bit pref]
[    2.388618] pci 0001:01:00.1: reg 0x20: [mem 0x210004010000-0x21000401ffff 64bit pref]
[    2.388658] pci 0001:01:00.1: reg 0x30: [mem 0x00000000-0x0003ffff pref]
[    2.389008] pci 0001:01:00.1: PME# supported from D0 D3hot D3cold
[    2.389569] pci 0001:01:00.2: [14e4:168a] type 00 class 0x020000
[    2.389698] pci 0001:01:00.2: reg 0x10: [mem 0x210002000000-0x2100027fffff 64bit pref]
[    2.389755] pci 0001:01:00.2: reg 0x18: [mem 0x210002800000-0x210002ffffff 64bit pref]
[    2.389811] pci 0001:01:00.2: reg 0x20: [mem 0x210004020000-0x21000402ffff 64bit pref]
[    2.389850] pci 0001:01:00.2: reg 0x30: [mem 0x00000000-0x0003ffff pref]
[    2.390204] pci 0001:01:00.2: PME# supported from D0 D3hot D3cold
[    2.390749] pci 0001:01:00.3: [14e4:168a] type 00 class 0x020000
[    2.390880] pci 0001:01:00.3: reg 0x10: [mem 0x210003000000-0x2100037fffff 64bit pref]
[    2.390938] pci 0001:01:00.3: reg 0x18: [mem 0x210003800000-0x210003ffffff 64bit pref]
[    2.390996] pci 0001:01:00.3: reg 0x20: [mem 0x210004030000-0x21000403ffff 64bit pref]
[    2.391036] pci 0001:01:00.3: reg 0x30: [mem 0x00000000-0x0003ffff pref]
[    2.391396] pci 0001:01:00.3: PME# supported from D0 D3hot D3cold
[    2.400140] pci 0001:00:00.0: PCI bridge to [bus 01]
[    2.402160] pci_bus 0001:00: busn_res: [bus 00-ff] end is updated to 01
[    2.402424] PCI host bridge to bus 0020:00
[    2.402439] pci_bus 0020:00: root bus resource [mem 0x3fe800000000-0x3fe87ffeffff] (bus address [0x80000000-0xfffeffff])
[    2.402450] pci_bus 0020:00: root bus resource [mem 0x240000000000-0x24fdffffffff 64bit pref]
[    2.402460] pci_bus 0020:00: root bus resource [bus 00-ff]
[    2.402469] pci_bus 0020:00: busn_res: [bus 00-ff] end is updated to ff
[    2.402535] pci 0020:00:00.0: [1014:03dc] type 01 class 0x060400
[    2.402864] pci 0020:00:00.0: PME# supported from D0 D3hot D3cold
[    2.420073] pci 0020:00:00.0: PCI bridge to [bus 01-ff]
[    2.420161] pci_bus 0020:00: busn_res: [bus 00-ff] end is updated to ff
[    2.420446] PCI host bridge to bus 0021:00
[    2.420461] pci_bus 0021:00: root bus resource [mem 0x3fe880000000-0x3fe8fffeffff] (bus address [0x80000000-0xfffeffff])
[    2.420472] pci_bus 0021:00: root bus resource [mem 0x250000000000-0x25fdffffffff 64bit pref]
[    2.420483] pci_bus 0021:00: root bus resource [bus 00-ff]
[    2.420492] pci_bus 0021:00: busn_res: [bus 00-ff] end is updated to ff
[    2.420555] pci 0021:00:00.0: [1014:03dc] type 01 class 0x060400
[    2.420873] pci 0021:00:00.0: PME# supported from D0 D3hot D3cold
[    2.429896] pci 0021:01:00.0: [10b5:8725] type 01 class 0x060400
[    2.430021] pci 0021:01:00.0: reg 0x10: [mem 0x3fe883000000-0x3fe88303ffff]
[    2.430461] pci 0021:01:00.0: PME# supported from D0 D3hot D3cold
[    2.431116] pci 0021:01:00.1: [10b5:87d0] type 00 class 0x088000
[    2.431226] pci 0021:01:00.1: reg 0x10: [mem 0x3fe883040000-0x3fe883041fff]
[    2.431392] pci 0021:01:00.1: enabling Extended Tags
[    2.431435] pci 0021:01:00.1: BAR0 [mem size 0x00002000]: requesting alignment to 0x10000
[    2.432061] pci 0021:01:00.2: [10b5:87d0] type 00 class 0x088000
[    2.432173] pci 0021:01:00.2: reg 0x10: [mem 0x3fe883042000-0x3fe883043fff]
[    2.432340] pci 0021:01:00.2: enabling Extended Tags
[    2.432383] pci 0021:01:00.2: BAR0 [mem size 0x00002000]: requesting alignment to 0x10000
[    2.432974] pci 0021:01:00.3: [10b5:87d0] type 00 class 0x088000
[    2.433088] pci 0021:01:00.3: reg 0x10: [mem 0x3fe883044000-0x3fe883045fff]
[    2.433260] pci 0021:01:00.3: enabling Extended Tags
[    2.433303] pci 0021:01:00.3: BAR0 [mem size 0x00002000]: requesting alignment to 0x10000
[    2.433900] pci 0021:01:00.4: [10b5:87d0] type 00 class 0x088000
[    2.434015] pci 0021:01:00.4: reg 0x10: [mem 0x3fe883046000-0x3fe883047fff]
[    2.434187] pci 0021:01:00.4: enabling Extended Tags
[    2.434232] pci 0021:01:00.4: BAR0 [mem size 0x00002000]: requesting alignment to 0x10000
[    2.443036] pci 0021:00:00.0: PCI bridge to [bus 01-15]
[    2.444795] pci 0021:02:01.0: [10b5:8725] type 01 class 0x060400
[    2.445410] pci 0021:02:01.0: PME# supported from D0 D3hot D3cold
[    2.447789] pci 0021:02:08.0: [10b5:8725] type 01 class 0x060400
[    2.448412] pci 0021:02:08.0: PME# supported from D0 D3hot D3cold
[    2.449254] pci 0021:02:09.0: [10b5:8725] type 01 class 0x060400
[    2.449882] pci 0021:02:09.0: PME# supported from D0 D3hot D3cold
[    2.450698] pci 0021:02:0a.0: [10b5:8725] type 01 class 0x060400
[    2.451336] pci 0021:02:0a.0: PME# supported from D0 D3hot D3cold
[    2.452162] pci 0021:02:0b.0: [10b5:8725] type 01 class 0x060400
[    2.452805] pci 0021:02:0b.0: PME# supported from D0 D3hot D3cold
[    2.453691] pci 0021:02:0c.0: [10b5:8725] type 01 class 0x060400
[    2.454343] pci 0021:02:0c.0: PME# supported from D0 D3hot D3cold
[    2.460060] pci 0021:01:00.0: PCI bridge to [bus 02-15]
[    2.470011] pci 0021:02:01.0: PCI bridge to [bus 03-07]
[    2.478675] pci 0021:02:08.0: PCI bridge to [bus 08-0c]
[    2.479104] pci 0021:0d:00.0: [104c:8241] type 00 class 0x0c0330
[    2.479238] pci 0021:0d:00.0: reg 0x10: [mem 0x3fe880800000-0x3fe88080ffff 64bit]
[    2.479307] pci 0021:0d:00.0: reg 0x18: [mem 0x3fe880810000-0x3fe880811fff 64bit]
[    2.479487] pci 0021:0d:00.0: BAR2 [mem size 0x00002000 64bit]: requesting alignment to 0x10000
[    2.479739] pci 0021:0d:00.0: supports D1 D2
[    2.479747] pci 0021:0d:00.0: PME# supported from D0 D1 D2 D3hot
[    2.488510] pci 0021:02:09.0: PCI bridge to [bus 0d]
[    2.488953] pci 0021:0e:00.0: [1b4b:9235] type 00 class 0x010601
[    2.489061] pci 0021:0e:00.0: reg 0x10: [io  0x8000-0x8007]
[    2.489109] pci 0021:0e:00.0: reg 0x14: [io  0x8040-0x8043]
[    2.489164] pci 0021:0e:00.0: reg 0x18: [io  0x8100-0x8107]
[    2.489210] pci 0021:0e:00.0: reg 0x1c: [io  0x8140-0x8143]
[    2.489256] pci 0021:0e:00.0: reg 0x20: [io  0x800000-0x80001f]
[    2.489303] pci 0021:0e:00.0: reg 0x24: [mem 0x3fe881010000-0x3fe8810107ff]
[    2.489351] pci 0021:0e:00.0: reg 0x30: [mem 0x3fe8d0000000-0x3fe8d000ffff pref]
[    2.489420] pci 0021:0e:00.0: BAR5 [mem size 0x00000800]: requesting alignment to 0x10000
[    2.489646] pci 0021:0e:00.0: PME# supported from D3hot
[    2.498389] pci 0021:02:0a.0: PCI bridge to [bus 0e]
[    2.498868] pci 0021:0f:00.0: [1a03:1150] type 01 class 0x060400
[    2.499141] pci 0021:0f:00.0: enabling Extended Tags
[    2.499478] pci 0021:0f:00.0: supports D1 D2
[    2.499486] pci 0021:0f:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[    2.508229] pci 0021:02:0b.0: PCI bridge to [bus 0f-10]
[    2.508512] pci_bus 0021:10: extended config space not accessible
[    2.508743] pci 0021:10:00.0: [1a03:2000] type 00 class 0x030000
[    2.508837] pci 0021:10:00.0: reg 0x10: [mem 0x3fe882000000-0x3fe882ffffff]
[    2.508891] pci 0021:10:00.0: reg 0x14: [mem 0x3fe881800000-0x3fe88181ffff]
[    2.508943] pci 0021:10:00.0: reg 0x18: [io  0x0000-0x007f]
[    2.509333] pci 0021:10:00.0: supports D1 D2
[    2.509341] pci 0021:10:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[    2.518026] pci 0021:0f:00.0: PCI bridge to [bus 10]
[    2.526714] pci 0021:02:0c.0: PCI bridge to [bus 11-15]
[    2.526958] pci_bus 0021:00: busn_res: [bus 00-ff] end is updated to 15
[    2.527270] PCI host bridge to bus 0022:00
[    2.527285] pci_bus 0022:00: root bus resource [mem 0x3fe900000000-0x3fe97ffeffff] (bus address [0x80000000-0xfffeffff])
[    2.527296] pci_bus 0022:00: root bus resource [mem 0x260000000000-0x26fdffffffff 64bit pref]
[    2.527307] pci_bus 0022:00: root bus resource [bus 00-ff]
[    2.527316] pci_bus 0022:00: busn_res: [bus 00-ff] end is updated to ff
[    2.527382] pci 0022:00:00.0: [1014:03dc] type 01 class 0x060400
[    2.527701] pci 0022:00:00.0: PME# supported from D0 D3hot D3cold
[    2.544984] pci 0022:00:00.0: PCI bridge to [bus 01-ff]
[    2.545072] pci_bus 0022:00: busn_res: [bus 00-ff] end is updated to ff
[    2.545133] pci 0000:00     : [PE# fe] Secondary bus 0 associated with PE#fe
[    2.545712] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[    2.545757] pci_bus 0000:00: resource 4 [mem 0x3fe000000000-0x3fe07ffeffff]
[    2.545767] pci_bus 0000:00: resource 5 [mem 0x200000000000-0x20fdffffffff 64bit pref]
[    2.545825] pci 0001:00:00.0: BAR 15: assigned [mem 0x210000000000-0x2100ffffffff 64bit pref]
[    2.545835] pci 0001:00:00.0: BAR 14: assigned [mem 0x3fe080000000-0x3fe0807fffff]
[    2.545893] pci 0001:01:00.0: BAR 0: assigned [mem 0x210000000000-0x2100007fffff 64bit pref]
[    2.545937] pci 0001:01:00.0: BAR 2: assigned [mem 0x210000800000-0x210000ffffff 64bit pref]
[    2.545977] pci 0001:01:00.1: BAR 0: assigned [mem 0x210001000000-0x2100017fffff 64bit pref]
[    2.546018] pci 0001:01:00.1: BAR 2: assigned [mem 0x210001800000-0x210001ffffff 64bit pref]
[    2.546058] pci 0001:01:00.2: BAR 0: assigned [mem 0x210002000000-0x2100027fffff 64bit pref]
[    2.546099] pci 0001:01:00.2: BAR 2: assigned [mem 0x210002800000-0x210002ffffff 64bit pref]
[    2.546141] pci 0001:01:00.3: BAR 0: assigned [mem 0x210003000000-0x2100037fffff 64bit pref]
[    2.546181] pci 0001:01:00.3: BAR 2: assigned [mem 0x210003800000-0x210003ffffff 64bit pref]
[    2.546222] pci 0001:01:00.0: BAR 6: assigned [mem 0x3fe080000000-0x3fe08003ffff pref]
[    2.546233] pci 0001:01:00.1: BAR 6: assigned [mem 0x3fe080040000-0x3fe08007ffff pref]
[    2.546243] pci 0001:01:00.2: BAR 6: assigned [mem 0x3fe080080000-0x3fe0800bffff pref]
[    2.546253] pci 0001:01:00.3: BAR 6: assigned [mem 0x3fe0800c0000-0x3fe0800fffff pref]
[    2.546264] pci 0001:01:00.0: BAR 4: assigned [mem 0x210004000000-0x21000400ffff 64bit pref]
[    2.546303] pci 0001:01:00.1: BAR 4: assigned [mem 0x210004010000-0x21000401ffff 64bit pref]
[    2.546344] pci 0001:01:00.2: BAR 4: assigned [mem 0x210004020000-0x21000402ffff 64bit pref]
[    2.546385] pci 0001:01:00.3: BAR 4: assigned [mem 0x210004030000-0x21000403ffff 64bit pref]
[    2.546444] pci 0001:00     : [PE# fe] Secondary bus 0 associated with PE#fe
[    2.547067] pci 0001:01     : [PE# 00] Secondary bus 1 associated with PE#0
[    2.547655] pci 0001:01     : [PE# 00] Setting up 32-bit TCE table at 0..80000000
[    2.587514] IOMMU table initialized, virtual merging enabled
[    2.587524] pci 0001:01     : [PE# 00] Setting up window#0 0..7fffffff pg=1000
[    2.587753] pci 0001:01     : [PE# 00] Enabling 64-bit DMA bypass
[    2.587764] pci 0001:00:00.0: PCI bridge to [bus 01]
[    2.587785] pci 0001:00:00.0:   bridge window [mem 0x3fe080000000-0x3fe0ffefffff]
[    2.587802] pci 0001:00:00.0:   bridge window [mem 0x210000000000-0x21fdfff0ffff 64bit pref]
[    2.587827] pci_bus 0001:00: resource 4 [mem 0x3fe080000000-0x3fe0fffeffff]
[    2.587836] pci_bus 0001:00: resource 5 [mem 0x210000000000-0x21fdffffffff 64bit pref]
[    2.587845] pci_bus 0001:01: resource 1 [mem 0x3fe080000000-0x3fe0ffefffff]
[    2.587854] pci_bus 0001:01: resource 2 [mem 0x210000000000-0x21fdfff0ffff 64bit pref]
[    2.587894] pci 0020:00     : [PE# fe] Secondary bus 0 associated with PE#fe
[    2.588475] pci 0020:00:00.0: PCI bridge to [bus 01-ff]
[    2.588520] pci_bus 0020:00: resource 4 [mem 0x3fe800000000-0x3fe87ffeffff]
[    2.588529] pci_bus 0020:00: resource 5 [mem 0x240000000000-0x24fdffffffff 64bit pref]
[    2.588577] pci 0021:02:01.0: bridge window [io  0x1000-0x0fff] to [bus 03-07] add_size 1000
[    2.588592] pci 0021:02:01.0: bridge window [mem 0x100000000-0xffffffff 64bit pref] to [bus 03-07] add_size 100000000 add_align 100000000
[    2.588605] pci 0021:02:01.0: bridge window [mem 0x00800000-0x007fffff] to [bus 03-07] add_size 800000 add_align 800000
[    2.588848] pci 0021:01:00.0: bridge window [io  0x1000-0x2fff] to [bus 02-15] add_size 1000
[    2.588866] pci 0021:01:00.0: bridge window [mem 0x100000000-0x1ffffffff 64bit pref] to [bus 02-15] add_size 100000000 add_align 100000000
[    2.588884] pci 0021:01:00.0: bridge window [mem 0x00800000-0x037fffff] to [bus 02-15] add_size 800000 add_align 800000
[    2.588922] pci 0021:00:00.0: bridge window [io  0x1000-0x2fff] to [bus 01-15] add_size 1000
[    2.588939] pci 0021:00:00.0: bridge window [mem 0x100000000-0x1ffffffff 64bit pref] to [bus 01-15] add_size 100000000 add_align 100000000
[    2.588958] pci 0021:00:00.0: bridge window [mem 0x00800000-0x03ffffff] to [bus 01-15] add_size 800000 add_align 800000
[    2.588983] pci 0021:00:00.0: BAR 15: assigned [mem 0x250000000000-0x2501ffffffff 64bit pref]
[    2.588993] pci 0021:00:00.0: BAR 14: assigned [mem 0x3fe880000000-0x3fe883ffffff]
[    2.589002] pci 0021:00:00.0: BAR 13: no space for [io  size 0x3000]
[    2.589009] pci 0021:00:00.0: BAR 13: failed to assign [io  size 0x3000]
[    2.589029] pci 0021:00:00.0: BAR 13: no space for [io  size 0x2000]
[    2.589036] pci 0021:00:00.0: BAR 13: failed to assign [io  size 0x2000]
[    2.589091] pci 0021:01:00.0: BAR 15: assigned [mem 0x250000000000-0x2501ffffffff 64bit pref]
[    2.589101] pci 0021:01:00.0: BAR 14: assigned [mem 0x3fe880000000-0x3fe8837fffff]
[    2.589110] pci 0021:01:00.0: BAR 0: assigned [mem 0x3fe883800000-0x3fe88383ffff]
[    2.589129] pci 0021:01:00.1: BAR 0: assigned [mem 0x3fe883840000-0x3fe883841fff]
[    2.589148] pci 0021:01:00.2: BAR 0: assigned [mem 0x3fe883850000-0x3fe883851fff]
[    2.589167] pci 0021:01:00.3: BAR 0: assigned [mem 0x3fe883860000-0x3fe883861fff]
[    2.589187] pci 0021:01:00.4: BAR 0: assigned [mem 0x3fe883870000-0x3fe883871fff]
[    2.589205] pci 0021:01:00.0: BAR 13: no space for [io  size 0x3000]
[    2.589213] pci 0021:01:00.0: BAR 13: failed to assign [io  size 0x3000]
[    2.589245] pci 0021:01:00.0: BAR 13: no space for [io  size 0x2000]
[    2.589253] pci 0021:01:00.0: BAR 13: failed to assign [io  size 0x2000]
[    2.589310] pci 0021:02:01.0: BAR 15: assigned [mem 0x250000000000-0x2500ffffffff 64bit pref]
[    2.589320] pci 0021:02:01.0: BAR 14: assigned [mem 0x3fe880000000-0x3fe8807fffff]
[    2.589330] pci 0021:02:09.0: BAR 14: assigned [mem 0x3fe880800000-0x3fe880ffffff]
[    2.589340] pci 0021:02:0a.0: BAR 14: assigned [mem 0x3fe881000000-0x3fe8817fffff]
[    2.589350] pci 0021:02:0b.0: BAR 14: assigned [mem 0x3fe881800000-0x3fe882ffffff]
[    2.589358] pci 0021:02:01.0: BAR 13: no space for [io  size 0x1000]
[    2.589365] pci 0021:02:01.0: BAR 13: failed to assign [io  size 0x1000]
[    2.589376] pci 0021:02:0a.0: BAR 13: no space for [io  size 0x1000]
[    2.589383] pci 0021:02:0a.0: BAR 13: failed to assign [io  size 0x1000]
[    2.589394] pci 0021:02:0b.0: BAR 13: no space for [io  size 0x1000]
[    2.589401] pci 0021:02:0b.0: BAR 13: failed to assign [io  size 0x1000]
[    2.589432] pci 0021:02:0a.0: BAR 13: no space for [io  size 0x1000]
[    2.589440] pci 0021:02:0a.0: BAR 13: failed to assign [io  size 0x1000]
[    2.589451] pci 0021:02:0b.0: BAR 13: no space for [io  size 0x1000]
[    2.589458] pci 0021:02:0b.0: BAR 13: failed to assign [io  size 0x1000]
[    2.589469] pci 0021:02:01.0: BAR 13: no space for [io  size 0x1000]
[    2.589477] pci 0021:02:01.0: BAR 13: failed to assign [io  size 0x1000]
[    2.589491] pci 0021:00     : [PE# fe] Secondary bus 0 associated with PE#fe
[    2.590071] pci 0021:02:01.0: PCI bridge to [bus 03-07]
[    2.590094] pci 0021:02:01.0:   bridge window [mem 0x3fe880000000-0x3fe8807fffff]
[    2.590112] pci 0021:02:01.0:   bridge window [mem 0x250000000000-0x2500ffffffff 64bit pref]
[    2.590136] pci 0021:02:08.0: PCI bridge to [bus 08-0c]
[    2.590193] pci 0021:0d:00.0: BAR 0: assigned [mem 0x3fe880800000-0x3fe88080ffff 64bit]
[    2.590242] pci 0021:0d:00.0: BAR 2: assigned [mem 0x3fe880810000-0x3fe880811fff 64bit]
[    2.590301] pci 0021:0d     : [PE# fd] Secondary bus 13 associated with PE#fd
[    2.590888] pci 0021:0d     : [PE# fd] Setting up 32-bit TCE table at 0..80000000
[    2.631953] pci 0021:0d     : [PE# fd] Setting up window#0 0..7fffffff pg=1000
[    2.632065] pci 0021:0d     : [PE# fd] Enabling 64-bit DMA bypass
[    2.632073] pci 0021:02:09.0: PCI bridge to [bus 0d]
[    2.632097] pci 0021:02:09.0:   bridge window [mem 0x3fe880800000-0x3fe880ffffff]
[    2.632155] pci 0021:0e:00.0: BAR 5: assigned [mem 0x3fe881000000-0x3fe8810007ff]
[    2.632177] pci 0021:0e:00.0: BAR 6: assigned [mem 0x3fe881010000-0x3fe88101ffff pref]
[    2.632186] pci 0021:0e:00.0: BAR 4: no space for [io  size 0x0020]
[    2.632193] pci 0021:0e:00.0: BAR 4: failed to assign [io  size 0x0020]
[    2.632204] pci 0021:0e:00.0: BAR 0: no space for [io  size 0x0008]
[    2.632212] pci 0021:0e:00.0: BAR 0: failed to assign [io  size 0x0008]
[    2.632222] pci 0021:0e:00.0: BAR 2: no space for [io  size 0x0008]
[    2.632229] pci 0021:0e:00.0: BAR 2: failed to assign [io  size 0x0008]
[    2.632238] pci 0021:0e:00.0: BAR 1: no space for [io  size 0x0004]
[    2.632246] pci 0021:0e:00.0: BAR 1: failed to assign [io  size 0x0004]
[    2.632256] pci 0021:0e:00.0: BAR 3: no space for [io  size 0x0004]
[    2.632264] pci 0021:0e:00.0: BAR 3: failed to assign [io  size 0x0004]
[    2.632290] pci 0021:0e     : [PE# fc] Secondary bus 14 associated with PE#fc
[    2.632872] pci 0021:0e     : [PE# fc] Setting up 32-bit TCE table at 0..80000000
[    2.673835] pci 0021:0e     : [PE# fc] Setting up window#0 0..7fffffff pg=1000
[    2.673849] pci 0021:0e     : [PE# fc] Enabling 64-bit DMA bypass
[    2.673857] pci 0021:02:0a.0: PCI bridge to [bus 0e]
[    2.673883] pci 0021:02:0a.0:   bridge window [mem 0x3fe881000000-0x3fe8817fffff]
[    2.673929] pci 0021:0f:00.0: BAR 14: assigned [mem 0x3fe881800000-0x3fe882ffffff]
[    2.673937] pci 0021:0f:00.0: BAR 13: no space for [io  size 0x1000]
[    2.673944] pci 0021:0f:00.0: BAR 13: failed to assign [io  size 0x1000]
[    2.673970] pci 0021:10:00.0: BAR 0: assigned [mem 0x3fe882000000-0x3fe882ffffff]
[    2.673995] pci 0021:10:00.0: BAR 1: assigned [mem 0x3fe881800000-0x3fe88181ffff]
[    2.674016] pci 0021:10:00.0: BAR 2: no space for [io  size 0x0080]
[    2.674023] pci 0021:10:00.0: BAR 2: failed to assign [io  size 0x0080]
[    2.674046] pci 0021:10     : [PE# fb] Secondary bus 16..16 associated with PE#fb
[    2.674628] pci 0021:10     : [PE# fb] Setting up 32-bit TCE table at 0..80000000
[    2.715762] pci 0021:10     : [PE# fb] Setting up window#0 0..7fffffff pg=1000
[    2.715775] pci 0021:10     : [PE# fb] Enabling 64-bit DMA bypass
[    2.715783] pci 0021:0f:00.0: PCI bridge to [bus 10]
[    2.715810] pci 0021:0f:00.0:   bridge window [mem 0x3fe881800000-0x3fe882ffffff]
[    2.715860] pci 0021:0f     : [PE# fa] Secondary bus 15 associated with PE#fa
[    2.716441] pci 0021:02:0b.0: PCI bridge to [bus 0f-10]
[    2.716464] pci 0021:02:0b.0:   bridge window [mem 0x3fe881800000-0x3fe882ffffff]
[    2.716502] pci 0021:02:0c.0: PCI bridge to [bus 11-15]
[    2.716566] pci 0021:02     : [PE# f9] Secondary bus 2 associated with PE#f9
[    2.717145] pci 0021:01:00.0: PCI bridge to [bus 02-15]
[    2.717167] pci 0021:01:00.0:   bridge window [mem 0x3fe880000000-0x3fe8ffefffff]
[    2.717184] pci 0021:01:00.0:   bridge window [mem 0x250000000000-0x25fdfff0ffff 64bit pref]
[    2.717222] pci 0021:01     : [PE# f8] Secondary bus 1 associated with PE#f8
[    2.717806] pci 0021:01     : [PE# f8] Setting up 32-bit TCE table at 0..80000000
[    2.758838] pci 0021:01     : [PE# f8] Setting up window#0 0..7fffffff pg=1000
[    2.758851] pci 0021:01     : [PE# f8] Enabling 64-bit DMA bypass
[    2.758860] pci 0021:00:00.0: PCI bridge to [bus 01-15]
[    2.758882] pci 0021:00:00.0:   bridge window [mem 0x3fe880000000-0x3fe8ffefffff]
[    2.758899] pci 0021:00:00.0:   bridge window [mem 0x250000000000-0x25fdfff0ffff 64bit pref]
[    2.758922] pci_bus 0021:00: Some PCI device resources are unassigned, try booting with pci=realloc
[    2.758951] pci_bus 0021:00: resource 4 [mem 0x3fe880000000-0x3fe8fffeffff]
[    2.758961] pci_bus 0021:00: resource 5 [mem 0x250000000000-0x25fdffffffff 64bit pref]
[    2.758970] pci_bus 0021:01: resource 1 [mem 0x3fe880000000-0x3fe8ffefffff]
[    2.758979] pci_bus 0021:01: resource 2 [mem 0x250000000000-0x25fdfff0ffff 64bit pref]
[    2.758988] pci_bus 0021:02: resource 1 [mem 0x3fe880000000-0x3fe8ffefffff]
[    2.758997] pci_bus 0021:02: resource 2 [mem 0x250000000000-0x25fdfff0ffff 64bit pref]
[    2.759007] pci_bus 0021:03: resource 1 [mem 0x3fe880000000-0x3fe8807fffff]
[    2.759015] pci_bus 0021:03: resource 2 [mem 0x250000000000-0x2500ffffffff 64bit pref]
[    2.759026] pci_bus 0021:0d: resource 1 [mem 0x3fe880800000-0x3fe880ffffff]
[    2.759036] pci_bus 0021:0e: resource 1 [mem 0x3fe881000000-0x3fe8817fffff]
[    2.759045] pci_bus 0021:0f: resource 1 [mem 0x3fe881800000-0x3fe882ffffff]
[    2.759055] pci_bus 0021:10: resource 1 [mem 0x3fe881800000-0x3fe882ffffff]
[    2.759102] pci 0022:00     : [PE# fe] Secondary bus 0 associated with PE#fe
[    2.759687] pci 0022:00:00.0: PCI bridge to [bus 01-ff]
[    2.759734] pci_bus 0022:00: resource 4 [mem 0x3fe900000000-0x3fe97ffeffff]
[    2.759743] pci_bus 0022:00: resource 5 [mem 0x260000000000-0x26fdffffffff 64bit pref]
[    2.759887] iommu: Adding device 0001:01:00.0 to group 0
[    2.759913] iommu: Adding device 0001:01:00.1 to group 0
[    2.759938] iommu: Adding device 0001:01:00.2 to group 0
[    2.759962] iommu: Adding device 0001:01:00.3 to group 0
[    2.760041] iommu: Adding device 0021:0d:00.0 to group 1
[    2.760120] iommu: Adding device 0021:0e:00.0 to group 2
[    2.760194] iommu: Adding device 0021:10:00.0 to group 3
[    2.760279] iommu: Adding device 0021:01:00.0 to group 4
[    2.760303] iommu: Adding device 0021:01:00.1 to group 4
[    2.760328] iommu: Adding device 0021:01:00.2 to group 4
[    2.760352] iommu: Adding device 0021:01:00.3 to group 4
[    2.760376] iommu: Adding device 0021:01:00.4 to group 4
[    2.760594] pci 0001:00:00.0: enabling device (0141 -> 0143)
[    2.760630] pci 0021:00:00.0: enabling device (0141 -> 0143)
[    2.760665] pci 0021:01:00.0: enabling device (0141 -> 0143)
[    2.760706] pci 0021:02:09.0: enabling device (0141 -> 0143)
[    2.760749] pci 0021:02:0a.0: enabling device (0141 -> 0143)
[    2.760793] pci 0021:02:0b.0: enabling device (0141 -> 0143)
[    2.760840] pci 0021:0f:00.0: enabling device (0141 -> 0143)
[    2.763445] EEH: PCI Enhanced I/O Error Handling Enabled
[    2.765012] PCI: Probing PCI hardware done
[    2.775896] powernv-rng: Registering arch random hook.
[    2.781203] HugeTLB registered 16.0 MiB page size, pre-allocated 0 pages
[    2.781205] HugeTLB registered 16.0 GiB page size, pre-allocated 0 pages
[    2.784702] pci 0021:10:00.0: vgaarb: VGA device added: decodes=io+mem,owns=none,locks=none
[    2.784704] pci 0021:10:00.0: vgaarb: bridge control possible
[    2.784707] pci 0021:10:00.0: vgaarb: setting as boot device (VGA legacy resources not available)
[    2.784708] vgaarb: loaded
[    2.785666] SCSI subsystem initialized
[    2.785967] libata version 3.00 loaded.
[    2.786040] usbcore: registered new interface driver usbfs
[    2.786056] usbcore: registered new interface driver hub
[    2.786456] usbcore: registered new device driver usb
[    2.786534] pps_core: LinuxPPS API ver. 1 registered
[    2.786534] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    2.786541] PTP clock support registered
[    2.787097] EDAC MC: Ver: 3.0.0
[    2.787771] NetLabel: Initializing
[    2.787772] NetLabel:  domain hash size = 128
[    2.787773] NetLabel:  protocols = UNLABELED CIPSOv4 CALIPSO
[    2.787800] NetLabel:  unlabeled traffic allowed by default
[    2.788521] clocksource: Switched to clocksource timebase
[    2.820776] VFS: Disk quotas dquot_6.6.0
[    2.821671] VFS: Dquot-cache hash table entries: 8192 (order 0, 65536 bytes)
[    2.823195] AppArmor: AppArmor Filesystem Enabled
[    2.827339] NET: Registered protocol family 2
[    2.828565] tcp_listen_portaddr_hash hash table entries: 65536 (order: 4, 1048576 bytes)
[    2.828708] TCP established hash table entries: 524288 (order: 6, 4194304 bytes)
[    2.829791] TCP bind hash table entries: 65536 (order: 4, 1048576 bytes)
[    2.829920] TCP: Hash tables configured (established 524288 bind 65536)
[    2.830564] UDP hash table entries: 65536 (order: 5, 2097152 bytes)
[    2.830837] UDP-Lite hash table entries: 65536 (order: 5, 2097152 bytes)
[    2.832538] NET: Registered protocol family 1
[    2.832637] pci 0021:0d:00.0: enabling device (0140 -> 0142)
[    2.832694] PCI: CLS 0 bytes, default 128
[    2.832764] Unpacking initramfs...
[    3.961886] Freeing initrd memory: 63616K
[    3.962149] numa: Starting topology update
[    3.968565] Initialise system trusted keyrings
[    3.968579] Key type blacklist registered
[    3.968660] workingset: timestamp_bits=38 max_order=24 bucket_order=0
[    3.971824] zbud: loaded
[    3.976486] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    3.978069] fuse init (API version 7.28)
[    3.992801] random: fast init done
[    4.031260] Key type asymmetric registered
[    4.031262] Asymmetric key parser 'x509' registered
[    4.031281] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 244)
[    4.031763] random: crng init done
[    4.034271] pci 0021:10:00.0: enabling device (0141 -> 0143)
[    4.034284] Using unsupported 1024x768 (null) at 3fe882010000, depth=32, pitch=4096
[    4.172881] Console: switching to colour frame buffer device 128x48
[    4.311446] fb0: Open Firmware frame buffer device on /pciex@3fffe41100000/pci@0/pci@0/pci@b/pci@0/vga@0
[    4.311679] hvc0: raw protocol on /ibm,opal/consoles/serial@0 (boot console)
[    4.311681] hvc0: No interrupts property, using OPAL event
[    4.312164] Serial: 8250/16550 driver, 32 ports, IRQ sharing enabled
[    4.315361] Linux agpgart interface v0.103
[    4.358848] loop: module loaded
[    4.359533] libphy: Fixed MDIO Bus: probed
[    4.359534] tun: Universal TUN/TAP device driver, 1.6
[    4.359603] PPP generic driver version 2.4.2
[    4.359700] VFIO - User Level meta-driver version: 0.3
[    4.359815] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    4.359833] ehci-pci: EHCI PCI platform driver
[    4.359847] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    4.359850] ohci-pci: OHCI PCI platform driver
[    4.359864] uhci_hcd: USB Universal Host Controller Interface driver
[    4.360077] xhci_hcd 0021:0d:00.0: xHCI Host Controller
[    4.360097] xhci_hcd 0021:0d:00.0: new USB bus registered, assigned bus number 1
[    4.360180] xhci_hcd 0021:0d:00.0: Using 64-bit DMA iommu bypass
[    4.360235] xhci_hcd 0021:0d:00.0: hcc params 0x0270f06d hci version 0x96 quirks 0x0000000004000000
[    4.361708] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.00
[    4.361710] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    4.361712] usb usb1: Product: xHCI Host Controller
[    4.361713] usb usb1: Manufacturer: Linux 5.0.0-rc5+ xhci-hcd
[    4.361714] usb usb1: SerialNumber: 0021:0d:00.0
[    4.361916] hub 1-0:1.0: USB hub found
[    4.361930] hub 1-0:1.0: 4 ports detected
[    4.362166] xhci_hcd 0021:0d:00.0: xHCI Host Controller
[    4.362171] xhci_hcd 0021:0d:00.0: new USB bus registered, assigned bus number 2
[    4.362174] xhci_hcd 0021:0d:00.0: Host supports USB 3.0  SuperSpeed
[    4.362201] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    4.362242] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.00
[    4.362244] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    4.362245] usb usb2: Product: xHCI Host Controller
[    4.362247] usb usb2: Manufacturer: Linux 5.0.0-rc5+ xhci-hcd
[    4.362248] usb usb2: SerialNumber: 0021:0d:00.0
[    4.362422] hub 2-0:1.0: USB hub found
[    4.362435] hub 2-0:1.0: 4 ports detected
[    4.363012] mousedev: PS/2 mouse device common for all mice
[    4.380453] rtc-opal opal-rtc: registered as rtc0
[    4.380467] i2c /dev entries driver
[    4.384650] device-mapper: uevent: version 1.0.3
[    4.384935] device-mapper: ioctl: 4.39.0-ioctl (2018-04-03) initialised: dm-devel@redhat.com
[    4.384943] powernv-cpufreq: cpufreq pstate min 0xffffffd5 nominal 0xffffffef max 0x0
[    4.384944] powernv-cpufreq: Workload Optimized Frequency is disabled in the platform
[    4.392807] powernv_idle_driver registered
[    4.394685] ledtrig-cpu: registered to indicate activity on CPUs
[    4.396248] NET: Registered protocol family 10
[    4.405394] Segment Routing with IPv6
[    4.405419] NET: Registered protocol family 17
[    4.405479] Key type dns_resolver registered
[    4.405559] drmem: No dynamic reconfiguration memory found
[    4.405752] registered taskstats version 1
[    4.405766] Loading compiled-in X.509 certificates
[    4.407552] Loaded X.509 cert 'Build time autogenerated kernel key: 8ff7e67c3c4ba58b4ad0978adfb0aa67041f9c5e'
[    4.407890] zswap: loaded using pool lzo/zbud
[    4.407957] kmemleak: Kernel memory leak detector initialized
[    4.407959] kmemleak: Automatic memory scanning thread started
[    4.408032] pstore: Using crash dump compression: deflate
[    4.414429] Key type big_key registered
[    4.414433] Key type trusted registered
[    4.417745] Key type encrypted registered
[    4.417747] AppArmor: AppArmor sha1 policy hashing enabled
[    4.417754] ima: No TPM chip found, activating TPM-bypass!
[    4.417759] ima: Allocated hash algorithm: sha256
[    4.417770] No architecture policies found
[    4.417786] evm: Initialising EVM extended attributes:
[    4.417787] evm: security.selinux
[    4.417788] evm: security.SMACK64
[    4.417788] evm: security.SMACK64EXEC
[    4.417788] evm: security.SMACK64TRANSMUTE
[    4.417789] evm: security.SMACK64MMAP
[    4.417789] evm: security.apparmor
[    4.417790] evm: security.ima
[    4.417790] evm: security.capability
[    4.417791] evm: HMAC attrs: 0x1
[    4.440569] rtc-opal opal-rtc: setting system clock to 2019-02-07T12:14:04 UTC (1549541644)
[    4.440875] integrity: Unable to open file: /etc/keys/x509_ima.der (-2)
[    4.440879] integrity: Unable to open file: /etc/keys/x509_evm.der (-2)
[    4.443129] Freeing unused kernel memory: 8320K
[    4.443171] This architecture does not have kernel memory protection.
[    4.443176] Run /init as init process
[    4.696402] usb 1-3: new high-speed USB device number 2 using xhci_hcd
[    4.886218] usb 1-3: New USB device found, idVendor=046b, idProduct=ff01, bcdDevice= 1.00
[    4.886220] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    4.886221] usb 1-3: Product: Virtual Hub
[    4.886222] usb 1-3: Manufacturer: American Megatrends Inc.
[    4.886223] usb 1-3: SerialNumber: serial
[    4.899120] hub 1-3:1.0: USB hub found
[    4.899462] hub 1-3:1.0: 5 ports detected
[    5.127006] ahci 0021:0e:00.0: version 3.0
[    5.127024] ahci 0021:0e:00.0: enabling device (0141 -> 0143)
[    5.127765] ahci 0021:0e:00.0: Using 64-bit DMA iommu bypass
[    5.137853] ahci 0021:0e:00.0: AHCI 0001.0000 32 slots 4 ports 6 Gbps 0xf impl SATA mode
[    5.137855] ahci 0021:0e:00.0: flags: 64bit ncq sntf led only pmp fbs pio slum part sxs 
[    5.140827] scsi host0: ahci
[    5.145021] scsi host1: ahci
[    5.148977] scsi host2: ahci
[    5.152628] scsi host3: ahci
[    5.153286] bnx2x: QLogic 5771x/578xx 10/20-Gigabit Ethernet Driver bnx2x 1.712.30-0 (2014/02/10)
[    5.153842] bnx2x 0001:01:00.0: msix capability found
[    5.155888] ata1: SATA max UDMA/133 abar m2048@0x3fe881000000 port 0x3fe881000100 irq 385
[    5.155891] ata2: SATA max UDMA/133 abar m2048@0x3fe881000000 port 0x3fe881000180 irq 385
[    5.155892] ata3: SATA max UDMA/133 abar m2048@0x3fe881000000 port 0x3fe881000200 irq 385
[    5.155894] ata4: SATA max UDMA/133 abar m2048@0x3fe881000000 port 0x3fe881000280 irq 385
[    5.172409] bnx2x 0001:01:00.0: enabling device (0140 -> 0142)
[    5.172498] bnx2x 0001:01:00.0: Using 64-bit DMA iommu bypass
[    5.172562] bnx2x 0001:01:00.0: part number 0-0-0-0
[    5.178664] checking generic (3fe882010000 300000) vs hw (3fe882000000 1000000)
[    5.178665] fb0: switching to astdrmfb from OFfb vga
[    5.178989] Console: switching to colour dummy device 80x25
[    5.184015] [drm] platform has no IO space, trying MMIO
[    5.184026] [drm] Using P2A bridge for configuration
[    5.184029] [drm] AST 2400 detected
[    5.184034] [drm] Analog VGA only
[    5.184043] [drm] dram MCLK=408 Mhz type=7 bus_width=16 size=00e00000
[    5.184704] [TTM] Zone  kernel: Available graphics memory: 535733984 kiB
[    5.184704] [TTM] Zone   dma32: Available graphics memory: 2097152 kiB
[    5.184705] [TTM] Initializing pool allocator
[    5.281429] bnx2x 0001:01:00.0: 32.000 Gb/s available PCIe bandwidth (5 GT/s x8 link)
[    5.281616] bnx2x 0001:01:00.1: msix capability found
[    5.300410] bnx2x 0001:01:00.1: enabling device (0140 -> 0142)
[    5.300500] bnx2x 0001:01:00.1: Using 64-bit DMA iommu bypass
[    5.300562] bnx2x 0001:01:00.1: part number 0-0-0-0
[    5.321210] usb 1-3.1: new high-speed USB device number 3 using xhci_hcd
[    5.323027] Console: switching to colour frame buffer device 128x48
[    5.364304] synth uevent: /devices/vio: failed to send uevent
[    5.364308] vio vio: uevent: failed to send synthetic uevent
[    5.382961] bnx2x 0001:01:00.1: 32.000 Gb/s available PCIe bandwidth (5 GT/s x8 link)
[    5.383075] bnx2x 0001:01:00.2: msix capability found
[    5.392607] ast 0021:10:00.0: fb0: astdrmfb frame buffer device
[    5.402221] bnx2x 0001:01:00.2: enabling device (0140 -> 0142)
[    5.402386] bnx2x 0001:01:00.2: Using 64-bit DMA iommu bypass
[    5.402465] bnx2x 0001:01:00.2: part number 0-0-0-0
[    5.444428] [drm] Initialized ast 0.1.0 20120228 for 0021:10:00.0 on minor 0
[    5.470640] ata3: SATA link down (SStatus 0 SControl 300)
[    5.474616] ata4: SATA link down (SStatus 0 SControl 300)
[    5.488917] bnx2x 0001:01:00.2: 32.000 Gb/s available PCIe bandwidth (5 GT/s x8 link)
[    5.489047] bnx2x 0001:01:00.3: msix capability found
[    5.509327] usb 1-3.1: New USB device found, idVendor=046b, idProduct=ff20, bcdDevice= 1.00
[    5.509329] usb 1-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    5.509330] usb 1-3.1: Product: Virtual Cdrom Device
[    5.509331] usb 1-3.1: Manufacturer: American Megatrends Inc.
[    5.509332] usb 1-3.1: SerialNumber: AAAABBBBCCCC1
[    5.512486] bnx2x 0001:01:00.3: enabling device (0140 -> 0142)
[    5.512636] bnx2x 0001:01:00.3: Using 64-bit DMA iommu bypass
[    5.512725] bnx2x 0001:01:00.3: part number 0-0-0-0
[    5.584013] bnx2x 0001:01:00.3: 32.000 Gb/s available PCIe bandwidth (5 GT/s x8 link)
[    5.585548] bnx2x 0001:01:00.1 enP1p1s0f1: renamed from eth1
[    5.616395] usb 1-3.2: new high-speed USB device number 4 using xhci_hcd
[    5.636409] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[    5.637340] ata1.00: ATA-10: ST1000NX0313         00LY266 00LY265IBM, BE33, max UDMA/133
[    5.637342] ata1.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 32), AA
[    5.637987] ata1.00: configured for UDMA/133
[    5.640207] scsi 0:0:0:0: Direct-Access     ATA      ST1000NX0313     BE33 PQ: 0 ANSI: 5
[    5.640410] ata2: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[    5.640747] sd 0:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
[    5.640751] sd 0:0:0:0: [sda] 4096-byte physical blocks
[    5.640776] sd 0:0:0:0: [sda] Write Protect is off
[    5.640779] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    5.640817] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    5.641165] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    5.641333] ata2.00: ATA-10: ST1000NX0313         00LY266 00LY265IBM, BE33, max UDMA/133
[    5.641335] ata2.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 32), AA
[    5.641972] ata2.00: configured for UDMA/133
[    5.644311] scsi 1:0:0:0: Direct-Access     ATA      ST1000NX0313     BE33 PQ: 0 ANSI: 5
[    5.644948] sd 1:0:0:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
[    5.644951] sd 1:0:0:0: [sdb] 4096-byte physical blocks
[    5.644972] sd 1:0:0:0: [sdb] Write Protect is off
[    5.644974] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[    5.645010] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    5.645444] sd 1:0:0:0: Attached scsi generic sg1 type 0
[    5.666753] sd 1:0:0:0: [sdb] Attached SCSI removable disk
[    5.688860]  sda: sda1 sda2
[    5.692750] sd 0:0:0:0: [sda] Attached SCSI removable disk
[    5.743998] usb 1-3.2: New USB device found, idVendor=046b, idProduct=ff40, bcdDevice= 1.00
[    5.744000] usb 1-3.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    5.744001] usb 1-3.2: Product: Virtual Floppy Device
[    5.744002] usb 1-3.2: Manufacturer: American Megatrends Inc.
[    5.744003] usb 1-3.2: SerialNumber: AAAABBBBCCCC2
[    5.826204] bnx2x 0001:01:00.0 enP1p1s0f0: renamed from eth0
[    5.848399] usb 1-3.3: new high-speed USB device number 5 using xhci_hcd
[    5.892834] bnx2x 0001:01:00.3 enP1p1s0f3: renamed from eth3
[    5.924694] bnx2x 0001:01:00.2 enP1p1s0f2: renamed from eth2
[    5.976012] usb 1-3.3: New USB device found, idVendor=046b, idProduct=ff31, bcdDevice= 1.00
[    5.976015] usb 1-3.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    5.976016] usb 1-3.3: Product: Virtual HardDisk Device
[    5.976017] usb 1-3.3: Manufacturer: American Megatrends Inc.
[    5.976018] usb 1-3.3: SerialNumber: AAAABBBBCCCC3
[    6.080408] usb 1-3.4: new low-speed USB device number 6 using xhci_hcd
[    6.227518] usb 1-3.4: New USB device found, idVendor=046b, idProduct=ff10, bcdDevice= 1.00
[    6.227520] usb 1-3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    6.227521] usb 1-3.4: Product: Virtual Keyboard and Mouse
[    6.227522] usb 1-3.4: Manufacturer: American Megatrends Inc.
[    6.262421] usb-storage 1-3.1:1.0: USB Mass Storage device detected
[    6.262607] scsi host4: usb-storage 1-3.1:1.0
[    6.263386] usb-storage 1-3.2:1.0: USB Mass Storage device detected
[    6.263471] usb-storage 1-3.2:1.0: Quirks match for vid 046b pid ff40: 200
[    6.263502] scsi host5: usb-storage 1-3.2:1.0
[    6.263874] usb-storage 1-3.3:1.0: USB Mass Storage device detected
[    6.264003] scsi host6: usb-storage 1-3.3:1.0
[    6.264183] hidraw: raw HID events driver (C) Jiri Kosina
[    6.264442] usbcore: registered new interface driver usb-storage
[    6.265899] usbcore: registered new interface driver uas
[    6.278625] usbcore: registered new interface driver usbhid
[    6.278626] usbhid: USB HID core driver
[    6.281362] input: American Megatrends Inc. Virtual Keyboard and Mouse as /devices/pci0021:00/0021:00:00.0/0021:01:00.0/0021:02:09.0/0021:0d:00.0/usb1/1-3/1-3.4/1-3.4:1.0/0003:046B:FF10.0001/input/input0
[    6.281457] hid-generic 0003:046B:FF10.0001: input,hidraw0: USB HID v1.10 Keyboard [American Megatrends Inc. Virtual Keyboard and Mouse] on usb-0021:0d:00.0-3.4/input0
[    6.281579] input: American Megatrends Inc. Virtual Keyboard and Mouse as /devices/pci0021:00/0021:00:00.0/0021:01:00.0/0021:02:09.0/0021:0d:00.0/usb1/1-3/1-3.4/1-3.4:1.1/0003:046B:FF10.0002/input/input1
[    6.281697] hid-generic 0003:046B:FF10.0002: input,hidraw1: USB HID v1.10 Mouse [American Megatrends Inc. Virtual Keyboard and Mouse] on usb-0021:0d:00.0-3.4/input1
[    6.548398] raid6: vpermxor8 gen() 23045 MB/s
[    6.616396] raid6: vpermxor4 gen() 20602 MB/s
[    6.684398] raid6: vpermxor2 gen() 13170 MB/s
[    6.752404] raid6: vpermxor1 gen()  8821 MB/s
[    6.820396] raid6: altivecx8 gen()  8323 MB/s
[    6.888397] raid6: altivecx4 gen() 20627 MB/s
[    6.956398] raid6: altivecx2 gen() 15057 MB/s
[    7.024404] raid6: altivecx1 gen()  8821 MB/s
[    7.092401] raid6: int64x8  gen()  5981 MB/s
[    7.160399] raid6: int64x8  xor()  2141 MB/s
[    7.228397] raid6: int64x4  gen() 10316 MB/s
[    7.273411] scsi 4:0:0:0: CD-ROM            AMI      Virtual CDROM0   1.00 PQ: 0 ANSI: 0 CCS
[    7.273706] scsi 6:0:0:0: Direct-Access     AMI      Virtual HDisk0   1.00 PQ: 0 ANSI: 0 CCS
[    7.276908] scsi 4:0:0:1: CD-ROM            AMI      Virtual CDROM1   1.00 PQ: 0 ANSI: 0 CCS
[    7.277203] scsi 6:0:0:1: Direct-Access     AMI      Virtual HDisk1   1.00 PQ: 0 ANSI: 0 CCS
[    7.277960] scsi 5:0:0:0: Direct-Access     AMI      Virtual Floppy0  1.00 PQ: 0 ANSI: 0 CCS
[    7.280658] scsi 4:0:0:2: CD-ROM            AMI      Virtual CDROM2   1.00 PQ: 0 ANSI: 0 CCS
[    7.280953] scsi 6:0:0:2: Direct-Access     AMI      Virtual HDisk2   1.00 PQ: 0 ANSI: 0 CCS
[    7.284448] scsi 4:0:0:3: CD-ROM            AMI      Virtual CDROM3   1.00 PQ: 0 ANSI: 0 CCS
[    7.284708] scsi 6:0:0:3: Direct-Access     AMI      Virtual HDisk3   1.00 PQ: 0 ANSI: 0 CCS
[    7.288333] scsi 5:0:0:1: Direct-Access     AMI      Virtual Floppy1  1.00 PQ: 0 ANSI: 0 CCS
[    7.291196] scsi 5:0:0:2: Direct-Access     AMI      Virtual Floppy2  1.00 PQ: 0 ANSI: 0 CCS
[    7.293697] scsi 5:0:0:3: Direct-Access     AMI      Virtual Floppy3  1.00 PQ: 0 ANSI: 0 CCS
[    7.296403] raid6: int64x4  xor()  2980 MB/s
[    7.297204] sd 5:0:0:0: Attached scsi generic sg2 type 0
[    7.298099] sd 5:0:0:1: Attached scsi generic sg3 type 0
[    7.299380] sd 5:0:0:2: Attached scsi generic sg4 type 0
[    7.302175] sd 5:0:0:3: Attached scsi generic sg5 type 0
[    7.305476] sd 6:0:0:0: Attached scsi generic sg6 type 0
[    7.309325] sd 6:0:0:1: Attached scsi generic sg7 type 0
[    7.309706] sd 5:0:0:0: [sdc] Attached SCSI removable disk
[    7.315203] sd 6:0:0:2: Attached scsi generic sg8 type 0
[    7.315957] sd 5:0:0:1: [sdd] Attached SCSI removable disk
[    7.317707] sd 5:0:0:2: [sde] Attached SCSI removable disk
[    7.319859] sd 6:0:0:3: Attached scsi generic sg9 type 0
[    7.327677] sr 4:0:0:0: [sr0] scsi-1 drive
[    7.327679] cdrom: Uniform CD-ROM driver Revision: 3.20
[    7.331833] sd 6:0:0:0: [sdg] Attached SCSI removable disk
[    7.332100] sd 5:0:0:3: [sdf] Attached SCSI removable disk
[    7.335334] sd 6:0:0:1: [sdh] Attached SCSI removable disk
[    7.340703] sd 6:0:0:3: [sdj] Attached SCSI removable disk
[    7.344211] sd 6:0:0:2: [sdi] Attached SCSI removable disk
[    7.345390] sr 4:0:0:0: Attached scsi CD-ROM sr0
[    7.346047] sr 4:0:0:0: Attached scsi generic sg10 type 5
[    7.351577] sr 4:0:0:1: [sr1] scsi-1 drive
[    7.358182] sr 4:0:0:1: Attached scsi CD-ROM sr1
[    7.359161] sr 4:0:0:1: Attached scsi generic sg11 type 5
[    7.362765] sr 4:0:0:2: [sr2] scsi-1 drive
[    7.364411] raid6: int64x2  gen()  5816 MB/s
[    7.367905] sr 4:0:0:2: Attached scsi CD-ROM sr2
[    7.368554] sr 4:0:0:2: Attached scsi generic sg12 type 5
[    7.370573] sr 4:0:0:3: [sr3] scsi-1 drive
[    7.374785] sr 4:0:0:3: Attached scsi CD-ROM sr3
[    7.375135] sr 4:0:0:3: Attached scsi generic sg13 type 5
[    7.432403] raid6: int64x2  xor()  2379 MB/s
[    7.500404] raid6: int64x1  gen()  4420 MB/s
[    7.568398] raid6: int64x1  xor()  1329 MB/s
[    7.568399] raid6: using algorithm vpermxor8 gen() 23045 MB/s
[    7.568400] raid6: using intx1 recovery algorithm
[    7.569598] xor: measuring software checksum speed
[    7.608408]    8regs     : 16224.000 MB/sec
[    7.648399]    8regs_prefetch: 14256.000 MB/sec
[    7.688399]    32regs    : 17104.000 MB/sec
[    7.728396]    32regs_prefetch: 16256.000 MB/sec
[    7.768399]    altivec   : 24624.000 MB/sec
[    7.768400] xor: using function: altivec (24624.000 MB/sec)
[    7.769509] async_tx: api initialized (async)
[    7.860183] Btrfs loaded, crc32c=crc32c-vpmsum
[    7.903361] BTRFS: device fsid 2c3dd738-785a-469b-843e-9f0ba8b47b0d devid 1 transid 963673 /dev/sda2
[    7.923817] BTRFS info (device sda2): disk space caching is enabled
[    7.923818] BTRFS info (device sda2): has skinny extents
[   11.709800] pstore: crypto_comp_decompress failed, ret = -22!
[   11.725225] systemd[1]: systemd 239 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid)
[   11.727771] systemd[1]: Detected architecture ppc64-le.
[   11.739447] systemd[1]: Set hostname to <flughafenberlinbrandenburgwillybrandt>.
[   13.864958] systemd[1]: Listening on Journal Socket (/dev/log).
[   13.865022] systemd[1]: Reached target Swap.
[   13.865084] systemd[1]: Listening on Device-mapper event daemon FIFOs.
[   13.865135] systemd[1]: Listening on initctl Compatibility Named Pipe.
[   13.865144] systemd[1]: Reached target Libvirt guests shutdown.
[   13.873998] systemd[1]: Listening on LVM2 poll daemon socket.
[   13.874079] systemd[1]: Listening on LVM2 metadata daemon socket.
[   13.983839] RPC: Registered named UNIX socket transport module.
[   13.983841] RPC: Registered udp transport module.
[   13.983841] RPC: Registered tcp transport module.
[   13.983842] RPC: Registered tcp NFSv4.1 backchannel transport module.
[   14.090685] BTRFS info (device sda2): disk space caching is enabled
[   14.133098] Loading iSCSI transport class v2.0-870.
[   14.204930] iscsi: registered transport (tcp)
[   14.268258] systemd-journald[1610]: Received request to flush runtime journal from PID 1
[   14.575034] iscsi: registered transport (iser)
[   14.817070] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[   14.976516] synth uevent: /devices/vio: failed to send uevent
[   14.976519] vio vio: uevent: failed to send synthetic uevent
[   18.031321] powernv_rng: Registered powernv hwrng.
[   18.273428] IPMI message handler: version 39.2
[   18.278876] ipmi device interface
[   18.319817] ipmi-powernv ibm,opal:ipmi: Unable to map irq from device tree
[   18.322672] at24 0-0051: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   18.323384] at24 0-0052: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   18.324169] at24 0-0053: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   18.325006] at24 0-0054: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   18.325751] at24 0-0055: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   18.326967] ipmi-powernv ibm,opal:ipmi: IPMI message handler: Found new BMC (man_id: 0x000000, prod_id: 0xaabb, dev_id: 0x20)
[   18.357013] at24 1-0050: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   18.357598] at24 1-0052: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   18.358198] at24 1-0053: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   18.358795] at24 1-0054: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   18.359470] at24 1-0055: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   18.501031] crypto_register_alg 'aes' = 0
[   18.510299] crypto_register_alg 'cbc(aes)' = 0
[   18.527561] crypto_register_alg 'ctr(aes)' = 0
[   18.534597] crypto_register_alg 'xts(aes)' = 0
[   20.392235] at24 2-0052: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   20.401068] at24 2-0053: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   20.411986] at24 2-0054: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   20.467704] at24 2-0055: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   20.511533] at24 2-0056: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   20.555943] at24 3-0052: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   20.596558] at24 3-0053: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   20.606709] at24 3-0054: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   20.612170] at24 3-0055: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   20.619190] at24 3-0057: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   22.650770] at24 4-0051: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   22.711257] at24 4-0052: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   22.789792] at24 4-0053: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   22.844061] at24 4-0054: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   22.888950] at24 4-0055: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   24.908756] at24 5-0050: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   24.957386] at24 5-0052: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   25.000993] at24 5-0053: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   25.005712] at24 5-0054: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   25.010852] at24 5-0055: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   26.898639] audit: type=1400 audit(1549541666.952:2): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/lxc-start" pid=7485 comm="apparmor_parser"
[   26.903530] audit: type=1400 audit(1549541666.956:3): apparmor="STATUS" operation="profile_load" profile="unconfined" name="libreoffice-senddoc" pid=7488 comm="apparmor_parser"
[   26.903589] audit: type=1400 audit(1549541666.956:4): apparmor="STATUS" operation="profile_load" profile="unconfined" name="libreoffice-xpdfimport" pid=7490 comm="apparmor_parser"
[   26.903755] audit: type=1400 audit(1549541666.956:5): apparmor="STATUS" operation="profile_load" profile="unconfined" name="libreoffice-oopslash" pid=7487 comm="apparmor_parser"
[   26.938642] audit: type=1400 audit(1549541666.992:6): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/snapd/snap-confine" pid=7492 comm="apparmor_parser"
[   26.938648] audit: type=1400 audit(1549541666.992:7): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/snapd/snap-confine//mount-namespace-capture-helper" pid=7492 comm="apparmor_parser"
[   26.985221] audit: type=1400 audit(1549541667.040:8): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/man" pid=7486 comm="apparmor_parser"
[   26.985227] audit: type=1400 audit(1549541667.040:9): apparmor="STATUS" operation="profile_load" profile="unconfined" name="man_filter" pid=7486 comm="apparmor_parser"
[   26.985231] audit: type=1400 audit(1549541667.040:10): apparmor="STATUS" operation="profile_load" profile="unconfined" name="man_groff" pid=7486 comm="apparmor_parser"
[   26.993668] audit: type=1400 audit(1549541667.048:11): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/sbin/libvirtd" pid=7495 comm="apparmor_parser"
[   27.048874] at24 6-0052: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   27.049337] at24 6-0053: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   27.049784] at24 6-0054: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   27.050215] at24 6-0055: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   27.050699] at24 6-0056: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   27.913738] new mount options do not match the existing superblock, will be ignored
[   29.065248] at24 7-0052: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   29.065974] at24 7-0053: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   29.066475] at24 7-0054: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   29.066984] at24 7-0055: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[   29.067522] at24 7-0057: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   29.067738] at24 8-0050: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   29.067940] at24 8-0051: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   29.068139] at24 9-0050: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   29.068360] at24 9-0051: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   29.068707] at24 10-0050: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   29.068921] at24 11-0050: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   29.069106] at24 11-0051: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   29.069300] at24 12-0050: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   29.069480] at24 12-0051: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
[   29.227504] bnx2x 0001:01:00.0 enP1p1s0f0: using MSI-X  IRQs: sp 505  fp[0] 507 ... fp[7] 501
[   30.408640] bnx2x 0001:01:00.0 enP1p1s0f0: NIC Link is Up, 10000 Mbps full duplex, Flow control: ON - receive & transmit
[   30.408722] IPv6: ADDRCONF(NETDEV_CHANGE): enP1p1s0f0: link becomes ready
[   31.185613] NFSD: starting 45-second grace period (net f000001f)
[   39.662846] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[   39.665367] virbr0: port 1(virbr0-nic) entered blocking state
[   39.665375] virbr0: port 1(virbr0-nic) entered disabled state
[   39.665642] device virbr0-nic entered promiscuous mode
[   40.027135] virbr0: port 1(virbr0-nic) entered blocking state
[   40.027140] virbr0: port 1(virbr0-nic) entered listening state
[   40.860880] bnx2x 0001:01:00.0 enP1p1s0f0: using MSI-X  IRQs: sp 505  fp[0] 507 ... fp[7] 501
[   40.940435] bnx2x 0001:01:00.0 enP1p1s0f0: NIC Link is Up, 10000 Mbps full duplex, Flow control: ON - receive & transmit
[   41.100148] virbr0: port 1(virbr0-nic) entered disabled state
[402345.975752] kauditd_printk_skb: 35 callbacks suppressed
[402345.975754] audit: type=1400 audit(1549943987.087:47): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.activate" pid=9342 comm="apparmor_parser"
[402345.975876] audit: type=1400 audit(1549943987.087:48): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.buginfo" pid=9344 comm="apparmor_parser"
[402345.976106] audit: type=1400 audit(1549943987.087:49): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.benchmark" pid=9343 comm="apparmor_parser"
[402345.976313] audit: type=1400 audit(1549943987.087:50): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.daemon" pid=9346 comm="apparmor_parser"
[402345.976691] audit: type=1400 audit(1549943987.087:51): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.hook.install" pid=9348 comm="apparmor_parser"
[402345.976906] audit: type=1400 audit(1549943987.087:52): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.check-kernel" pid=9345 comm="apparmor_parser"
[402345.977031] audit: type=1400 audit(1549943987.091:53): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.lxc" pid=9349 comm="apparmor_parser"
[402345.977673] audit: type=1400 audit(1549943987.091:54): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.hook.configure" pid=9347 comm="apparmor_parser"
[402345.977830] audit: type=1400 audit(1549943987.091:55): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.lxd" pid=9350 comm="apparmor_parser"
[402345.978406] audit: type=1400 audit(1549943987.091:56): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.migrate" pid=9351 comm="apparmor_parser"
[407829.139865] kauditd_printk_skb: 5 callbacks suppressed
[407829.139867] audit: type=1400 audit(1549949470.261:62): apparmor="STATUS" operation="profile_load" profile="unconfined" name="docker-default" pid=21967 comm="apparmor_parser"
[407829.772370] Bridge firewalling registered
[407829.885374] Initializing XFRM netlink socket
[580516.676033] audit: type=1400 audit(1550122158.145:63): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="/usr/lib/snapd/snap-confine" pid=41464 comm="apparmor_parser"
[580516.711184] audit: type=1400 audit(1550122158.181:64): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="/usr/lib/snapd/snap-confine//mount-namespace-capture-helper" pid=41464 comm="apparmor_parser"
[641129.818991] audit: type=1400 audit(1550182771.409:65): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/snap/core/6407/usr/lib/snapd/snap-confine" pid=10699 comm="apparmor_parser"
[641129.819227] audit: type=1400 audit(1550182771.409:66): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/snap/core/6407/usr/lib/snapd/snap-confine//mount-namespace-capture-helper" pid=10699 comm="apparmor_parser"
[641132.645821] audit: type=1400 audit(1550182774.233:67): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.core.hook.configure" pid=10716 comm="apparmor_parser"
[641132.653932] audit: type=1400 audit(1550182774.241:68): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap-update-ns.core" pid=10718 comm="apparmor_parser"
[641132.665124] audit: type=1400 audit(1550182774.253:69): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap-update-ns.lxd" pid=10720 comm="apparmor_parser"
[641132.666398] audit: type=1400 audit(1550182774.253:70): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.activate" pid=10721 comm="apparmor_parser"
[641132.666473] audit: type=1400 audit(1550182774.253:71): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.hook.configure" pid=10726 comm="apparmor_parser"
[641132.666624] audit: type=1400 audit(1550182774.257:72): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.check-kernel" pid=10724 comm="apparmor_parser"
[641132.667361] audit: type=1400 audit(1550182774.257:73): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.benchmark" pid=10722 comm="apparmor_parser"
[641132.667670] audit: type=1400 audit(1550182774.257:74): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.daemon" pid=10725 comm="apparmor_parser"
[641138.957349] kauditd_printk_skb: 9 callbacks suppressed
[641138.957351] audit: type=1400 audit(1550182780.545:84): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap-update-ns.lxd" pid=10869 comm="apparmor_parser"
[641138.964281] audit: type=1400 audit(1550182780.553:85): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.hook.install" pid=10877 comm="apparmor_parser"
[641138.965039] audit: type=1400 audit(1550182780.553:86): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.activate" pid=10871 comm="apparmor_parser"
[641138.965093] audit: type=1400 audit(1550182780.553:87): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.buginfo" pid=10873 comm="apparmor_parser"
[641138.965254] audit: type=1400 audit(1550182780.553:88): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.lxd" pid=10879 comm="apparmor_parser"
[641138.965482] audit: type=1400 audit(1550182780.553:89): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.benchmark" pid=10872 comm="apparmor_parser"
[641138.965850] audit: type=1400 audit(1550182780.553:90): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.migrate" pid=10880 comm="apparmor_parser"
[641138.966109] audit: type=1400 audit(1550182780.553:91): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.check-kernel" pid=10874 comm="apparmor_parser"
[641138.966261] audit: type=1400 audit(1550182780.553:92): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.daemon" pid=10875 comm="apparmor_parser"
[641138.966310] audit: type=1400 audit(1550182780.553:93): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.lxc" pid=10878 comm="apparmor_parser"
[745989.625624] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[772555.422232] kauditd_printk_skb: 1 callbacks suppressed
[772555.422234] audit: type=1400 audit(1550314197.274:95): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.check-kernel" pid=119101 comm="apparmor_parser"
[772555.423200] audit: type=1400 audit(1550314197.274:96): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.activate" pid=119098 comm="apparmor_parser"
[772555.423391] audit: type=1400 audit(1550314197.274:97): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.benchmark" pid=119099 comm="apparmor_parser"
[772555.423506] audit: type=1400 audit(1550314197.274:98): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.hook.install" pid=119104 comm="apparmor_parser"
[772555.423566] audit: type=1400 audit(1550314197.274:99): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.buginfo" pid=119100 comm="apparmor_parser"
[772555.424170] audit: type=1400 audit(1550314197.274:100): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.daemon" pid=119102 comm="apparmor_parser"
[772555.424469] audit: type=1400 audit(1550314197.274:101): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.migrate" pid=119107 comm="apparmor_parser"
[772555.424683] audit: type=1400 audit(1550314197.274:102): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.hook.configure" pid=119103 comm="apparmor_parser"
[772555.425169] audit: type=1400 audit(1550314197.274:103): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.lxd" pid=119106 comm="apparmor_parser"
[772555.425362] audit: type=1400 audit(1550314197.274:104): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.lxd.lxc" pid=119105 comm="apparmor_parser"
[1002619.951902] kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
[1013966.411007] printk: systemd: 47 output lines suppressed due to ratelimiting
[1013966.415270] systemd[1]: systemd 239 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid)
[1013966.416477] systemd[1]: Detected architecture ppc64-le.
[1013967.076048] systemd[1]: Stopping Journal Service...
[1013967.076145] systemd-journald[1610]: Received SIGTERM from PID 1 (systemd).
[1013969.648899] systemd[1]: Stopped Journal Service.
[1013969.658442] systemd[1]: Starting Journal Service...
[1013971.242693] systemd[1]: Started Journal Service.
[1026650.073797] kauditd_printk_skb: 5 callbacks suppressed
[1026650.073799] audit: type=1400 audit(1550568292.457:110): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="/usr/lib/snapd/snap-confine" pid=146345 comm="apparmor_parser"
[1026650.103530] audit: type=1400 audit(1550568292.489:111): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="/usr/lib/snapd/snap-confine//mount-namespace-capture-helper" pid=146345 comm="apparmor_parser"

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5174 bytes --]

^ permalink raw reply

* Re: [PATCH] powerpc/mm: Handle mmap_min_addr correctly in get_unmapped_area callback
From: Michael Ellerman @ 2019-02-19 11:04 UTC (permalink / raw)
  To: Aneesh Kumar K.V, npiggin, benh, paulus
  Cc: Aneesh Kumar K.V, Laurent Dufour, linuxppc-dev
In-Reply-To: <20190215081647.24876-1-aneesh.kumar@linux.ibm.com>

"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:

> After we ALIGN up the address we need to make sure we didn't overflow
> and resulted in zero address. In that case, we need to make sure that
> the returned address is greater than mmap_min_addr.
>
> Also when doing top-down search the low_limit is not PAGE_SIZE but rather
> max(PAGE_SIZE, mmap_min_addr). This handle cases in which mmap_min_addr >
> PAGE_SIZE.
>
> This fixes selftest va_128TBswitch --run-hugetlb reporting failures when
> run as non root user for
>
> mmap(-1, MAP_HUGETLB)
> mmap(-1, MAP_HUGETLB)
>
> We also avoid the first mmap(-1, MAP_HUGETLB) returning NULL address as mmap address
> with this change

So we think this is not a security issue, because it only affects
whether we choose an address below mmap_min_addr, not whether we
actually allow that address to be mapped.

ie. there are existing capability checks to prevent a user mapping below
mmap_min_addr and those will still be honoured even without this fix.

However there is a bug in that a non-root user requesting address -1
will be given address 0 which will then fail, whereas they should have
been given something else that would have succeeded.

Did I get that all right?

> CC: Laurent Dufour <ldufour@linux.vnet.ibm.com>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>

Seems like this should have a Fixes: tag?

cheers

> ---
>  arch/powerpc/mm/hugetlbpage-radix.c |  5 +++--
>  arch/powerpc/mm/slice.c             | 10 ++++++----
>  2 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/mm/hugetlbpage-radix.c b/arch/powerpc/mm/hugetlbpage-radix.c
> index 2486bee0f93e..97c7a39ebc00 100644
> --- a/arch/powerpc/mm/hugetlbpage-radix.c
> +++ b/arch/powerpc/mm/hugetlbpage-radix.c
> @@ -1,6 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0
>  #include <linux/mm.h>
>  #include <linux/hugetlb.h>
> +#include <linux/security.h>
>  #include <asm/pgtable.h>
>  #include <asm/pgalloc.h>
>  #include <asm/cacheflush.h>
> @@ -73,7 +74,7 @@ radix__hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
>  	if (addr) {
>  		addr = ALIGN(addr, huge_page_size(h));
>  		vma = find_vma(mm, addr);
> -		if (high_limit - len >= addr &&
> +		if (high_limit - len >= addr && addr >= mmap_min_addr &&
>  		    (!vma || addr + len <= vm_start_gap(vma)))
>  			return addr;
>  	}
> @@ -83,7 +84,7 @@ radix__hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
>  	 */
>  	info.flags = VM_UNMAPPED_AREA_TOPDOWN;
>  	info.length = len;
> -	info.low_limit = PAGE_SIZE;
> +	info.low_limit = max(PAGE_SIZE, mmap_min_addr);
>  	info.high_limit = mm->mmap_base + (high_limit - DEFAULT_MAP_WINDOW);
>  	info.align_mask = PAGE_MASK & ~huge_page_mask(h);
>  	info.align_offset = 0;
> diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
> index 06898c13901d..aec91dbcdc0b 100644
> --- a/arch/powerpc/mm/slice.c
> +++ b/arch/powerpc/mm/slice.c
> @@ -32,6 +32,7 @@
>  #include <linux/export.h>
>  #include <linux/hugetlb.h>
>  #include <linux/sched/mm.h>
> +#include <linux/security.h>
>  #include <asm/mman.h>
>  #include <asm/mmu.h>
>  #include <asm/copro.h>
> @@ -377,6 +378,7 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm,
>  	int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT);
>  	unsigned long addr, found, prev;
>  	struct vm_unmapped_area_info info;
> +	unsigned long min_addr = max(PAGE_SIZE, mmap_min_addr);
>  
>  	info.flags = VM_UNMAPPED_AREA_TOPDOWN;
>  	info.length = len;
> @@ -393,7 +395,7 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm,
>  	if (high_limit > DEFAULT_MAP_WINDOW)
>  		addr += mm->context.slb_addr_limit - DEFAULT_MAP_WINDOW;
>  
> -	while (addr > PAGE_SIZE) {
> +	while (addr > min_addr) {
>  		info.high_limit = addr;
>  		if (!slice_scan_available(addr - 1, available, 0, &addr))
>  			continue;
> @@ -405,8 +407,8 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm,
>  		 * Check if we need to reduce the range, or if we can
>  		 * extend it to cover the previous available slice.
>  		 */
> -		if (addr < PAGE_SIZE)
> -			addr = PAGE_SIZE;
> +		if (addr < min_addr)
> +			addr = min_addr;
>  		else if (slice_scan_available(addr - 1, available, 0, &prev)) {
>  			addr = prev;
>  			goto prev_slice;
> @@ -528,7 +530,7 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
>  		addr = _ALIGN_UP(addr, page_size);
>  		slice_dbg(" aligned addr=%lx\n", addr);
>  		/* Ignore hint if it's too large or overlaps a VMA */
> -		if (addr > high_limit - len ||
> +		if (addr > high_limit - len || addr < mmap_min_addr ||
>  		    !slice_area_is_free(mm, addr, len))
>  			addr = 0;
>  	}
> -- 
> 2.20.1

^ permalink raw reply

* Re: [PATCHv6 3/4] pci: layerscape: Add the EP mode support.
From: Lorenzo Pieralisi @ 2019-02-19 11:27 UTC (permalink / raw)
  To: Xiaowei Bao
  Cc: mark.rutland, roy.zang, arnd, devicetree, gregkh, kstewart,
	linuxppc-dev, linux-pci, linux-kernel, kishon, minghuan.Lian,
	robh+dt, cyrille.pitchen, linux-arm-kernel, pombredanne, bhelgaas,
	leoyang.li, shawnguo, shawn.lin, mingkai.hu
In-Reply-To: <20190122063328.25228-3-xiaowei.bao@nxp.com>

On Tue, Jan 22, 2019 at 02:33:27PM +0800, Xiaowei Bao wrote:
> Add the PCIe EP mode support for layerscape platform.
> 
> Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
> Reviewed-by: Minghuan Lian <minghuan.lian@nxp.com>
> Reviewed-by: Zhiqiang Hou <zhiqiang.hou@nxp.com>
> Reviewed-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
> depends on: https://patchwork.kernel.org/project/linux-pci/list/?series=66177
> 
> v2:
>  - remove the EP mode check function.
> v3:
>  - modif the return value when enter default case.
> v4:
>  - no change.
> v5:
>  - no change.
> v6:
>  - modify the code base on the submit patch of the EP framework.

Can I apply this series to my pci/endpoint branch (where I queued
Kishon's EP features rework patches) ? Can you check please ?

Thanks,
Lorenzo

>  drivers/pci/controller/dwc/Makefile            |    2 +-
>  drivers/pci/controller/dwc/pci-layerscape-ep.c |  157 ++++++++++++++++++++++++
>  2 files changed, 158 insertions(+), 1 deletions(-)
>  create mode 100644 drivers/pci/controller/dwc/pci-layerscape-ep.c
> 
> diff --git a/drivers/pci/controller/dwc/Makefile b/drivers/pci/controller/dwc/Makefile
> index 7bcdcdf..b5f3b83 100644
> --- a/drivers/pci/controller/dwc/Makefile
> +++ b/drivers/pci/controller/dwc/Makefile
> @@ -8,7 +8,7 @@ obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o
>  obj-$(CONFIG_PCI_IMX6) += pci-imx6.o
>  obj-$(CONFIG_PCIE_SPEAR13XX) += pcie-spear13xx.o
>  obj-$(CONFIG_PCI_KEYSTONE) += pci-keystone.o
> -obj-$(CONFIG_PCI_LAYERSCAPE) += pci-layerscape.o
> +obj-$(CONFIG_PCI_LAYERSCAPE) += pci-layerscape.o pci-layerscape-ep.o
>  obj-$(CONFIG_PCIE_QCOM) += pcie-qcom.o
>  obj-$(CONFIG_PCIE_ARMADA_8K) += pcie-armada8k.o
>  obj-$(CONFIG_PCIE_ARTPEC6) += pcie-artpec6.o
> diff --git a/drivers/pci/controller/dwc/pci-layerscape-ep.c b/drivers/pci/controller/dwc/pci-layerscape-ep.c
> new file mode 100644
> index 0000000..ddc2dbb
> --- /dev/null
> +++ b/drivers/pci/controller/dwc/pci-layerscape-ep.c
> @@ -0,0 +1,157 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * PCIe controller EP driver for Freescale Layerscape SoCs
> + *
> + * Copyright (C) 2018 NXP Semiconductor.
> + *
> + * Author: Xiaowei Bao <xiaowei.bao@nxp.com>
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/of_pci.h>
> +#include <linux/of_platform.h>
> +#include <linux/of_address.h>
> +#include <linux/pci.h>
> +#include <linux/platform_device.h>
> +#include <linux/resource.h>
> +
> +#include "pcie-designware.h"
> +
> +#define PCIE_DBI2_OFFSET		0x1000	/* DBI2 base address*/
> +
> +struct ls_pcie_ep {
> +	struct dw_pcie		*pci;
> +};
> +
> +#define to_ls_pcie_ep(x)	dev_get_drvdata((x)->dev)
> +
> +static int ls_pcie_establish_link(struct dw_pcie *pci)
> +{
> +	return 0;
> +}
> +
> +static const struct dw_pcie_ops ls_pcie_ep_ops = {
> +	.start_link = ls_pcie_establish_link,
> +};
> +
> +static const struct of_device_id ls_pcie_ep_of_match[] = {
> +	{ .compatible = "fsl,ls-pcie-ep",},
> +	{ },
> +};
> +
> +static const struct pci_epc_features ls_pcie_epc_features = {
> +	.linkup_notifier = false,
> +	.msi_capable = true,
> +	.msix_capable = false,
> +};
> +
> +static const struct pci_epc_features*
> +ls_pcie_ep_get_features(struct dw_pcie_ep *ep)
> +{
> +	return &ls_pcie_epc_features;
> +}
> +
> +static void ls_pcie_ep_init(struct dw_pcie_ep *ep)
> +{
> +	struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
> +	struct pci_epc *epc = ep->epc;
> +	enum pci_barno bar;
> +
> +	for (bar = BAR_0; bar <= BAR_5; bar++)
> +		dw_pcie_ep_reset_bar(pci, bar);
> +}
> +
> +static int ls_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
> +				  enum pci_epc_irq_type type, u16 interrupt_num)
> +{
> +	struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
> +
> +	switch (type) {
> +	case PCI_EPC_IRQ_LEGACY:
> +		return dw_pcie_ep_raise_legacy_irq(ep, func_no);
> +	case PCI_EPC_IRQ_MSI:
> +		return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num);
> +	case PCI_EPC_IRQ_MSIX:
> +		return dw_pcie_ep_raise_msix_irq(ep, func_no, interrupt_num);
> +	default:
> +		dev_err(pci->dev, "UNKNOWN IRQ type\n");
> +		return -EINVAL;
> +	}
> +}
> +
> +static struct dw_pcie_ep_ops pcie_ep_ops = {
> +	.ep_init = ls_pcie_ep_init,
> +	.raise_irq = ls_pcie_ep_raise_irq,
> +	.get_features = ls_pcie_ep_get_features,
> +};
> +
> +static int __init ls_add_pcie_ep(struct ls_pcie_ep *pcie,
> +					struct platform_device *pdev)
> +{
> +	struct dw_pcie *pci = pcie->pci;
> +	struct device *dev = pci->dev;
> +	struct dw_pcie_ep *ep;
> +	struct resource *res;
> +	int ret;
> +
> +	ep = &pci->ep;
> +	ep->ops = &pcie_ep_ops;
> +
> +	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "addr_space");
> +	if (!res)
> +		return -EINVAL;
> +
> +	ep->phys_base = res->start;
> +	ep->addr_size = resource_size(res);
> +
> +	ret = dw_pcie_ep_init(ep);
> +	if (ret) {
> +		dev_err(dev, "failed to initialize endpoint\n");
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static int __init ls_pcie_ep_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct dw_pcie *pci;
> +	struct ls_pcie_ep *pcie;
> +	struct resource *dbi_base;
> +	int ret;
> +
> +	pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
> +	if (!pcie)
> +		return -ENOMEM;
> +
> +	pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
> +	if (!pci)
> +		return -ENOMEM;
> +
> +	dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
> +	pci->dbi_base = devm_pci_remap_cfg_resource(dev, dbi_base);
> +	if (IS_ERR(pci->dbi_base))
> +		return PTR_ERR(pci->dbi_base);
> +
> +	pci->dbi_base2 = pci->dbi_base + PCIE_DBI2_OFFSET;
> +	pci->dev = dev;
> +	pci->ops = &ls_pcie_ep_ops;
> +	pcie->pci = pci;
> +
> +	platform_set_drvdata(pdev, pcie);
> +
> +	ret = ls_add_pcie_ep(pcie, pdev);
> +
> +	return ret;
> +}
> +
> +static struct platform_driver ls_pcie_ep_driver = {
> +	.driver = {
> +		.name = "layerscape-pcie-ep",
> +		.of_match_table = ls_pcie_ep_of_match,
> +		.suppress_bind_attrs = true,
> +	},
> +};
> +builtin_platform_driver_probe(ls_pcie_ep_driver, ls_pcie_ep_probe);
> -- 
> 1.7.1
> 

^ permalink raw reply

* Applied "SoC: imx-sgtl5000: add missing put_device()" to the asoc tree
From: Mark Brown @ 2019-02-19 11:47 UTC (permalink / raw)
  To: Wen Yang
  Cc: alsa-devel, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, Timur Tabi, Xiubo Li, Shawn Guo,
	Sascha Hauer, Takashi Iwai, Liam Girdwood, Kysela, Nicolin Chen,
	Jaroslav, Mark Brown, NXP Linux Team, Pengutronix Kernel Team,
	Fabio Estevam, linux-arm-kernel@lists.infradead.org
In-Reply-To: <HK0PR02MB3634C18C42652DC3A2893043B2630@HK0PR02MB3634.apcprd02.prod.outlook.com>

The patch

   SoC: imx-sgtl5000: add missing put_device()

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From 8fa857da9744f513036df1c43ab57f338941ae7d Mon Sep 17 00:00:00 2001
From: Wen Yang <yellowriver2010@hotmail.com>
Date: Mon, 18 Feb 2019 15:13:47 +0000
Subject: [PATCH] SoC: imx-sgtl5000: add missing put_device()

The of_find_device_by_node() takes a reference to the underlying device
structure, we should release that reference.

Detected by coccinelle with the following warnings:
./sound/soc/fsl/imx-sgtl5000.c:169:1-7: ERROR: missing put_device;
call of_find_device_by_node on line 105, but without a corresponding
object release within this function.
./sound/soc/fsl/imx-sgtl5000.c:177:1-7: ERROR: missing put_device;
call of_find_device_by_node on line 105, but without a corresponding
object release within this function.

Signed-off-by: Wen Yang <yellowriver2010@hotmail.com>
Cc: Timur Tabi <timur@kernel.org>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: alsa-devel@alsa-project.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/fsl/imx-sgtl5000.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c
index b6cb80480b60..bf8597f57dce 100644
--- a/sound/soc/fsl/imx-sgtl5000.c
+++ b/sound/soc/fsl/imx-sgtl5000.c
@@ -108,6 +108,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
 		ret = -EPROBE_DEFER;
 		goto fail;
 	}
+	put_device(&ssi_pdev->dev);
 	codec_dev = of_find_i2c_device_by_node(codec_np);
 	if (!codec_dev) {
 		dev_dbg(&pdev->dev, "failed to find codec platform device\n");
-- 
2.20.1


^ permalink raw reply related

* Re: [PATCH] powerpc/64s: Fix possible corruption on big endian due to pgd/pud_present()
From: Balbir Singh @ 2019-02-19 12:01 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: erhard_f, jack, linuxppc-dev, linux-kernel, linux-mm,
	aneesh.kumar
In-Reply-To: <87imxhrkdt.fsf@concordia.ellerman.id.au>

On Mon, Feb 18, 2019 at 11:49:18AM +1100, Michael Ellerman wrote:
> Balbir Singh <bsingharora@gmail.com> writes:
> > On Sun, Feb 17, 2019 at 07:34:20PM +1100, Michael Ellerman wrote:
> >> Balbir Singh <bsingharora@gmail.com> writes:
> >> > On Sat, Feb 16, 2019 at 08:22:12AM -0600, Segher Boessenkool wrote:
> >> >> On Sat, Feb 16, 2019 at 09:55:11PM +1100, Balbir Singh wrote:
> >> >> > On Thu, Feb 14, 2019 at 05:23:39PM +1100, Michael Ellerman wrote:
> >> >> > > In v4.20 we changed our pgd/pud_present() to check for _PAGE_PRESENT
> >> >> > > rather than just checking that the value is non-zero, e.g.:
> >> >> > > 
> >> >> > >   static inline int pgd_present(pgd_t pgd)
> >> >> > >   {
> >> >> > >  -       return !pgd_none(pgd);
> >> >> > >  +       return (pgd_raw(pgd) & cpu_to_be64(_PAGE_PRESENT));
> >> >> > >   }
> >> >> > > 
> >> >> > > Unfortunately this is broken on big endian, as the result of the
> >> >> > > bitwise && is truncated to int, which is always zero because
> >> >> 
> >> >> (Bitwise "&" of course).
> >> >> 
> >> >> > Not sure why that should happen, why is the result an int? What
> >> >> > causes the casting of pgd_t & be64 to be truncated to an int.
> >> >> 
> >> >> Yes, it's not obvious as written...  It's simply that the return type of
> >> >> pgd_present is int.  So it is truncated _after_ the bitwise and.
> >> >>
> >> >
> >> > Thanks, I am surprised the compiler does not complain about the truncation
> >> > of bits. I wonder if we are missing -Wconversion
> >> 
> >> Good luck with that :)
> >> 
> >> What I should start doing is building with it enabled and then comparing
> >> the output before and after commits to make sure we're not introducing
> >> new cases.
> >
> > Fair enough, my point was that the compiler can help out. I'll see what
> > -Wconversion finds on my local build :)
> 
> I get about 43MB of warnings here :)
>

I got about 181M with a failed build :(, but the warnings pointed to some cases
that can be a good project for cleanup

For example

1. 
static inline long regs_return_value(struct pt_regs *regs)
{
        if (is_syscall_success(regs))
                return regs->gpr[3];
        else
                return -regs->gpr[3];
}

In the case of is_syscall_success() returning false, we should ensure that
regs->gpr[3] is negative and capped within a certain limit, but it might
be an expensive check

2.
static inline void mark_hpte_slot_valid(unsigned char *hpte_slot_array,
                                        unsigned int index, unsigned int hidx)
{
        hpte_slot_array[index] = (hidx << 1) | 0x1;
}

hidx is 3 bits, but the argument is unsigned int. The caller probably does a
hidx & 0x7, but it's not clear from the code

3. hash__pmd_bad (pmd_bad) and hash__pud_bad (pud_bad) have issues similar to what was found,
but since the the page table indices are below 32, the macros are safe :)

And a few more, but I am not sure why I spent time looking at possible issues,
may be I am being stupid or overly pessimistic :)

Balbir



^ permalink raw reply

* [PATCH][next] soc: fsl: dpio: fix memory leak of a struct qbman on error exit path
From: Colin King @ 2019-02-19 14:05 UTC (permalink / raw)
  To: Roy Pledge, Li Yang, linuxppc-dev, linux-arm-kernel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently the error check for a null reg leaks a struct qbman
that was allocated earlier. Fix this by kfree'ing p on the error exit
path.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/soc/fsl/dpio/qbman-portal.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/fsl/dpio/qbman-portal.c b/drivers/soc/fsl/dpio/qbman-portal.c
index 0bddb85c0ae5..5a73397ae79e 100644
--- a/drivers/soc/fsl/dpio/qbman-portal.c
+++ b/drivers/soc/fsl/dpio/qbman-portal.c
@@ -180,6 +180,7 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d)
 	reg = qbman_read_register(p, QBMAN_CINH_SWP_CFG);
 	if (!reg) {
 		pr_err("qbman: the portal is not enabled!\n");
+		kfree(p);
 		return NULL;
 	}
 
-- 
2.20.1


^ permalink raw reply related

* Re: [PATCH] powerpc: Make PPC_64K_PAGES depend on only 44x or PPC_BOOK3S_64
From: Michael Ellerman @ 2019-02-19 14:14 UTC (permalink / raw)
  To: Christophe Leroy, linuxppc-dev; +Cc: oss, aneesh.kumar
In-Reply-To: <2fc1837d-af23-751c-d9af-0d0888b26ab4@c-s.fr>

Christophe Leroy <christophe.leroy@c-s.fr> writes:

> On 02/08/2019 12:34 PM, Michael Ellerman wrote:
>> In commit 7820856a4fcd ("powerpc/mm/book3e/64: Remove unsupported
>> 64Kpage size from 64bit booke") we dropped the 64K page size support
>> from the 64-bit nohash (Book3E) code.
>> 
>> But we didn't update the dependencies of the PPC_64K_PAGES option,
>> meaning a randconfig can still trigger this code and cause a build
>> breakage, eg:
>>    arch/powerpc/include/asm/nohash/64/pgtable.h:14:2: error: #error "Page size not supported"
>>    arch/powerpc/include/asm/nohash/mmu-book3e.h:275:2: error: #error Unsupported page size
>> 
>> So remove PPC_BOOK3E_64 from the dependencies. This also means we
>> don't need to worry about PPC_FSL_BOOK3E, because that was just trying
>> to prevent the PPC_BOOK3E_64=y && PPC_FSL_BOOK3E=y case.
>
> Does it means some cleanup could be done, for instance:
>
> arch/powerpc/include/asm/nohash/64/pgalloc.h:#ifndef CONFIG_PPC_64K_PAGES
> arch/powerpc/include/asm/nohash/64/pgalloc.h:#endif /* 
> CONFIG_PPC_64K_PAGES */
> arch/powerpc/include/asm/nohash/64/pgtable.h:#ifdef CONFIG_PPC_64K_PAGES
> arch/powerpc/include/asm/nohash/64/slice.h:#ifdef CONFIG_PPC_64K_PAGES
> arch/powerpc/include/asm/nohash/64/slice.h:#else /* CONFIG_PPC_64K_PAGES */
> arch/powerpc/include/asm/nohash/64/slice.h:#endif /* 
> !CONFIG_PPC_64K_PAGES */
> arch/powerpc/include/asm/nohash/pte-book3e.h:#ifdef CONFIG_PPC_64K_PAGES
>
> arch/powerpc/mm/tlb_low_64e.S:#ifdef CONFIG_PPC_64K_PAGES
> arch/powerpc/mm/tlb_low_64e.S:#ifndef CONFIG_PPC_64K_PAGES
> arch/powerpc/mm/tlb_low_64e.S:#endif /* CONFIG_PPC_64K_PAGES */
> arch/powerpc/mm/tlb_low_64e.S:#ifdef CONFIG_PPC_64K_PAGES
> arch/powerpc/mm/tlb_low_64e.S:#ifdef CONFIG_PPC_64K_PAGES
> arch/powerpc/mm/tlb_low_64e.S:#ifndef CONFIG_PPC_64K_PAGES
> arch/powerpc/mm/tlb_low_64e.S:#endif /* CONFIG_PPC_64K_PAGES */
> arch/powerpc/mm/tlb_low_64e.S:#ifndef CONFIG_PPC_64K_PAGES
> arch/powerpc/mm/tlb_low_64e.S:#endif /* CONFIG_PPC_64K_PAGES */
> arch/powerpc/mm/tlb_low_64e.S:#ifndef CONFIG_PPC_64K_PAGES
> arch/powerpc/mm/tlb_low_64e.S:#ifdef CONFIG_PPC_64K_PAGES

Probably.

Some of the FSL chips do support 64K pages at least according to some
datasheets. I don't know what would be required to get it working, or if
it even works in practice.

So it would be nice to get 64K working on those chips, but probably no
one has time or motivation to do it. In which case yeah all that code
should be removed.

cheers

^ permalink raw reply

* [PATCH][next] ptp_qoriq: don't pass a large struct by value but instead pass it by reference
From: Colin King @ 2019-02-19 14:21 UTC (permalink / raw)
  To: Yangbo Lu, Claudiu Manoil, David S . Miller, Richard Cochran,
	Li Yang, netdev, linuxppc-dev, linux-arm-kernel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Passing the struct ptp_clock_info caps by parameter is passing over 130 bytes
of data by value on the stack. Optimize this by passing it by reference instead.
Also shinks the object code size:

Before:
   text	   data	    bss	    dec	    hex	filename
  12596	   2160	     64	  14820	   39e4	drivers/ptp/ptp_qoriq.o

After:
   text	   data	    bss	    dec	    hex	filename
  12567	   2160	     64	  14791	   39c7	drivers/ptp/ptp_qoriq.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/freescale/enetc/enetc_ptp.c | 2 +-
 drivers/ptp/ptp_qoriq.c                          | 6 +++---
 include/linux/fsl/ptp_qoriq.h                    | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
index dc2f58a7c9e5..8c1497e7d9c5 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
@@ -92,7 +92,7 @@ static int enetc_ptp_probe(struct pci_dev *pdev,
 
 	ptp_qoriq->dev = &pdev->dev;
 
-	err = ptp_qoriq_init(ptp_qoriq, base, enetc_ptp_caps);
+	err = ptp_qoriq_init(ptp_qoriq, base, &enetc_ptp_caps);
 	if (err)
 		goto err_no_clock;
 
diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
index 42d3654f77f0..53775362aac6 100644
--- a/drivers/ptp/ptp_qoriq.c
+++ b/drivers/ptp/ptp_qoriq.c
@@ -459,7 +459,7 @@ static int ptp_qoriq_auto_config(struct ptp_qoriq *ptp_qoriq,
 }
 
 int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
-		   const struct ptp_clock_info caps)
+		   const struct ptp_clock_info *caps)
 {
 	struct device_node *node = ptp_qoriq->dev->of_node;
 	struct ptp_qoriq_registers *regs;
@@ -468,7 +468,7 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
 	u32 tmr_ctrl;
 
 	ptp_qoriq->base = base;
-	ptp_qoriq->caps = caps;
+	ptp_qoriq->caps = *caps;
 
 	if (of_property_read_u32(node, "fsl,cksel", &ptp_qoriq->cksel))
 		ptp_qoriq->cksel = DEFAULT_CKSEL;
@@ -605,7 +605,7 @@ static int ptp_qoriq_probe(struct platform_device *dev)
 		goto no_ioremap;
 	}
 
-	err = ptp_qoriq_init(ptp_qoriq, base, ptp_qoriq_caps);
+	err = ptp_qoriq_init(ptp_qoriq, base, &ptp_qoriq_caps);
 	if (err)
 		goto no_clock;
 
diff --git a/include/linux/fsl/ptp_qoriq.h b/include/linux/fsl/ptp_qoriq.h
index f127adb71041..992bf9fa1729 100644
--- a/include/linux/fsl/ptp_qoriq.h
+++ b/include/linux/fsl/ptp_qoriq.h
@@ -183,7 +183,7 @@ static inline void qoriq_write_le(unsigned __iomem *addr, u32 val)
 
 irqreturn_t ptp_qoriq_isr(int irq, void *priv);
 int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
-		   const struct ptp_clock_info caps);
+		   const struct ptp_clock_info *caps);
 void ptp_qoriq_free(struct ptp_qoriq *ptp_qoriq);
 int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm);
 int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta);
-- 
2.20.1


^ permalink raw reply related

* Re: [PATCH] powerpc: drop unused GENERIC_CSUM Kconfig item
From: Christoph Hellwig @ 2019-02-19 15:17 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: linux-kernel, Masahiro Yamada, Paul Mackerras, linuxppc-dev,
	Christoph Hellwig
In-Reply-To: <3695e169b0367503f3a424d4862cba5a247fabf4.1550226577.git.christophe.leroy@c-s.fr>

Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply

* Re: [PATCH 02/11] riscv: remove the HAVE_KPROBES option
From: Christoph Hellwig @ 2019-02-19 15:17 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-xtensa, Linux Kbuild mailing list, linux-s390,
	Linux Kernel Mailing List, linux-riscv, linuxppc-dev,
	Christoph Hellwig
In-Reply-To: <CAK7LNAQFSQN=42X1dqt5io+gOG8mUpwXhLmspqryvmzakUCSWw@mail.gmail.com>

On Fri, Feb 15, 2019 at 06:32:07PM +0900, Masahiro Yamada wrote:
> On Thu, Feb 14, 2019 at 2:40 AM Christoph Hellwig <hch@lst.de> wrote:
> >
> > HAVE_KPROBES is defined genericly in arch/Kconfig and architectures
> > should just select it if supported.
> >
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Do you want this patch picked up by me?
> 
> Or, by Palmer?

Given that I don't think I'll have the rest of this series respun in time
for this merge window:  Palmer, can you pick it up?

^ permalink raw reply

* [PATCH] powerpc/pseries: Fix dn reference error in dlpar_cpu_remove_by_index
From: Michael Bringmann @ 2019-02-19 15:46 UTC (permalink / raw)
  To: linuxppc-dev, linux-kernel
  Cc: Rob Herring, Thomas Falcon, Nicholas Piggin, Michael Bringmann,
	Paul Mackerras, Tyrel Datwyler, Nathan Lynch, Juliet M. Kim

powerpc/pseries: Fix dn reference error in dlpar_cpu_remove_by_index()

A reference to the device node of the CPU to be removed is released
upon successful removal of the associated CPU device.  If the call
to remove the CPU device fails, dlpar_cpu_remove_by_index() still
frees the reference and this leads to miscomparisons and/or
addressing errors later on.

This problem may be observed when trying to DLPAR 'hot-remove' a CPU
from a system that has only a single CPU.  The operation will fail
because there is no other CPU to which the kernel operations may be
migrated, but the refcount will still be decremented.

Signed-off-by: Michael Bringmann <mwb@linux.vnet.ibm.com>


diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 97feb6e..9537bb9 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -635,7 +635,8 @@ static int dlpar_cpu_remove_by_index(u32 drc_index)
 	}
 
 	rc = dlpar_cpu_remove(dn, drc_index);
-	of_node_put(dn);
+	if (!rc)
+		of_node_put(dn);
 	return rc;
 }
 


^ permalink raw reply related

* [PATCH v6 0/6] KASAN for powerpc/32
From: Christophe Leroy @ 2019-02-19 17:23 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Nicholas Piggin, Aneesh Kumar K.V, Andrey Ryabinin,
	Alexander Potapenko, Dmitry Vyukov, Daniel Axtens
  Cc: linux-mm, linuxppc-dev, linux-kernel, kasan-dev

This serie adds KASAN support to powerpc/32

Tested on nohash/32 (8xx) and book3s/32 (mpc832x ie 603).
Boot tested on qemu mac99

Changes in v6:
- Fixed oops on module loading (due to access to RO shadow zero area).
- Added support for hash book3s/32, thanks to Daniel's patch to differ KASAN activation.
- Reworked handling of optimised string functions (dedicated patch for it)
- Reordered some files to ease adding of book3e/64 support.

Changes in v5:
- Added KASAN_SHADOW_OFFSET in Makefile, otherwise we fallback to KASAN_MINIMAL
and some stuff like stack instrumentation is not performed
- Moved calls to kasan_early_init() in head.S because stack instrumentation
in machine_init was performed before the call to kasan_early_init()
- Mapping kasan_early_shadow_page RW in kasan_early_init() and
remaping RO later in kasan_init()
- Allocating a big memblock() for shadow area, falling back to PAGE_SIZE blocks in case of failure.

Changes in v4:
- Comments from Andrey (DISABLE_BRANCH_PROFILING, Activation of reports)
- Proper initialisation of shadow area in kasan_init()
- Panic in case Hash table is required.
- Added comments in patch one to explain why *t = *s becomes memcpy(t, s, ...)
- Call of kasan_init_tags()

Changes in v3:
- Removed the printk() in kasan_early_init() to avoid build failure (see https://github.com/linuxppc/issues/issues/218)
- Added necessary changes in asm/book3s/32/pgtable.h to get it work on powerpc 603 family
- Added a few KASAN_SANITIZE_xxx.o := n to successfully boot on powerpc 603 family

Changes in v2:
- Rebased.
- Using __set_pte_at() to build the early table.
- Worked around and got rid of the patch adding asm/page.h in asm/pgtable-types.h
    ==> might be fixed independently but not needed for this serie.

For book3s/32 we have to stick to KASAN_MINIMAL because Hash table
management is not active early enough at the time being.

Christophe Leroy (6):
  powerpc/mm: prepare kernel for KAsan on PPC32
  powerpc/32: Move early_init() in a separate file
  powerpc: prepare string/mem functions for KASAN
  powerpc/32: Add KASAN support
  kasan: allow architectures to provide an outline readiness check
  powerpc/32: enable CONFIG_KASAN for book3s hash

 arch/powerpc/Kconfig                          |   1 +
 arch/powerpc/Makefile                         |   9 ++
 arch/powerpc/include/asm/book3s/32/pgtable.h  |   2 +
 arch/powerpc/include/asm/highmem.h            |  10 +-
 arch/powerpc/include/asm/kasan.h              |  51 ++++++++
 arch/powerpc/include/asm/nohash/32/pgtable.h  |   2 +
 arch/powerpc/include/asm/setup.h              |   5 +
 arch/powerpc/include/asm/string.h             |  26 +++-
 arch/powerpc/kernel/Makefile                  |  11 +-
 arch/powerpc/kernel/asm-offsets.c             |   4 +
 arch/powerpc/kernel/cputable.c                |  13 +-
 arch/powerpc/kernel/early_32.c                |  36 ++++++
 arch/powerpc/kernel/head_32.S                 |   3 +
 arch/powerpc/kernel/head_40x.S                |   3 +
 arch/powerpc/kernel/head_44x.S                |   3 +
 arch/powerpc/kernel/head_8xx.S                |   3 +
 arch/powerpc/kernel/head_fsl_booke.S          |   3 +
 arch/powerpc/kernel/prom_init_check.sh        |  10 +-
 arch/powerpc/kernel/setup-common.c            |   2 +
 arch/powerpc/kernel/setup_32.c                |  28 -----
 arch/powerpc/lib/Makefile                     |  16 ++-
 arch/powerpc/lib/copy_32.S                    |  13 +-
 arch/powerpc/lib/mem_64.S                     |   8 +-
 arch/powerpc/lib/memcpy_64.S                  |   4 +-
 arch/powerpc/mm/Makefile                      |   1 +
 arch/powerpc/mm/kasan/Makefile                |   5 +
 arch/powerpc/mm/kasan/kasan_init_32.c         | 170 ++++++++++++++++++++++++++
 arch/powerpc/mm/mem.c                         |   4 +
 arch/powerpc/mm/ptdump/dump_linuxpagetables.c |   8 ++
 arch/powerpc/purgatory/Makefile               |   3 +
 arch/powerpc/xmon/Makefile                    |   1 +
 include/linux/kasan.h                         |   4 +
 mm/kasan/generic.c                            |   3 +
 33 files changed, 412 insertions(+), 53 deletions(-)
 create mode 100644 arch/powerpc/include/asm/kasan.h
 create mode 100644 arch/powerpc/kernel/early_32.c
 create mode 100644 arch/powerpc/mm/kasan/Makefile
 create mode 100644 arch/powerpc/mm/kasan/kasan_init_32.c

-- 
2.13.3


^ permalink raw reply

* [PATCH v6 2/6] powerpc/32: Move early_init() in a separate file
From: Christophe Leroy @ 2019-02-19 17:23 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Nicholas Piggin, Aneesh Kumar K.V, Andrey Ryabinin,
	Alexander Potapenko, Dmitry Vyukov, Daniel Axtens
  Cc: linux-mm, linuxppc-dev, linux-kernel, kasan-dev
In-Reply-To: <cover.1550596242.git.christophe.leroy@c-s.fr>

In preparation of KASAN, move early_init() into a separate
file in order to allow deactivation of KASAN for that function.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/kernel/Makefile   |  2 +-
 arch/powerpc/kernel/early_32.c | 36 ++++++++++++++++++++++++++++++++++++
 arch/powerpc/kernel/setup_32.c | 26 --------------------------
 3 files changed, 37 insertions(+), 27 deletions(-)
 create mode 100644 arch/powerpc/kernel/early_32.c

diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index cb7f0bb9ee71..879b36602748 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -93,7 +93,7 @@ extra-y				+= vmlinux.lds
 
 obj-$(CONFIG_RELOCATABLE)	+= reloc_$(BITS).o
 
-obj-$(CONFIG_PPC32)		+= entry_32.o setup_32.o
+obj-$(CONFIG_PPC32)		+= entry_32.o setup_32.o early_32.o
 obj-$(CONFIG_PPC64)		+= dma-iommu.o iommu.o
 obj-$(CONFIG_KGDB)		+= kgdb.o
 obj-$(CONFIG_BOOTX_TEXT)	+= btext.o
diff --git a/arch/powerpc/kernel/early_32.c b/arch/powerpc/kernel/early_32.c
new file mode 100644
index 000000000000..3482118ffe76
--- /dev/null
+++ b/arch/powerpc/kernel/early_32.c
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/*
+ * Early init before relocation
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <asm/setup.h>
+#include <asm/sections.h>
+#include <asm/asm-prototypes.h>
+
+/*
+ * We're called here very early in the boot.
+ *
+ * Note that the kernel may be running at an address which is different
+ * from the address that it was linked at, so we must use RELOC/PTRRELOC
+ * to access static data (including strings).  -- paulus
+ */
+notrace unsigned long __init early_init(unsigned long dt_ptr)
+{
+	unsigned long offset = reloc_offset();
+
+	/* First zero the BSS */
+	memset(PTRRELOC(&__bss_start), 0, __bss_stop - __bss_start);
+
+	/*
+	 * Identify the CPU type and fix up code sections
+	 * that depend on which cpu we have.
+	 */
+	identify_cpu(offset, mfspr(SPRN_PVR));
+
+	apply_feature_fixups();
+
+	return KERNELBASE + offset;
+}
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 5e761eb16a6d..b46a9a33225b 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -63,32 +63,6 @@ EXPORT_SYMBOL(DMA_MODE_READ);
 EXPORT_SYMBOL(DMA_MODE_WRITE);
 
 /*
- * We're called here very early in the boot.
- *
- * Note that the kernel may be running at an address which is different
- * from the address that it was linked at, so we must use RELOC/PTRRELOC
- * to access static data (including strings).  -- paulus
- */
-notrace unsigned long __init early_init(unsigned long dt_ptr)
-{
-	unsigned long offset = reloc_offset();
-
-	/* First zero the BSS */
-	memset(PTRRELOC(&__bss_start), 0, __bss_stop - __bss_start);
-
-	/*
-	 * Identify the CPU type and fix up code sections
-	 * that depend on which cpu we have.
-	 */
-	identify_cpu(offset, mfspr(SPRN_PVR));
-
-	apply_feature_fixups();
-
-	return KERNELBASE + offset;
-}
-
-
-/*
  * This is run before start_kernel(), the kernel has been relocated
  * and we are running with enough of the MMU enabled to have our
  * proper kernel virtual addresses
-- 
2.13.3


^ permalink raw reply related

* [PATCH v6 1/6] powerpc/mm: prepare kernel for KAsan on PPC32
From: Christophe Leroy @ 2019-02-19 17:23 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Nicholas Piggin, Aneesh Kumar K.V, Andrey Ryabinin,
	Alexander Potapenko, Dmitry Vyukov, Daniel Axtens
  Cc: linux-mm, linuxppc-dev, linux-kernel, kasan-dev
In-Reply-To: <cover.1550596242.git.christophe.leroy@c-s.fr>

In kernel/cputable.c, explicitly use memcpy() in order
to allow GCC to replace it with __memcpy() when KASAN is
selected.

Since commit 400c47d81ca38 ("powerpc32: memset: only use dcbz once cache is
enabled"), memset() can be used before activation of the cache,
so no need to use memset_io() for zeroing the BSS.

Acked-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/kernel/cputable.c | 13 ++++++++++---
 arch/powerpc/kernel/setup_32.c |  6 ++----
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 1eab54bc6ee9..cd12f362b61f 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -2147,7 +2147,11 @@ void __init set_cur_cpu_spec(struct cpu_spec *s)
 	struct cpu_spec *t = &the_cpu_spec;
 
 	t = PTRRELOC(t);
-	*t = *s;
+	/*
+	 * use memcpy() instead of *t = *s so that GCC replaces it
+	 * by __memcpy() when KASAN is active
+	 */
+	memcpy(t, s, sizeof(*t));
 
 	*PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;
 }
@@ -2161,8 +2165,11 @@ static struct cpu_spec * __init setup_cpu_spec(unsigned long offset,
 	t = PTRRELOC(t);
 	old = *t;
 
-	/* Copy everything, then do fixups */
-	*t = *s;
+	/*
+	 * Copy everything, then do fixups. Use memcpy() instead of *t = *s
+	 * so that GCC replaces it by __memcpy() when KASAN is active
+	 */
+	memcpy(t, s, sizeof(*t));
 
 	/*
 	 * If we are overriding a previous value derived from the real
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 947f904688b0..5e761eb16a6d 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -73,10 +73,8 @@ notrace unsigned long __init early_init(unsigned long dt_ptr)
 {
 	unsigned long offset = reloc_offset();
 
-	/* First zero the BSS -- use memset_io, some platforms don't have
-	 * caches on yet */
-	memset_io((void __iomem *)PTRRELOC(&__bss_start), 0,
-			__bss_stop - __bss_start);
+	/* First zero the BSS */
+	memset(PTRRELOC(&__bss_start), 0, __bss_stop - __bss_start);
 
 	/*
 	 * Identify the CPU type and fix up code sections
-- 
2.13.3


^ permalink raw reply related

* [PATCH v6 3/6] powerpc: prepare string/mem functions for KASAN
From: Christophe Leroy @ 2019-02-19 17:23 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Nicholas Piggin, Aneesh Kumar K.V, Andrey Ryabinin,
	Alexander Potapenko, Dmitry Vyukov, Daniel Axtens
  Cc: linux-mm, linuxppc-dev, linux-kernel, kasan-dev
In-Reply-To: <cover.1550596242.git.christophe.leroy@c-s.fr>

CONFIG_KASAN implements wrappers for memcpy() memmove() and memset()
Those wrappers are doing the verification then call respectively
__memcpy() __memmove() and __memset(). The arches are therefore
expected to rename their optimised functions that way.

For files on which KASAN is inhibited, #defines are used to allow
them to directly call optimised versions of the functions without
going through the KASAN wrappers.

See 393f203f5fd5 ("x86_64: kasan: add interceptors for
memset/memmove/memcpy functions") for details.

Other string / mem functions do not (yet) have kasan wrappers,
we therefore have to fallback to the generic versions when
KASAN is active, otherwise KASAN checks will be skipped.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/include/asm/kasan.h       | 15 +++++++++++++++
 arch/powerpc/include/asm/string.h      | 26 ++++++++++++++++++++++++--
 arch/powerpc/kernel/prom_init_check.sh | 10 +++++++++-
 arch/powerpc/lib/Makefile              |  8 ++++++--
 arch/powerpc/lib/copy_32.S             | 13 +++++++------
 arch/powerpc/lib/mem_64.S              |  8 ++++----
 arch/powerpc/lib/memcpy_64.S           |  4 ++--
 7 files changed, 67 insertions(+), 17 deletions(-)
 create mode 100644 arch/powerpc/include/asm/kasan.h

diff --git a/arch/powerpc/include/asm/kasan.h b/arch/powerpc/include/asm/kasan.h
new file mode 100644
index 000000000000..2efd0e42cfc9
--- /dev/null
+++ b/arch/powerpc/include/asm/kasan.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __ASM_KASAN_H
+#define __ASM_KASAN_H
+
+#ifdef CONFIG_KASAN
+#define _GLOBAL_KASAN(fn)	.weak fn ; _GLOBAL(__##fn) ; _GLOBAL(fn)
+#define _GLOBAL_KASAN_TOC(fn)	.weak fn ; _GLOBAL_TOC(__##fn) ; _GLOBAL_TOC(fn)
+#define EXPORT_SYMBOL_KASAN(fn)	EXPORT_SYMBOL(__##fn) ; EXPORT_SYMBOL(fn)
+#else
+#define _GLOBAL_KASAN(fn)	_GLOBAL(fn)
+#define _GLOBAL_KASAN_TOC(fn)	_GLOBAL_TOC(fn)
+#define EXPORT_SYMBOL_KASAN(fn)	EXPORT_SYMBOL(fn)
+#endif
+
+#endif
diff --git a/arch/powerpc/include/asm/string.h b/arch/powerpc/include/asm/string.h
index 1647de15a31e..2aa9ea6751cd 100644
--- a/arch/powerpc/include/asm/string.h
+++ b/arch/powerpc/include/asm/string.h
@@ -4,13 +4,16 @@
 
 #ifdef __KERNEL__
 
+#ifndef CONFIG_KASAN
 #define __HAVE_ARCH_STRNCPY
 #define __HAVE_ARCH_STRNCMP
+#define __HAVE_ARCH_MEMCHR
+#define __HAVE_ARCH_MEMCMP
+#endif
+
 #define __HAVE_ARCH_MEMSET
 #define __HAVE_ARCH_MEMCPY
 #define __HAVE_ARCH_MEMMOVE
-#define __HAVE_ARCH_MEMCMP
-#define __HAVE_ARCH_MEMCHR
 #define __HAVE_ARCH_MEMSET16
 #define __HAVE_ARCH_MEMCPY_FLUSHCACHE
 
@@ -27,6 +30,25 @@ extern int memcmp(const void *,const void *,__kernel_size_t);
 extern void * memchr(const void *,int,__kernel_size_t);
 extern void * memcpy_flushcache(void *,const void *,__kernel_size_t);
 
+void *__memset(void *s, int c, __kernel_size_t count);
+void *__memcpy(void *to, const void *from, __kernel_size_t n);
+void *__memmove(void *to, const void *from, __kernel_size_t n);
+
+#if defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__)
+/*
+ * For files that are not instrumented (e.g. mm/slub.c) we
+ * should use not instrumented version of mem* functions.
+ */
+#define memcpy(dst, src, len) __memcpy(dst, src, len)
+#define memmove(dst, src, len) __memmove(dst, src, len)
+#define memset(s, c, n) __memset(s, c, n)
+
+#ifndef __NO_FORTIFY
+#define __NO_FORTIFY /* FORTIFY_SOURCE uses __builtin_memcpy, etc. */
+#endif
+
+#endif
+
 #ifdef CONFIG_PPC64
 #define __HAVE_ARCH_MEMSET32
 #define __HAVE_ARCH_MEMSET64
diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
index 667df97d2595..da6bb16e0876 100644
--- a/arch/powerpc/kernel/prom_init_check.sh
+++ b/arch/powerpc/kernel/prom_init_check.sh
@@ -16,8 +16,16 @@
 # If you really need to reference something from prom_init.o add
 # it to the list below:
 
+grep CONFIG_KASAN=y .config >/dev/null
+if [ $? -eq 0 ]
+then
+	MEMFCT="__memcpy __memset"
+else
+	MEMFCT="memcpy memset"
+fi
+
 WHITELIST="add_reloc_offset __bss_start __bss_stop copy_and_flush
-_end enter_prom memcpy memset reloc_offset __secondary_hold
+_end enter_prom $MEMFCT reloc_offset __secondary_hold
 __secondary_hold_acknowledge __secondary_hold_spinloop __start
 strcmp strcpy strlcpy strlen strncmp strstr kstrtobool logo_linux_clut224
 reloc_got2 kernstart_addr memstart_addr linux_banner _stext
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 3bf9fc6fd36c..ee08a7e1bcdf 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -8,7 +8,11 @@ ccflags-$(CONFIG_PPC64)	:= $(NO_MINIMAL_TOC)
 CFLAGS_REMOVE_code-patching.o = $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_feature-fixups.o = $(CC_FLAGS_FTRACE)
 
-obj-y += string.o alloc.o code-patching.o feature-fixups.o
+obj-y += alloc.o code-patching.o feature-fixups.o
+
+ifndef CONFIG_KASAN
+obj-y	+=	string.o memcmp_$(BITS).o
+endif
 
 obj-$(CONFIG_PPC32)	+= div64.o copy_32.o crtsavres.o strlen_32.o
 
@@ -33,7 +37,7 @@ obj64-$(CONFIG_ALTIVEC)	+= vmx-helper.o
 obj64-$(CONFIG_KPROBES_SANITY_TEST) += test_emulate_step.o
 
 obj-y			+= checksum_$(BITS).o checksum_wrappers.o \
-			   string_$(BITS).o memcmp_$(BITS).o
+			   string_$(BITS).o
 
 obj-y			+= sstep.o ldstfp.o quad.o
 obj64-y			+= quad.o
diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S
index ba66846fe973..57f48d99fbe3 100644
--- a/arch/powerpc/lib/copy_32.S
+++ b/arch/powerpc/lib/copy_32.S
@@ -14,6 +14,7 @@
 #include <asm/ppc_asm.h>
 #include <asm/export.h>
 #include <asm/code-patching-asm.h>
+#include <asm/kasan.h>
 
 #define COPY_16_BYTES		\
 	lwz	r7,4(r4);	\
@@ -91,7 +92,7 @@ EXPORT_SYMBOL(memset16)
  * We therefore skip the optimised bloc that uses dcbz. This jump is
  * replaced by a nop once cache is active. This is done in machine_init()
  */
-_GLOBAL(memset)
+_GLOBAL_KASAN(memset)
 	cmplwi	0,r5,4
 	blt	7f
 
@@ -150,7 +151,7 @@ _GLOBAL(memset)
 9:	stbu	r4,1(r6)
 	bdnz	9b
 	blr
-EXPORT_SYMBOL(memset)
+EXPORT_SYMBOL_KASAN(memset)
 
 /*
  * This version uses dcbz on the complete cache lines in the
@@ -163,12 +164,12 @@ EXPORT_SYMBOL(memset)
  * We therefore jump to generic_memcpy which doesn't use dcbz. This jump is
  * replaced by a nop once cache is active. This is done in machine_init()
  */
-_GLOBAL(memmove)
+_GLOBAL_KASAN(memmove)
 	cmplw	0,r3,r4
 	bgt	backwards_memcpy
 	/* fall through */
 
-_GLOBAL(memcpy)
+_GLOBAL_KASAN(memcpy)
 1:	b	generic_memcpy
 	patch_site	1b, patch__memcpy_nocache
 
@@ -242,8 +243,8 @@ _GLOBAL(memcpy)
 	stbu	r0,1(r6)
 	bdnz	40b
 65:	blr
-EXPORT_SYMBOL(memcpy)
-EXPORT_SYMBOL(memmove)
+EXPORT_SYMBOL_KASAN(memcpy)
+EXPORT_SYMBOL_KASAN(memmove)
 
 generic_memcpy:
 	srwi.	r7,r5,3
diff --git a/arch/powerpc/lib/mem_64.S b/arch/powerpc/lib/mem_64.S
index 3c3be02f33b7..57c8a940c29c 100644
--- a/arch/powerpc/lib/mem_64.S
+++ b/arch/powerpc/lib/mem_64.S
@@ -30,7 +30,7 @@ EXPORT_SYMBOL(__memset16)
 EXPORT_SYMBOL(__memset32)
 EXPORT_SYMBOL(__memset64)
 
-_GLOBAL(memset)
+_GLOBAL_KASAN(memset)
 	neg	r0,r3
 	rlwimi	r4,r4,8,16,23
 	andi.	r0,r0,7			/* # bytes to be 8-byte aligned */
@@ -95,9 +95,9 @@ _GLOBAL(memset)
 10:	bflr	31
 	stb	r4,0(r6)
 	blr
-EXPORT_SYMBOL(memset)
+EXPORT_SYMBOL_KASAN(memset)
 
-_GLOBAL_TOC(memmove)
+_GLOBAL_TOC_KASAN(memmove)
 	cmplw	0,r3,r4
 	bgt	backwards_memcpy
 	b	memcpy
@@ -138,4 +138,4 @@ _GLOBAL(backwards_memcpy)
 	beq	2b
 	mtctr	r7
 	b	1b
-EXPORT_SYMBOL(memmove)
+EXPORT_SYMBOL_KASAN(memmove)
diff --git a/arch/powerpc/lib/memcpy_64.S b/arch/powerpc/lib/memcpy_64.S
index 273ea67e60a1..2d5358cee711 100644
--- a/arch/powerpc/lib/memcpy_64.S
+++ b/arch/powerpc/lib/memcpy_64.S
@@ -18,7 +18,7 @@
 #endif
 
 	.align	7
-_GLOBAL_TOC(memcpy)
+_GLOBAL_TOC_KASAN(memcpy)
 BEGIN_FTR_SECTION
 #ifdef __LITTLE_ENDIAN__
 	cmpdi	cr7,r5,0
@@ -229,4 +229,4 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
 4:	ld	r3,-STACKFRAMESIZE+STK_REG(R31)(r1)	/* return dest pointer */
 	blr
 #endif
-EXPORT_SYMBOL(memcpy)
+EXPORT_SYMBOL_KASAN(memcpy)
-- 
2.13.3


^ permalink raw reply related

* [PATCH v6 4/6] powerpc/32: Add KASAN support
From: Christophe Leroy @ 2019-02-19 17:23 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Nicholas Piggin, Aneesh Kumar K.V, Andrey Ryabinin,
	Alexander Potapenko, Dmitry Vyukov, Daniel Axtens
  Cc: linux-mm, linuxppc-dev, linux-kernel, kasan-dev
In-Reply-To: <cover.1550596242.git.christophe.leroy@c-s.fr>

This patch adds KASAN support for PPC32.

The KASAN shadow area is located between the vmalloc area and the
fixmap area.

KASAN_SHADOW_OFFSET is calculated in asm/kasan.h and extracted
by Makefile prepare rule via asm-offsets.h

For modules, the shadow area is allocated at module_alloc().

Note that on book3s it will only work on the 603 because the other
ones use hash table and can therefore not share a single PTE table
covering the entire early KASAN shadow area.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/Kconfig                          |   1 +
 arch/powerpc/Makefile                         |   7 ++
 arch/powerpc/include/asm/book3s/32/pgtable.h  |   2 +
 arch/powerpc/include/asm/highmem.h            |  10 +-
 arch/powerpc/include/asm/kasan.h              |  23 ++++
 arch/powerpc/include/asm/nohash/32/pgtable.h  |   2 +
 arch/powerpc/include/asm/setup.h              |   5 +
 arch/powerpc/kernel/Makefile                  |   9 +-
 arch/powerpc/kernel/asm-offsets.c             |   4 +
 arch/powerpc/kernel/head_32.S                 |   3 +
 arch/powerpc/kernel/head_40x.S                |   3 +
 arch/powerpc/kernel/head_44x.S                |   3 +
 arch/powerpc/kernel/head_8xx.S                |   3 +
 arch/powerpc/kernel/head_fsl_booke.S          |   3 +
 arch/powerpc/kernel/setup-common.c            |   2 +
 arch/powerpc/lib/Makefile                     |   8 ++
 arch/powerpc/mm/Makefile                      |   1 +
 arch/powerpc/mm/kasan/Makefile                |   5 +
 arch/powerpc/mm/kasan/kasan_init_32.c         | 147 ++++++++++++++++++++++++++
 arch/powerpc/mm/mem.c                         |   4 +
 arch/powerpc/mm/ptdump/dump_linuxpagetables.c |   8 ++
 arch/powerpc/purgatory/Makefile               |   3 +
 arch/powerpc/xmon/Makefile                    |   1 +
 23 files changed, 253 insertions(+), 4 deletions(-)
 create mode 100644 arch/powerpc/mm/kasan/Makefile
 create mode 100644 arch/powerpc/mm/kasan/kasan_init_32.c

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 08908219fba9..850b06def84f 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -175,6 +175,7 @@ config PPC
 	select GENERIC_TIME_VSYSCALL
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_ARCH_JUMP_LABEL
+	select HAVE_ARCH_KASAN			if PPC32
 	select HAVE_ARCH_KGDB
 	select HAVE_ARCH_MMAP_RND_BITS
 	select HAVE_ARCH_MMAP_RND_COMPAT_BITS	if COMPAT
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index ac033341ed55..f0738099e31e 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -427,6 +427,13 @@ else
 endif
 endif
 
+ifdef CONFIG_KASAN
+prepare: kasan_prepare
+
+kasan_prepare: prepare0
+       $(eval KASAN_SHADOW_OFFSET = $(shell awk '{if ($$2 == "KASAN_SHADOW_OFFSET") print $$3;}' include/generated/asm-offsets.h))
+endif
+
 # Check toolchain versions:
 # - gcc-4.6 is the minimum kernel-wide version so nothing required.
 checkbin:
diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/include/asm/book3s/32/pgtable.h
index 49d76adb9bc5..4543016f80ca 100644
--- a/arch/powerpc/include/asm/book3s/32/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/32/pgtable.h
@@ -141,6 +141,8 @@ static inline bool pte_user(pte_t pte)
  */
 #ifdef CONFIG_HIGHMEM
 #define KVIRT_TOP	PKMAP_BASE
+#elif defined(CONFIG_KASAN)
+#define KVIRT_TOP	KASAN_SHADOW_START
 #else
 #define KVIRT_TOP	(0xfe000000UL)	/* for now, could be FIXMAP_BASE ? */
 #endif
diff --git a/arch/powerpc/include/asm/highmem.h b/arch/powerpc/include/asm/highmem.h
index a4b65b186ec6..483b90025bef 100644
--- a/arch/powerpc/include/asm/highmem.h
+++ b/arch/powerpc/include/asm/highmem.h
@@ -28,6 +28,7 @@
 #include <asm/cacheflush.h>
 #include <asm/page.h>
 #include <asm/fixmap.h>
+#include <asm/kasan.h>
 
 extern pte_t *kmap_pte;
 extern pgprot_t kmap_prot;
@@ -50,10 +51,15 @@ extern pte_t *pkmap_page_table;
 #define PKMAP_ORDER	9
 #endif
 #define LAST_PKMAP	(1 << PKMAP_ORDER)
+#ifdef CONFIG_KASAN
+#define PKMAP_TOP	KASAN_SHADOW_START
+#else
+#define PKMAP_TOP	FIXADDR_START
+#endif
 #ifndef CONFIG_PPC_4K_PAGES
-#define PKMAP_BASE	(FIXADDR_START - PAGE_SIZE*(LAST_PKMAP + 1))
+#define PKMAP_BASE	(PKMAP_TOP - PAGE_SIZE*(LAST_PKMAP + 1))
 #else
-#define PKMAP_BASE	((FIXADDR_START - PAGE_SIZE*(LAST_PKMAP + 1)) & PMD_MASK)
+#define PKMAP_BASE	((PKMAP_TOP - PAGE_SIZE*(LAST_PKMAP + 1)) & PMD_MASK)
 #endif
 #define LAST_PKMAP_MASK	(LAST_PKMAP-1)
 #define PKMAP_NR(virt)  ((virt-PKMAP_BASE) >> PAGE_SHIFT)
diff --git a/arch/powerpc/include/asm/kasan.h b/arch/powerpc/include/asm/kasan.h
index 2efd0e42cfc9..0bc9148f5d87 100644
--- a/arch/powerpc/include/asm/kasan.h
+++ b/arch/powerpc/include/asm/kasan.h
@@ -12,4 +12,27 @@
 #define EXPORT_SYMBOL_KASAN(fn)	EXPORT_SYMBOL(fn)
 #endif
 
+#ifndef __ASSEMBLY__
+
+#include <asm/page.h>
+#include <asm/pgtable-types.h>
+
+#define KASAN_SHADOW_SCALE_SHIFT	3
+
+#define KASAN_SHADOW_OFFSET	(KASAN_SHADOW_START - \
+				 (PAGE_OFFSET >> KASAN_SHADOW_SCALE_SHIFT))
+
+#define KASAN_SHADOW_END	(KASAN_SHADOW_START + KASAN_SHADOW_SIZE)
+
+#include <asm/fixmap.h>
+
+#define KASAN_SHADOW_START	(ALIGN_DOWN(FIXADDR_START - KASAN_SHADOW_SIZE, \
+					    PGDIR_SIZE))
+
+#define KASAN_SHADOW_SIZE	((~0UL - PAGE_OFFSET + 1) >> KASAN_SHADOW_SCALE_SHIFT)
+
+void kasan_early_init(void);
+void kasan_init(void);
+
+#endif /* __ASSEMBLY */
 #endif
diff --git a/arch/powerpc/include/asm/nohash/32/pgtable.h b/arch/powerpc/include/asm/nohash/32/pgtable.h
index bed433358260..b3b52f02be1a 100644
--- a/arch/powerpc/include/asm/nohash/32/pgtable.h
+++ b/arch/powerpc/include/asm/nohash/32/pgtable.h
@@ -71,6 +71,8 @@ extern int icache_44x_need_flush;
  */
 #ifdef CONFIG_HIGHMEM
 #define KVIRT_TOP	PKMAP_BASE
+#elif defined(CONFIG_KASAN)
+#define KVIRT_TOP	KASAN_SHADOW_START
 #else
 #define KVIRT_TOP	(0xfe000000UL)	/* for now, could be FIXMAP_BASE ? */
 #endif
diff --git a/arch/powerpc/include/asm/setup.h b/arch/powerpc/include/asm/setup.h
index 65676e2325b8..da7768aa996a 100644
--- a/arch/powerpc/include/asm/setup.h
+++ b/arch/powerpc/include/asm/setup.h
@@ -74,6 +74,11 @@ static inline void setup_spectre_v2(void) {};
 #endif
 void do_btb_flush_fixups(void);
 
+#ifndef CONFIG_KASAN
+static inline void kasan_early_init(void) { }
+static inline void kasan_init(void) { }
+#endif
+
 #endif /* !__ASSEMBLY__ */
 
 #endif	/* _ASM_POWERPC_SETUP_H */
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 879b36602748..fc4c42262694 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -16,8 +16,9 @@ CFLAGS_prom_init.o      += -fPIC
 CFLAGS_btext.o		+= -fPIC
 endif
 
-CFLAGS_cputable.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
-CFLAGS_prom_init.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
+CFLAGS_early_32.o += -DDISABLE_BRANCH_PROFILING
+CFLAGS_cputable.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) -DDISABLE_BRANCH_PROFILING
+CFLAGS_prom_init.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) -DDISABLE_BRANCH_PROFILING
 CFLAGS_btext.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
 CFLAGS_prom.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
 
@@ -31,6 +32,10 @@ CFLAGS_REMOVE_btext.o = $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_prom.o = $(CC_FLAGS_FTRACE)
 endif
 
+KASAN_SANITIZE_early_32.o := n
+KASAN_SANITIZE_cputable.o := n
+KASAN_SANITIZE_prom_init.o := n
+
 obj-y				:= cputable.o ptrace.o syscalls.o \
 				   irq.o align.o signal_32.o pmc.o vdso.o \
 				   process.o systbl.o idle.o \
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 9ffc72ded73a..846fb30b1190 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -783,5 +783,9 @@ int main(void)
 	DEFINE(VIRT_IMMR_BASE, (u64)__fix_to_virt(FIX_IMMR_BASE));
 #endif
 
+#ifdef CONFIG_KASAN
+	DEFINE(KASAN_SHADOW_OFFSET, KASAN_SHADOW_OFFSET);
+#endif
+
 	return 0;
 }
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 05b08db3901d..0ec9dec06bc2 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -962,6 +962,9 @@ start_here:
  * Do early platform-specific initialization,
  * and set up the MMU.
  */
+#ifdef CONFIG_KASAN
+	bl	kasan_early_init
+#endif
 	li	r3,0
 	mr	r4,r31
 	bl	machine_init
diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
index b19d78410511..5d6ff8fa7e2b 100644
--- a/arch/powerpc/kernel/head_40x.S
+++ b/arch/powerpc/kernel/head_40x.S
@@ -848,6 +848,9 @@ start_here:
 /*
  * Decide what sort of machine this is and initialize the MMU.
  */
+#ifdef CONFIG_KASAN
+	bl	kasan_early_init
+#endif
 	li	r3,0
 	mr	r4,r31
 	bl	machine_init
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index bf23c19c92d6..7ca14dff6192 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -203,6 +203,9 @@ _ENTRY(_start);
 /*
  * Decide what sort of machine this is and initialize the MMU.
  */
+#ifdef CONFIG_KASAN
+	bl	kasan_early_init
+#endif
 	li	r3,0
 	mr	r4,r31
 	bl	machine_init
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index fe2857ef0309..88f0cb34cef4 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -823,6 +823,9 @@ start_here:
 /*
  * Decide what sort of machine this is and initialize the MMU.
  */
+#ifdef CONFIG_KASAN
+	bl	kasan_early_init
+#endif
 	li	r3,0
 	mr	r4,r31
 	bl	machine_init
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 2386ce2a9c6e..4f4585a68850 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -274,6 +274,9 @@ set_ivor:
 /*
  * Decide what sort of machine this is and initialize the MMU.
  */
+#ifdef CONFIG_KASAN
+	bl	kasan_early_init
+#endif
 	mr	r3,r30
 	mr	r4,r31
 	bl	machine_init
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index ca00fbb97cf8..16ff1ea66805 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -978,6 +978,8 @@ void __init setup_arch(char **cmdline_p)
 
 	paging_init();
 
+	kasan_init();
+
 	/* Initialize the MMU context management stuff. */
 	mmu_context_init();
 
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index ee08a7e1bcdf..7efbd5122c74 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -8,6 +8,14 @@ ccflags-$(CONFIG_PPC64)	:= $(NO_MINIMAL_TOC)
 CFLAGS_REMOVE_code-patching.o = $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_feature-fixups.o = $(CC_FLAGS_FTRACE)
 
+KASAN_SANITIZE_code-patching.o := n
+KASAN_SANITIZE_feature-fixups.o := n
+
+ifdef CONFIG_KASAN
+CFLAGS_code-patching.o += -DDISABLE_BRANCH_PROFILING
+CFLAGS_feature-fixups.o += -DDISABLE_BRANCH_PROFILING
+endif
+
 obj-y += alloc.o code-patching.o feature-fixups.o
 
 ifndef CONFIG_KASAN
diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
index ee1efa3b3382..292b96ce1efc 100644
--- a/arch/powerpc/mm/Makefile
+++ b/arch/powerpc/mm/Makefile
@@ -47,3 +47,4 @@ obj-$(CONFIG_PPC_COPRO_BASE)	+= copro_fault.o
 obj-$(CONFIG_SPAPR_TCE_IOMMU)	+= mmu_context_iommu.o
 obj-$(CONFIG_PPC_PTDUMP)	+= ptdump/
 obj-$(CONFIG_PPC_MEM_KEYS)	+= pkeys.o
+obj-$(CONFIG_KASAN)		+= kasan/
diff --git a/arch/powerpc/mm/kasan/Makefile b/arch/powerpc/mm/kasan/Makefile
new file mode 100644
index 000000000000..6577897673dd
--- /dev/null
+++ b/arch/powerpc/mm/kasan/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+
+KASAN_SANITIZE := n
+
+obj-$(CONFIG_PPC32)           += kasan_init_32.o
diff --git a/arch/powerpc/mm/kasan/kasan_init_32.c b/arch/powerpc/mm/kasan/kasan_init_32.c
new file mode 100644
index 000000000000..495c908d6ee6
--- /dev/null
+++ b/arch/powerpc/mm/kasan/kasan_init_32.c
@@ -0,0 +1,147 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#define DISABLE_BRANCH_PROFILING
+
+#include <linux/kasan.h>
+#include <linux/printk.h>
+#include <linux/memblock.h>
+#include <linux/sched/task.h>
+#include <linux/vmalloc.h>
+#include <asm/pgalloc.h>
+
+void __init kasan_early_init(void)
+{
+	unsigned long addr = KASAN_SHADOW_START;
+	unsigned long end = KASAN_SHADOW_END;
+	unsigned long next;
+	pmd_t *pmd = pmd_offset(pud_offset(pgd_offset_k(addr), addr), addr);
+	int i;
+	phys_addr_t pa = __pa(kasan_early_shadow_page);
+
+	BUILD_BUG_ON(KASAN_SHADOW_START & ~PGDIR_MASK);
+
+	if (early_mmu_has_feature(MMU_FTR_HPTE_TABLE))
+		panic("KASAN not supported with Hash MMU\n");
+
+	for (i = 0; i < PTRS_PER_PTE; i++)
+		__set_pte_at(&init_mm, (unsigned long)kasan_early_shadow_page,
+			     kasan_early_shadow_pte + i,
+			     pfn_pte(PHYS_PFN(pa), PAGE_KERNEL), 0);
+
+	do {
+		next = pgd_addr_end(addr, end);
+		pmd_populate_kernel(&init_mm, pmd, kasan_early_shadow_pte);
+	} while (pmd++, addr = next, addr != end);
+}
+
+static void __ref *kasan_get_one_page(void)
+{
+	if (slab_is_available())
+		return (void *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
+
+	return memblock_alloc(PAGE_SIZE, PAGE_SIZE);
+}
+
+static int __ref kasan_init_region(void *start, size_t size)
+{
+	void *end = start + size;
+	unsigned long k_start, k_end, k_cur, k_next;
+	pmd_t *pmd;
+	void *block = NULL;
+
+	if (start >= end)
+		return 0;
+
+	k_start = (unsigned long)kasan_mem_to_shadow(start);
+	k_end = (unsigned long)kasan_mem_to_shadow(end);
+	pmd = pmd_offset(pud_offset(pgd_offset_k(k_start), k_start), k_start);
+
+	for (k_cur = k_start; k_cur != k_end; k_cur = k_next, pmd++) {
+		k_next = pgd_addr_end(k_cur, k_end);
+		if ((void *)pmd_page_vaddr(*pmd) == kasan_early_shadow_pte) {
+			pte_t *new = pte_alloc_one_kernel(&init_mm);
+
+			if (!new)
+				return -ENOMEM;
+			memcpy(new, kasan_early_shadow_pte, PTE_TABLE_SIZE);
+			pmd_populate_kernel(&init_mm, pmd, new);
+		}
+	};
+
+	if (!slab_is_available())
+		block = memblock_alloc(k_end - k_start, PAGE_SIZE);
+
+	for (k_cur = k_start; k_cur < k_end; k_cur += PAGE_SIZE) {
+		void *va = block ? block + k_cur - k_start :
+				   kasan_get_one_page();
+		pte_t pte = pfn_pte(PHYS_PFN(__pa(va)), PAGE_KERNEL);
+
+		if (!va)
+			return -ENOMEM;
+
+		pmd = pmd_offset(pud_offset(pgd_offset_k(k_cur), k_cur), k_cur);
+		pte_update(pte_offset_kernel(pmd, k_cur), ~0, pte_val(pte));
+	}
+	flush_tlb_kernel_range(k_start, k_end);
+	return 0;
+}
+
+static void __init kasan_remap_early_shadow_ro(void)
+{
+	unsigned long k_cur;
+	phys_addr_t pa = __pa(kasan_early_shadow_page);
+	int i;
+
+	for (i = 0; i < PTRS_PER_PTE; i++)
+		ptep_set_wrprotect(&init_mm, 0, kasan_early_shadow_pte + i);
+
+	for (k_cur = PAGE_OFFSET & PAGE_MASK; k_cur; k_cur += PAGE_SIZE) {
+		pmd_t *pmd = pmd_offset(pud_offset(pgd_offset_k(k_cur), k_cur), k_cur);
+		pte_t *ptep = pte_offset_kernel(pmd, k_cur);
+
+		if ((void *)pmd_page_vaddr(*pmd) == kasan_early_shadow_pte)
+			continue;
+		if ((pte_val(*ptep) & PAGE_MASK) != pa)
+			continue;
+
+		ptep_set_wrprotect(&init_mm, k_cur, ptep);
+	}
+	flush_tlb_mm(&init_mm);
+}
+
+void __init kasan_init(void)
+{
+	struct memblock_region *reg;
+
+	for_each_memblock(memory, reg) {
+		int ret = kasan_init_region(__va(reg->base), reg->size);
+
+		if (ret)
+			panic("kasan: kasan_init_region() failed");
+	}
+
+	kasan_remap_early_shadow_ro();
+
+	clear_page(kasan_early_shadow_page);
+
+	/* At this point kasan is fully initialized. Enable error messages */
+	init_task.kasan_depth = 0;
+	pr_info("KASAN init done\n");
+}
+
+#ifdef CONFIG_MODULES
+void *module_alloc(unsigned long size)
+{
+	void *base = vmalloc_exec(size);
+
+	if (!base)
+		return NULL;
+
+	if (!kasan_init_region(base, size))
+		return base;
+
+	vfree(base);
+
+	return NULL;
+}
+#endif
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 81f251fc4169..1bb055775e60 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -336,6 +336,10 @@ void __init mem_init(void)
 	pr_info("  * 0x%08lx..0x%08lx  : highmem PTEs\n",
 		PKMAP_BASE, PKMAP_ADDR(LAST_PKMAP));
 #endif /* CONFIG_HIGHMEM */
+#ifdef CONFIG_KASAN
+	pr_info("  * 0x%08lx..0x%08lx  : kasan shadow mem\n",
+		KASAN_SHADOW_START, KASAN_SHADOW_END);
+#endif
 #ifdef CONFIG_NOT_COHERENT_CACHE
 	pr_info("  * 0x%08lx..0x%08lx  : consistent mem\n",
 		IOREMAP_TOP, IOREMAP_TOP + CONFIG_CONSISTENT_SIZE);
diff --git a/arch/powerpc/mm/ptdump/dump_linuxpagetables.c b/arch/powerpc/mm/ptdump/dump_linuxpagetables.c
index b0da447197d4..4a03910974e2 100644
--- a/arch/powerpc/mm/ptdump/dump_linuxpagetables.c
+++ b/arch/powerpc/mm/ptdump/dump_linuxpagetables.c
@@ -94,6 +94,10 @@ static struct addr_marker address_markers[] = {
 	{ 0,	"Consistent mem start" },
 	{ 0,	"Consistent mem end" },
 #endif
+#ifdef CONFIG_KASAN
+	{ 0,	"kasan shadow mem start" },
+	{ 0,	"kasan shadow mem end" },
+#endif
 #ifdef CONFIG_HIGHMEM
 	{ 0,	"Highmem PTEs start" },
 	{ 0,	"Highmem PTEs end" },
@@ -316,6 +320,10 @@ static void populate_markers(void)
 	address_markers[i++].start_address = IOREMAP_TOP +
 					     CONFIG_CONSISTENT_SIZE;
 #endif
+#ifdef CONFIG_KASAN
+	address_markers[i++].start_address = KASAN_SHADOW_START;
+	address_markers[i++].start_address = KASAN_SHADOW_END;
+#endif
 #ifdef CONFIG_HIGHMEM
 	address_markers[i++].start_address = PKMAP_BASE;
 	address_markers[i++].start_address = PKMAP_ADDR(LAST_PKMAP);
diff --git a/arch/powerpc/purgatory/Makefile b/arch/powerpc/purgatory/Makefile
index 4314ba5baf43..7c6d8b14f440 100644
--- a/arch/powerpc/purgatory/Makefile
+++ b/arch/powerpc/purgatory/Makefile
@@ -1,4 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
+
+KASAN_SANITIZE := n
+
 targets += trampoline.o purgatory.ro kexec-purgatory.c
 
 LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined
diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile
index 878f9c1d3615..064f7062c0a3 100644
--- a/arch/powerpc/xmon/Makefile
+++ b/arch/powerpc/xmon/Makefile
@@ -6,6 +6,7 @@ subdir-ccflags-y := $(call cc-disable-warning, builtin-requires-header)
 
 GCOV_PROFILE := n
 UBSAN_SANITIZE := n
+KASAN_SANITIZE := n
 
 # Disable ftrace for the entire directory
 ORIG_CFLAGS := $(KBUILD_CFLAGS)
-- 
2.13.3


^ permalink raw reply related

* [PATCH v6 5/6] kasan: allow architectures to provide an outline readiness check
From: Christophe Leroy @ 2019-02-19 17:23 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Nicholas Piggin, Aneesh Kumar K.V, Andrey Ryabinin,
	Alexander Potapenko, Dmitry Vyukov, Daniel Axtens
  Cc: linux-mm, linuxppc-dev, linux-kernel, kasan-dev
In-Reply-To: <cover.1550596242.git.christophe.leroy@c-s.fr>

From: Daniel Axtens <dja@axtens.net>

In powerpc (as I understand it), we spend a lot of time in boot
running in real mode before MMU paging is initalised. During
this time we call a lot of generic code, including printk(). If
we try to access the shadow region during this time, things fail.

My attempts to move early init before the first printk have not
been successful. (Both previous RFCs for ppc64 - by 2 different
people - have needed this trick too!)

So, allow architectures to define a kasan_arch_is_ready()
hook that bails out of check_memory_region_inline() unless the
arch has done all of the init.

Link: https://lore.kernel.org/patchwork/patch/592820/ # ppc64 hash series
Link: https://patchwork.ozlabs.org/patch/795211/      # ppc radix series
Originally-by: Balbir Singh <bsingharora@gmail.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Daniel Axtens <dja@axtens.net>
[check_return_arch_not_ready() ==> static inline kasan_arch_is_ready()]
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 include/linux/kasan.h | 4 ++++
 mm/kasan/generic.c    | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index b40ea104dd36..b91c40af9f31 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -14,6 +14,10 @@ struct task_struct;
 #include <asm/kasan.h>
 #include <asm/pgtable.h>
 
+#ifndef kasan_arch_is_ready
+static inline bool kasan_arch_is_ready(void)	{ return true; }
+#endif
+
 extern unsigned char kasan_early_shadow_page[PAGE_SIZE];
 extern pte_t kasan_early_shadow_pte[PTRS_PER_PTE];
 extern pmd_t kasan_early_shadow_pmd[PTRS_PER_PMD];
diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c
index ccb6207276e3..696c2f5b902b 100644
--- a/mm/kasan/generic.c
+++ b/mm/kasan/generic.c
@@ -170,6 +170,9 @@ static __always_inline void check_memory_region_inline(unsigned long addr,
 						size_t size, bool write,
 						unsigned long ret_ip)
 {
+	if (!kasan_arch_is_ready())
+		return;
+
 	if (unlikely(size == 0))
 		return;
 
-- 
2.13.3


^ permalink raw reply related

* [PATCH v6 6/6] powerpc/32: enable CONFIG_KASAN for book3s hash
From: Christophe Leroy @ 2019-02-19 17:23 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Nicholas Piggin, Aneesh Kumar K.V, Andrey Ryabinin,
	Alexander Potapenko, Dmitry Vyukov, Daniel Axtens
  Cc: linux-mm, linuxppc-dev, linux-kernel, kasan-dev
In-Reply-To: <cover.1550596242.git.christophe.leroy@c-s.fr>

The challenge with book3s/32 is that the hash table management
has to be set up before being able to use KASAN.

This patch adds a kasan_arch_is_ready() helper to defer
the activation of KASAN until paging is ready.

This limits KASAN to KASAN_MINIMAL mode. The downside of it
is that the 603, which doesn't use hash table, also gets
downgraded to KASAN_MINIMAL because this is no way to
activate full support dynamically because that's compiled-in.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/Makefile                 |  2 ++
 arch/powerpc/include/asm/kasan.h      | 13 +++++++++++++
 arch/powerpc/mm/kasan/kasan_init_32.c | 27 +++++++++++++++++++++++++--
 3 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index f0738099e31e..06d085558d21 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -428,11 +428,13 @@ endif
 endif
 
 ifdef CONFIG_KASAN
+ifndef CONFIG_PPC_BOOK3S_32
 prepare: kasan_prepare
 
 kasan_prepare: prepare0
        $(eval KASAN_SHADOW_OFFSET = $(shell awk '{if ($$2 == "KASAN_SHADOW_OFFSET") print $$3;}' include/generated/asm-offsets.h))
 endif
+endif
 
 # Check toolchain versions:
 # - gcc-4.6 is the minimum kernel-wide version so nothing required.
diff --git a/arch/powerpc/include/asm/kasan.h b/arch/powerpc/include/asm/kasan.h
index 0bc9148f5d87..97b5ccf0702f 100644
--- a/arch/powerpc/include/asm/kasan.h
+++ b/arch/powerpc/include/asm/kasan.h
@@ -16,6 +16,7 @@
 
 #include <asm/page.h>
 #include <asm/pgtable-types.h>
+#include <linux/jump_label.h>
 
 #define KASAN_SHADOW_SCALE_SHIFT	3
 
@@ -34,5 +35,17 @@
 void kasan_early_init(void);
 void kasan_init(void);
 
+extern struct static_key_false powerpc_kasan_enabled_key;
+
+static inline bool kasan_arch_is_ready(void)
+{
+	if (!IS_ENABLED(CONFIG_BOOK3S_32))
+		return true;
+	if (static_branch_likely(&powerpc_kasan_enabled_key))
+		return true;
+	return false;
+}
+#define kasan_arch_is_ready kasan_arch_is_ready
+
 #endif /* __ASSEMBLY */
 #endif
diff --git a/arch/powerpc/mm/kasan/kasan_init_32.c b/arch/powerpc/mm/kasan/kasan_init_32.c
index 495c908d6ee6..f24f8f56d450 100644
--- a/arch/powerpc/mm/kasan/kasan_init_32.c
+++ b/arch/powerpc/mm/kasan/kasan_init_32.c
@@ -9,6 +9,9 @@
 #include <linux/vmalloc.h>
 #include <asm/pgalloc.h>
 
+/* Used by BOOK3S_32 only */
+DEFINE_STATIC_KEY_FALSE(powerpc_kasan_enabled_key);
+
 void __init kasan_early_init(void)
 {
 	unsigned long addr = KASAN_SHADOW_START;
@@ -21,7 +24,7 @@ void __init kasan_early_init(void)
 	BUILD_BUG_ON(KASAN_SHADOW_START & ~PGDIR_MASK);
 
 	if (early_mmu_has_feature(MMU_FTR_HPTE_TABLE))
-		panic("KASAN not supported with Hash MMU\n");
+		return;
 
 	for (i = 0; i < PTRS_PER_PTE; i++)
 		__set_pte_at(&init_mm, (unsigned long)kasan_early_shadow_page,
@@ -32,6 +35,22 @@ void __init kasan_early_init(void)
 		next = pgd_addr_end(addr, end);
 		pmd_populate_kernel(&init_mm, pmd, kasan_early_shadow_pte);
 	} while (pmd++, addr = next, addr != end);
+
+	if (IS_ENABLED(CONFIG_PPC_BOOK3S_32)) {
+		jump_label_init();
+		static_branch_enable(&powerpc_kasan_enabled_key);
+	}
+}
+
+static void __init kasan_late_init(void)
+{
+	unsigned long addr;
+	phys_addr_t pa = __pa(kasan_early_shadow_page);
+
+	for (addr = KASAN_SHADOW_START; addr < KASAN_SHADOW_END; addr += PAGE_SIZE)
+		map_kernel_page(addr, pa, PAGE_KERNEL_RO);
+
+	static_branch_enable(&powerpc_kasan_enabled_key);
 }
 
 static void __ref *kasan_get_one_page(void)
@@ -113,6 +132,9 @@ void __init kasan_init(void)
 {
 	struct memblock_region *reg;
 
+	if (early_mmu_has_feature(MMU_FTR_HPTE_TABLE))
+		kasan_late_init();
+
 	for_each_memblock(memory, reg) {
 		int ret = kasan_init_region(__va(reg->base), reg->size);
 
@@ -120,7 +142,8 @@ void __init kasan_init(void)
 			panic("kasan: kasan_init_region() failed");
 	}
 
-	kasan_remap_early_shadow_ro();
+	if (!early_mmu_has_feature(MMU_FTR_HPTE_TABLE))
+		kasan_remap_early_shadow_ro();
 
 	clear_page(kasan_early_shadow_page);
 
-- 
2.13.3


^ permalink raw reply related

* [RFC WIP PATCH 1/3] kasan: do not open-code addr_has_shadow
From: Christophe Leroy @ 2019-02-19 17:29 UTC (permalink / raw)
  To: Daniel Axtens; +Cc: linuxppc-dev
In-Reply-To: <cover.1550597162.git.christophe.leroy@c-s.fr>

From: Daniel Axtens <dja@axtens.net>

We have a couple of places checking for the existence of a shadow
mapping for an address by open-coding the inverse of the check in
addr_has_shadow.

Replace the open-coded versions with the helper. This will be
needed in future to allow architectures to override the layout
of the shadow mapping.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
---
 mm/kasan/generic.c | 3 +--
 mm/kasan/tags.c    | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c
index 696c2f5b902b..08cbc7ed8953 100644
--- a/mm/kasan/generic.c
+++ b/mm/kasan/generic.c
@@ -176,8 +176,7 @@ static __always_inline void check_memory_region_inline(unsigned long addr,
 	if (unlikely(size == 0))
 		return;
 
-	if (unlikely((void *)addr <
-		kasan_shadow_to_mem((void *)KASAN_SHADOW_START))) {
+	if (unlikely(!addr_has_shadow((void *)addr))) {
 		kasan_report(addr, size, write, ret_ip);
 		return;
 	}
diff --git a/mm/kasan/tags.c b/mm/kasan/tags.c
index 0777649e07c4..bc759f8f1c67 100644
--- a/mm/kasan/tags.c
+++ b/mm/kasan/tags.c
@@ -109,8 +109,7 @@ void check_memory_region(unsigned long addr, size_t size, bool write,
 		return;
 
 	untagged_addr = reset_tag((const void *)addr);
-	if (unlikely(untagged_addr <
-			kasan_shadow_to_mem((void *)KASAN_SHADOW_START))) {
+	if (unlikely(!addr_has_shadow(untagged_addr))) {
 		kasan_report(addr, size, write, ret_ip);
 		return;
 	}
-- 
2.13.3


^ permalink raw reply related

* [RFC WIP PATCH 0/3] Your series rebased
From: Christophe Leroy @ 2019-02-19 17:29 UTC (permalink / raw)
  To: Daniel Axtens; +Cc: linuxppc-dev

Hi Daniel,

Find here your series rebased on my v6. No test done, not even compiled.

Christophe

Christophe Leroy (3):
  kasan: do not open-code addr_has_shadow
  kasan: allow architectures to manage the memory-to-shadow mapping
  powerpc: KASAN for 64bit Book3E

 arch/powerpc/Kconfig                         |  1 +
 arch/powerpc/Makefile                        |  2 +
 arch/powerpc/include/asm/kasan.h             | 56 +++++++++++++++++++++++++++-
 arch/powerpc/mm/Makefile                     |  2 +
 arch/powerpc/mm/kasan/Makefile               |  1 +
 arch/powerpc/mm/kasan/kasan_init_book3e_64.c | 51 +++++++++++++++++++++++++
 include/linux/kasan.h                        |  2 +
 mm/kasan/generic.c                           |  3 +-
 mm/kasan/generic_report.c                    |  2 +-
 mm/kasan/kasan.h                             |  6 ++-
 mm/kasan/report.c                            |  6 +--
 mm/kasan/tags.c                              |  3 +-
 12 files changed, 125 insertions(+), 10 deletions(-)
 create mode 100644 arch/powerpc/mm/kasan/kasan_init_book3e_64.c

-- 
2.13.3


^ permalink raw reply

* [RFC WIP PATCH 2/3] kasan: allow architectures to manage the memory-to-shadow mapping
From: Christophe Leroy @ 2019-02-19 17:29 UTC (permalink / raw)
  To: Daniel Axtens; +Cc: linuxppc-dev
In-Reply-To: <cover.1550597162.git.christophe.leroy@c-s.fr>

From: Daniel Axtens <dja@axtens.net>

Currently, shadow addresses are always addr >> shift + offset.
However, for powerpc, the virtual address space is fragmented in
ways that make this simple scheme impractical.

Allow architectures to override:
 - kasan_shadow_to_mem
 - kasan_mem_to_shadow
 - addr_has_shadow

Rename addr_has_shadow to kasan_addr_has_shadow as if it is
overridden it will be available in more places, increasing the
risk of collisions.

If architectures do not #define their own versions, the generic
code will continue to run as usual.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
---
 include/linux/kasan.h     | 2 ++
 mm/kasan/generic.c        | 2 +-
 mm/kasan/generic_report.c | 2 +-
 mm/kasan/kasan.h          | 6 +++++-
 mm/kasan/report.c         | 6 +++---
 mm/kasan/tags.c           | 2 +-
 6 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index b91c40af9f31..a630d53f1a36 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -27,11 +27,13 @@ extern p4d_t kasan_early_shadow_p4d[MAX_PTRS_PER_P4D];
 int kasan_populate_early_shadow(const void *shadow_start,
 				const void *shadow_end);
 
+#ifndef kasan_mem_to_shadow
 static inline void *kasan_mem_to_shadow(const void *addr)
 {
 	return (void *)((unsigned long)addr >> KASAN_SHADOW_SCALE_SHIFT)
 		+ KASAN_SHADOW_OFFSET;
 }
+#endif
 
 /* Enable reporting bugs after kasan_disable_current() */
 extern void kasan_enable_current(void);
diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c
index 08cbc7ed8953..6c6c30643d51 100644
--- a/mm/kasan/generic.c
+++ b/mm/kasan/generic.c
@@ -176,7 +176,7 @@ static __always_inline void check_memory_region_inline(unsigned long addr,
 	if (unlikely(size == 0))
 		return;
 
-	if (unlikely(!addr_has_shadow((void *)addr))) {
+	if (unlikely(!kasan_addr_has_shadow((void *)addr))) {
 		kasan_report(addr, size, write, ret_ip);
 		return;
 	}
diff --git a/mm/kasan/generic_report.c b/mm/kasan/generic_report.c
index 5e12035888f2..854f4de1fe10 100644
--- a/mm/kasan/generic_report.c
+++ b/mm/kasan/generic_report.c
@@ -110,7 +110,7 @@ static const char *get_wild_bug_type(struct kasan_access_info *info)
 
 const char *get_bug_type(struct kasan_access_info *info)
 {
-	if (addr_has_shadow(info->access_addr))
+	if (kasan_addr_has_shadow(info->access_addr))
 		return get_shadow_bug_type(info);
 	return get_wild_bug_type(info);
 }
diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
index ea51b2d898ec..57ec24cf7bd1 100644
--- a/mm/kasan/kasan.h
+++ b/mm/kasan/kasan.h
@@ -111,16 +111,20 @@ struct kasan_alloc_meta *get_alloc_info(struct kmem_cache *cache,
 struct kasan_free_meta *get_free_info(struct kmem_cache *cache,
 					const void *object);
 
+#ifndef kasan_shadow_to_mem
 static inline const void *kasan_shadow_to_mem(const void *shadow_addr)
 {
 	return (void *)(((unsigned long)shadow_addr - KASAN_SHADOW_OFFSET)
 		<< KASAN_SHADOW_SCALE_SHIFT);
 }
+#endif
 
-static inline bool addr_has_shadow(const void *addr)
+#ifndef kasan_addr_has_shadow
+static inline bool kasan_addr_has_shadow(const void *addr)
 {
 	return (addr >= kasan_shadow_to_mem((void *)KASAN_SHADOW_START));
 }
+#endif
 
 void kasan_poison_shadow(const void *address, size_t size, u8 value);
 
diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index ca9418fe9232..bc3355ee2dd0 100644
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -298,7 +298,7 @@ void kasan_report(unsigned long addr, size_t size,
 	untagged_addr = reset_tag(tagged_addr);
 
 	info.access_addr = tagged_addr;
-	if (addr_has_shadow(untagged_addr))
+	if (kasan_addr_has_shadow(untagged_addr))
 		info.first_bad_addr = find_first_bad_addr(tagged_addr, size);
 	else
 		info.first_bad_addr = untagged_addr;
@@ -309,11 +309,11 @@ void kasan_report(unsigned long addr, size_t size,
 	start_report(&flags);
 
 	print_error_description(&info);
-	if (addr_has_shadow(untagged_addr))
+	if (kasan_addr_has_shadow(untagged_addr))
 		print_tags(get_tag(tagged_addr), info.first_bad_addr);
 	pr_err("\n");
 
-	if (addr_has_shadow(untagged_addr)) {
+	if (kasan_addr_has_shadow(untagged_addr)) {
 		print_address_description(untagged_addr);
 		pr_err("\n");
 		print_shadow_for_address(info.first_bad_addr);
diff --git a/mm/kasan/tags.c b/mm/kasan/tags.c
index bc759f8f1c67..cdefd0fe1f5d 100644
--- a/mm/kasan/tags.c
+++ b/mm/kasan/tags.c
@@ -109,7 +109,7 @@ void check_memory_region(unsigned long addr, size_t size, bool write,
 		return;
 
 	untagged_addr = reset_tag((const void *)addr);
-	if (unlikely(!addr_has_shadow(untagged_addr))) {
+	if (unlikely(!kasan_addr_has_shadow(untagged_addr))) {
 		kasan_report(addr, size, write, ret_ip);
 		return;
 	}
-- 
2.13.3


^ permalink raw reply related

* [RFC WIP PATCH 3/3] powerpc: KASAN for 64bit Book3E
From: Christophe Leroy @ 2019-02-19 17:29 UTC (permalink / raw)
  To: Daniel Axtens; +Cc: linuxppc-dev
In-Reply-To: <cover.1550597162.git.christophe.leroy@c-s.fr>

From: Daniel Axtens <dja@axtens.net>

Wire up KASAN. Only outline instrumentation is supported.

The KASAN shadow area is mapped into vmemmap space:
0x8000 0400 0000 0000 to 0x8000 0600 0000 0000.
To do this we require that vmemmap be disabled. (This is the default
in the kernel config that QorIQ provides for the machine in their
SDK anyway - they use flat memory.)

Only the kernel linear mapping (0xc000...) is checked. The vmalloc and
ioremap areas (also in 0x800...) are all mapped to a zero page. As
with the Book3S hash series, this requires overriding the memory <->
shadow mapping.

Also, as with both previous 64-bit series, early instrumentation is not
supported.  It would allow us to drop the kasan_arch_is_ready()
hook in the KASAN core, but it's tricky to get it set up early enough:
we need it setup before the first call to instrumented code like printk().
Perhaps in the future.

Only KASAN_MINIMAL works.

Lightly tested on e6500. KVM, kexec and xmon have not been tested.

The test_kasan module fires warnings as expected, except for the
following tests:

 - Expected/by design:
kasan test: memcg_accounted_kmem_cache allocate memcg accounted object

 - Due to only supporting KASAN_MINIMAL:
kasan test: kasan_stack_oob out-of-bounds on stack
kasan test: kasan_global_oob out-of-bounds global variable
kasan test: kasan_alloca_oob_left out-of-bounds to left on alloca
kasan test: kasan_alloca_oob_right out-of-bounds to right on alloca
kasan test: use_after_scope_test use-after-scope on int
kasan test: use_after_scope_test use-after-scope on array

Thanks to those who have done the heavy lifting over the past several years:
 - Christophe's 32 bit series: https://lists.ozlabs.org/pipermail/linuxppc-dev/2019-February/185379.html
 - Aneesh's Book3S hash series: https://lwn.net/Articles/655642/
 - Balbir's Book3S radix series: https://patchwork.ozlabs.org/patch/795211/

Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 arch/powerpc/Kconfig                         |  1 +
 arch/powerpc/Makefile                        |  2 +
 arch/powerpc/include/asm/kasan.h             | 56 +++++++++++++++++++++++++++-
 arch/powerpc/mm/Makefile                     |  2 +
 arch/powerpc/mm/kasan/Makefile               |  1 +
 arch/powerpc/mm/kasan/kasan_init_book3e_64.c | 51 +++++++++++++++++++++++++
 6 files changed, 112 insertions(+), 1 deletion(-)
 create mode 100644 arch/powerpc/mm/kasan/kasan_init_book3e_64.c

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 850b06def84f..2c7c20d52778 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -176,6 +176,7 @@ config PPC
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_ARCH_JUMP_LABEL
 	select HAVE_ARCH_KASAN			if PPC32
+	select HAVE_ARCH_KASAN			if PPC_BOOK3E_64 && !SPARSEMEM_VMEMMAP
 	select HAVE_ARCH_KGDB
 	select HAVE_ARCH_MMAP_RND_BITS
 	select HAVE_ARCH_MMAP_RND_COMPAT_BITS	if COMPAT
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 06d085558d21..d1943d892db2 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -428,6 +428,7 @@ endif
 endif
 
 ifdef CONFIG_KASAN
+ifdef CONFIG_PPC32
 ifndef CONFIG_PPC_BOOK3S_32
 prepare: kasan_prepare
 
@@ -435,6 +436,7 @@ kasan_prepare: prepare0
        $(eval KASAN_SHADOW_OFFSET = $(shell awk '{if ($$2 == "KASAN_SHADOW_OFFSET") print $$3;}' include/generated/asm-offsets.h))
 endif
 endif
+endif
 
 # Check toolchain versions:
 # - gcc-4.6 is the minimum kernel-wide version so nothing required.
diff --git a/arch/powerpc/include/asm/kasan.h b/arch/powerpc/include/asm/kasan.h
index 97b5ccf0702f..6b2cd5ade185 100644
--- a/arch/powerpc/include/asm/kasan.h
+++ b/arch/powerpc/include/asm/kasan.h
@@ -15,6 +15,7 @@
 #ifndef __ASSEMBLY__
 
 #include <asm/page.h>
+#include <asm/pgtable.h>
 #include <asm/pgtable-types.h>
 #include <linux/jump_label.h>
 
@@ -25,6 +26,7 @@
 
 #define KASAN_SHADOW_END	(KASAN_SHADOW_START + KASAN_SHADOW_SIZE)
 
+#ifdef CONFIG_PPC32
 #include <asm/fixmap.h>
 
 #define KASAN_SHADOW_START	(ALIGN_DOWN(FIXADDR_START - KASAN_SHADOW_SIZE, \
@@ -33,13 +35,15 @@
 #define KASAN_SHADOW_SIZE	((~0UL - PAGE_OFFSET + 1) >> KASAN_SHADOW_SCALE_SHIFT)
 
 void kasan_early_init(void);
+#endif /* CONFIG_PPC32 */
+
 void kasan_init(void);
 
 extern struct static_key_false powerpc_kasan_enabled_key;
 
 static inline bool kasan_arch_is_ready(void)
 {
-	if (!IS_ENABLED(CONFIG_BOOK3S_32))
+	if (IS_ENABLED(CONFIG_PPC_32) && !IS_ENABLED(CONFIG_BOOK3S_32))
 		return true;
 	if (static_branch_likely(&powerpc_kasan_enabled_key))
 		return true;
@@ -47,5 +51,55 @@ static inline bool kasan_arch_is_ready(void)
 }
 #define kasan_arch_is_ready kasan_arch_is_ready
 
+#ifdef CONFIG_PPC_BOOK3E_64
+#define KASAN_SHADOW_START VMEMMAP_BASE
+#define KASAN_SHADOW_SIZE	(KERN_VIRT_SIZE >> KASAN_SHADOW_SCALE_SHIFT)
+
+static inline void *kasan_mem_to_shadow_book3e(const void *addr)
+{
+	if ((unsigned long)addr >= KERN_VIRT_START &&
+		(unsigned long)addr < (KERN_VIRT_START + KERN_VIRT_SIZE)) {
+		return (void *)kasan_early_shadow_page;
+	}
+
+	return (void *)((unsigned long)addr >> KASAN_SHADOW_SCALE_SHIFT)
+		+ KASAN_SHADOW_OFFSET;
+}
+#define kasan_mem_to_shadow kasan_mem_to_shadow_book3e
+
+static inline void *kasan_shadow_to_mem_book3e(const void *shadow_addr)
+{
+	/*
+	 * We map the entire non-linear virtual mapping onto the zero page so if
+	 * we are asked to map the zero page back just pick the beginning of that
+	 * area.
+	 */
+	if (shadow_addr >= (void *)kasan_early_shadow_page &&
+		shadow_addr < (void *)(kasan_early_shadow_page + PAGE_SIZE)) {
+		return (void *)KERN_VIRT_START;
+	}
+
+	return (void *)(((unsigned long)shadow_addr - KASAN_SHADOW_OFFSET)
+		<< KASAN_SHADOW_SCALE_SHIFT);
+}
+#define kasan_shadow_to_mem kasan_shadow_to_mem_book3e
+
+static inline bool kasan_addr_has_shadow_book3e(const void *addr)
+{
+	/*
+	 * We want to specifically assert that the addresses in the 0x8000...
+	 * region have a shadow, otherwise they are considered by the kasan
+	 * core to be wild pointers
+	 */
+	if ((unsigned long)addr >= KERN_VIRT_START &&
+		(unsigned long)addr < (KERN_VIRT_START + KERN_VIRT_SIZE)) {
+		return true;
+	}
+	return (addr >= kasan_shadow_to_mem((void *)KASAN_SHADOW_START));
+}
+#define kasan_addr_has_shadow kasan_addr_has_shadow_book3e
+
+#endif /* CONFIG_PPC_BOOK3E_64 */
+
 #endif /* __ASSEMBLY */
 #endif
diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
index 292b96ce1efc..ab2ed80d224d 100644
--- a/arch/powerpc/mm/Makefile
+++ b/arch/powerpc/mm/Makefile
@@ -7,6 +7,8 @@ ccflags-$(CONFIG_PPC64)	:= $(NO_MINIMAL_TOC)
 
 CFLAGS_REMOVE_slb.o = $(CC_FLAGS_FTRACE)
 
+KASAN_SANITIZE_fsl_booke_mmu.o := n
+
 obj-y				:= fault.o mem.o pgtable.o mmap.o \
 				   init_$(BITS).o pgtable_$(BITS).o \
 				   init-common.o mmu_context.o drmem.o
diff --git a/arch/powerpc/mm/kasan/Makefile b/arch/powerpc/mm/kasan/Makefile
index 6577897673dd..f8f164ad8ade 100644
--- a/arch/powerpc/mm/kasan/Makefile
+++ b/arch/powerpc/mm/kasan/Makefile
@@ -3,3 +3,4 @@
 KASAN_SANITIZE := n
 
 obj-$(CONFIG_PPC32)           += kasan_init_32.o
+obj-$(CONFIG_PPC_BOOK3E_64)   += kasan_init_book3e_64.o
diff --git a/arch/powerpc/mm/kasan/kasan_init_book3e_64.c b/arch/powerpc/mm/kasan/kasan_init_book3e_64.c
new file mode 100644
index 000000000000..b37fceebcc3b
--- /dev/null
+++ b/arch/powerpc/mm/kasan/kasan_init_book3e_64.c
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#define DISABLE_BRANCH_PROFILING
+
+#include <linux/kasan.h>
+#include <linux/printk.h>
+#include <linux/memblock.h>
+#include <linux/sched/task.h>
+#include <asm/pgalloc.h>
+
+DEFINE_STATIC_KEY_FALSE(powerpc_kasan_enabled_key);
+EXPORT_SYMBOL(powerpc_kasan_enabled_key);
+
+static void __init kasan_init_region(struct memblock_region *reg)
+{
+	void *start = __va(reg->base);
+	void *end = __va(reg->base + reg->size);
+	unsigned long k_start, k_end, k_cur;
+
+	if (start >= end)
+		return;
+
+	k_start = (unsigned long)kasan_mem_to_shadow(start);
+	k_end = (unsigned long)kasan_mem_to_shadow(end);
+
+	for (k_cur = k_start; k_cur < k_end; k_cur += PAGE_SIZE) {
+		void *va = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
+
+		map_kernel_page(k_cur, __pa(va), PAGE_KERNEL);
+	}
+	flush_tlb_kernel_range(k_start, k_end);
+}
+
+void __init kasan_init(void)
+{
+	struct memblock_region *reg;
+
+	for_each_memblock(memory, reg)
+		kasan_init_region(reg);
+
+	/* map the zero page RO */
+	map_kernel_page((unsigned long)kasan_early_shadow_page,
+			__pa(kasan_early_shadow_page), PAGE_KERNEL_RO);
+
+	/* Turn on checking */
+	static_branch_inc(&powerpc_kasan_enabled_key);
+
+	/* Enable error messages */
+	init_task.kasan_depth = 0;
+	pr_info("KASAN init done (64-bit Book3E)\n");
+}
-- 
2.13.3


^ permalink raw reply related

* Re: [PATCH v5 3/3] powerpc/32: Add KASAN support
From: Christophe Leroy @ 2019-02-19 18:03 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Nicholas Piggin, Aneesh Kumar K.V, Andrey Ryabinin,
	Alexander Potapenko, Dmitry Vyukov, Daniel Axtens
  Cc: linux-mm, linuxppc-dev, linux-kernel, kasan-dev
In-Reply-To: <87a7itqwdo.fsf@concordia.ellerman.id.au>



Le 18/02/2019 à 10:27, Michael Ellerman a écrit :
> Christophe Leroy <christophe.leroy@c-s.fr> writes:
> 
>> diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
>> index e0637730a8e7..dba2c1038363 100644
>> --- a/arch/powerpc/include/asm/ppc_asm.h
>> +++ b/arch/powerpc/include/asm/ppc_asm.h
>> @@ -251,6 +251,10 @@ GLUE(.,name):
>>   
>>   #define _GLOBAL_TOC(name) _GLOBAL(name)
>>   
>> +#define KASAN_OVERRIDE(x, y) \
>> +	.weak x;	     \
>> +	.set x, y
>> +
> 
> Can you add a comment describing what that does and why?

It's gone. Hope the new approach is more clear. It's now in a dedicated 
patch.

> 
>> diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
>> index 879b36602748..fc4c42262694 100644
>> --- a/arch/powerpc/kernel/Makefile
>> +++ b/arch/powerpc/kernel/Makefile
>> @@ -16,8 +16,9 @@ CFLAGS_prom_init.o      += -fPIC
>>   CFLAGS_btext.o		+= -fPIC
>>   endif
>>   
>> -CFLAGS_cputable.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
>> -CFLAGS_prom_init.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
>> +CFLAGS_early_32.o += -DDISABLE_BRANCH_PROFILING
>> +CFLAGS_cputable.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) -DDISABLE_BRANCH_PROFILING
>> +CFLAGS_prom_init.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) -DDISABLE_BRANCH_PROFILING
> 
> Why do we need to disable branch profiling now?

Recommended by Andrey, see https://patchwork.ozlabs.org/patch/1023887/

Maybe it should be only when KASAN is active ? For prom_init it should 
probably be all the time, for the others I don't know. Can't remember 
why I did it that way.

> 
> I'd probably be happier if all the CFLAGS changes were done in a leadup
> patch to make them more obvious.

Oops, I forgot to read your mail entirely before sending out v6. Indeed 
I only read first part. Anyway, that's probably not the last run.

> 
>> diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
>> index 667df97d2595..da6bb16e0876 100644
>> --- a/arch/powerpc/kernel/prom_init_check.sh
>> +++ b/arch/powerpc/kernel/prom_init_check.sh
>> @@ -16,8 +16,16 @@
>>   # If you really need to reference something from prom_init.o add
>>   # it to the list below:
>>   
>> +grep CONFIG_KASAN=y .config >/dev/null
> 
> Just to be safe "^CONFIG_KASAN=y$" ?

ok

> 
>> +if [ $? -eq 0 ]
>> +then
>> +	MEMFCT="__memcpy __memset"
>> +else
>> +	MEMFCT="memcpy memset"
>> +fi
> 
> MEM_FUNCS ?

Yes, I change it now before I forget.

> 
>> diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
>> index 3bf9fc6fd36c..ce8d4a9f810a 100644
>> --- a/arch/powerpc/lib/Makefile
>> +++ b/arch/powerpc/lib/Makefile
>> @@ -8,6 +8,14 @@ ccflags-$(CONFIG_PPC64)	:= $(NO_MINIMAL_TOC)
>>   CFLAGS_REMOVE_code-patching.o = $(CC_FLAGS_FTRACE)
>>   CFLAGS_REMOVE_feature-fixups.o = $(CC_FLAGS_FTRACE)
>>   
>> +KASAN_SANITIZE_code-patching.o := n
>> +KASAN_SANITIZE_feature-fixups.o := n
>> +
>> +ifdef CONFIG_KASAN
>> +CFLAGS_code-patching.o += -DDISABLE_BRANCH_PROFILING
>> +CFLAGS_feature-fixups.o += -DDISABLE_BRANCH_PROFILING
>> +endif
> 
> There's that branch profiling again, though here it's only if KASAN is enabled.
> 
>> diff --git a/arch/powerpc/mm/kasan_init.c b/arch/powerpc/mm/kasan_init.c
>> new file mode 100644
>> index 000000000000..bd8e0a263e12
>> --- /dev/null
>> +++ b/arch/powerpc/mm/kasan_init.c
>> @@ -0,0 +1,114 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +
>> +#define DISABLE_BRANCH_PROFILING
>> +
>> +#include <linux/kasan.h>
>> +#include <linux/printk.h>
>> +#include <linux/memblock.h>
>> +#include <linux/sched/task.h>
>> +#include <asm/pgalloc.h>
>> +
>> +void __init kasan_early_init(void)
>> +{
>> +	unsigned long addr = KASAN_SHADOW_START;
>> +	unsigned long end = KASAN_SHADOW_END;
>> +	unsigned long next;
>> +	pmd_t *pmd = pmd_offset(pud_offset(pgd_offset_k(addr), addr), addr);
> 
> Can none of those fail?

map_kernel_page() in pgtable_32.c does exactly the same.

pud_offset() and pmd_offset() are no-ops and only serve as type 
modifiers, so pmd will get the value returned by pgd_offset_k() which 
should always be valid unless init_mm->pgd is bad.

Christophe

> 
> 
> cheers
> 

^ permalink raw reply

* Re: [PATCH] ASoC: fsl_spdif: fix TXCLK_DF mask
From: Nicolin Chen @ 2019-02-19 18:56 UTC (permalink / raw)
  To: Viorel Suman
  Cc: alsa-devel@alsa-project.org, Timur Tabi, Xiubo Li,
	linuxppc-dev@lists.ozlabs.org, Takashi Iwai, Liam Girdwood,
	Jaroslav Kysela, Viorel Suman, Mark Brown, dl-linux-imx,
	Fabio Estevam, linux-kernel@vger.kernel.org
In-Reply-To: <1550499117-11801-1-git-send-email-viorel.suman@nxp.com>

On Mon, Feb 18, 2019 at 02:12:17PM +0000, Viorel Suman wrote:
> According to RM SPDIF TXCLK_DF mask is 7-bit wide.
> 
> Signed-off-by: Viorel Suman <viorel.suman@nxp.com>

Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>

> ---
>  sound/soc/fsl/fsl_spdif.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/fsl/fsl_spdif.h b/sound/soc/fsl/fsl_spdif.h
> index 7666dab..e6c61e0 100644
> --- a/sound/soc/fsl/fsl_spdif.h
> +++ b/sound/soc/fsl/fsl_spdif.h
> @@ -152,7 +152,7 @@ enum spdif_gainsel {
>  #define STC_TXCLK_ALL_EN_MASK		(1 << STC_TXCLK_ALL_EN_OFFSET)
>  #define STC_TXCLK_ALL_EN		(1 << STC_TXCLK_ALL_EN_OFFSET)
>  #define STC_TXCLK_DF_OFFSET		0
> -#define STC_TXCLK_DF_MASK		(0x7ff << STC_TXCLK_DF_OFFSET)
> +#define STC_TXCLK_DF_MASK		(0x7f << STC_TXCLK_DF_OFFSET)
>  #define STC_TXCLK_DF(x)		((((x) - 1) << STC_TXCLK_DF_OFFSET) & STC_TXCLK_DF_MASK)
>  #define STC_TXCLK_SRC_MAX		8
>  
> -- 
> 2.7.4
> 

^ permalink raw reply

* Re: [PATCH] ASoC: fsl_spdif: fix sysclk_df type
From: Nicolin Chen @ 2019-02-19 19:01 UTC (permalink / raw)
  To: Viorel Suman
  Cc: alsa-devel@alsa-project.org, Timur Tabi, Xiubo Li,
	linuxppc-dev@lists.ozlabs.org, Takashi Iwai, Liam Girdwood,
	Jaroslav Kysela, Viorel Suman, Mark Brown, dl-linux-imx,
	Fabio Estevam, linux-kernel@vger.kernel.org
In-Reply-To: <1550503474-18865-1-git-send-email-viorel.suman@nxp.com>

On Mon, Feb 18, 2019 at 03:25:00PM +0000, Viorel Suman wrote:
> According to RM SPDIF STC SYSCLK_DF field is 9-bit wide, values
> being in 0..511 range. Use a proper type to handle sysclk_df.
> 
> Signed-off-by: Viorel Suman <viorel.suman@nxp.com>

Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>

> ---
>  sound/soc/fsl/fsl_spdif.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
> index a26686e..4842e6d 100644
> --- a/sound/soc/fsl/fsl_spdif.c
> +++ b/sound/soc/fsl/fsl_spdif.c
> @@ -96,7 +96,7 @@ struct fsl_spdif_priv {
>  	bool dpll_locked;
>  	u32 txrate[SPDIF_TXRATE_MAX];
>  	u8 txclk_df[SPDIF_TXRATE_MAX];
> -	u8 sysclk_df[SPDIF_TXRATE_MAX];
> +	u16 sysclk_df[SPDIF_TXRATE_MAX];
>  	u8 txclk_src[SPDIF_TXRATE_MAX];
>  	u8 rxclk_src;
>  	struct clk *txclk[SPDIF_TXRATE_MAX];
> @@ -376,7 +376,8 @@ static int spdif_set_sample_rate(struct snd_pcm_substream *substream,
>  	struct platform_device *pdev = spdif_priv->pdev;
>  	unsigned long csfs = 0;
>  	u32 stc, mask, rate;
> -	u8 clk, txclk_df, sysclk_df;
> +	u16 sysclk_df;
> +	u8 clk, txclk_df;
>  	int ret;
>  
>  	switch (sample_rate) {
> @@ -1109,8 +1110,9 @@ static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv,
>  	static const u32 rate[] = { 32000, 44100, 48000, 96000, 192000 };
>  	bool is_sysclk = clk_is_match(clk, spdif_priv->sysclk);
>  	u64 rate_ideal, rate_actual, sub;
> -	u32 sysclk_dfmin, sysclk_dfmax;
> -	u32 txclk_df, sysclk_df, arate;
> +	u32 arate;
> +	u16 sysclk_dfmin, sysclk_dfmax, sysclk_df;
> +	u8 txclk_df;
>  
>  	/* The sysclk has an extra divisor [2, 512] */
>  	sysclk_dfmin = is_sysclk ? 2 : 1;
> -- 
> 2.7.4
> 

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox