Skip to content

Commit 7794b1d

Browse files
committed
Merge tag 'powerpc-5.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc updates from Michael Ellerman: "Highlights: - Infrastructure for secure boot on some bare metal Power9 machines. The firmware support is still in development, so the code here won't actually activate secure boot on any existing systems. - A change to xmon (our crash handler / pseudo-debugger) to restrict it to read-only mode when the kernel is lockdown'ed, otherwise it's trivial to drop into xmon and modify kernel data, such as the lockdown state. - Support for KASLR on 32-bit BookE machines (Freescale / NXP). - Fixes for our flush_icache_range() and __kernel_sync_dicache() (VDSO) to work with memory ranges >4GB. - Some reworks of the pseries CMM (Cooperative Memory Management) driver to make it behave more like other balloon drivers and enable some cleanups of generic mm code. - A series of fixes to our hardware breakpoint support to properly handle unaligned watchpoint addresses. Plus a bunch of other smaller improvements, fixes and cleanups. Thanks to: Alastair D'Silva, Andrew Donnellan, Aneesh Kumar K.V, Anthony Steinhauser, Cédric Le Goater, Chris Packham, Chris Smart, Christophe Leroy, Christopher M. Riedl, Christoph Hellwig, Claudio Carvalho, Daniel Axtens, David Hildenbrand, Deb McLemore, Diana Craciun, Eric Richter, Geert Uytterhoeven, Greg Kroah-Hartman, Greg Kurz, Gustavo L. F. Walbon, Hari Bathini, Harish, Jason Yan, Krzysztof Kozlowski, Leonardo Bras, Mathieu Malaterre, Mauro S. M. Rodrigues, Michal Suchanek, Mimi Zohar, Nathan Chancellor, Nathan Lynch, Nayna Jain, Nick Desaulniers, Oliver O'Halloran, Qian Cai, Rasmus Villemoes, Ravi Bangoria, Sam Bobroff, Santosh Sivaraj, Scott Wood, Thomas Huth, Tyrel Datwyler, Vaibhav Jain, Valentin Longchamp, YueHaibing" * tag 'powerpc-5.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (144 commits) powerpc/fixmap: fix crash with HIGHMEM x86/efi: remove unused variables powerpc: Define arch_is_kernel_initmem_freed() for lockdep powerpc/prom_init: Use -ffreestanding to avoid a reference to bcmp powerpc: Avoid clang warnings around setjmp and longjmp powerpc: Don't add -mabi= flags when building with Clang powerpc: Fix Kconfig indentation powerpc/fixmap: don't clear fixmap area in paging_init() selftests/powerpc: spectre_v2 test must be built 64-bit powerpc/powernv: Disable native PCIe port management powerpc/kexec: Move kexec files into a dedicated subdir. powerpc/32: Split kexec low level code out of misc_32.S powerpc/sysdev: drop simple gpio powerpc/83xx: map IMMR with a BAT. powerpc/32s: automatically allocate BAT in setbat() powerpc/ioremap: warn on early use of ioremap() powerpc: Add support for GENERIC_EARLY_IOREMAP powerpc/fixmap: Use __fix_to_virt() instead of fix_to_virt() powerpc/8xx: use the fixmapped IMMR in cpm_reset() powerpc/8xx: add __init to cpm1 init functions ...
2 parents 9dd0013 + 2807273 commit 7794b1d

File tree

215 files changed

+4569
-2463
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+4569
-2463
lines changed

Documentation/ABI/testing/ima_policy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Description:
2525
lsm: [[subj_user=] [subj_role=] [subj_type=]
2626
[obj_user=] [obj_role=] [obj_type=]]
2727
option: [[appraise_type=]] [template=] [permit_directio]
28+
[appraise_flag=]
2829
base: func:= [BPRM_CHECK][MMAP_CHECK][CREDS_CHECK][FILE_CHECK][MODULE_CHECK]
2930
[FIRMWARE_CHECK]
3031
[KEXEC_KERNEL_CHECK] [KEXEC_INITRAMFS_CHECK]
@@ -38,6 +39,9 @@ Description:
3839
fowner:= decimal value
3940
lsm: are LSM specific
4041
option: appraise_type:= [imasig] [imasig|modsig]
42+
appraise_flag:= [check_blacklist]
43+
Currently, blacklist check is only for files signed with appended
44+
signature.
4145
template:= name of a defined IMA template type
4246
(eg, ima-ng). Only valid when action is "measure".
4347
pcr:= decimal value
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
What: /sys/firmware/secvar
2+
Date: August 2019
3+
Contact: Nayna Jain <[email protected]>
4+
Description: This directory is created if the POWER firmware supports OS
5+
secureboot, thereby secure variables. It exposes interface
6+
for reading/writing the secure variables
7+
8+
What: /sys/firmware/secvar/vars
9+
Date: August 2019
10+
Contact: Nayna Jain <[email protected]>
11+
Description: This directory lists all the secure variables that are supported
12+
by the firmware.
13+
14+
What: /sys/firmware/secvar/format
15+
Date: August 2019
16+
Contact: Nayna Jain <[email protected]>
17+
Description: A string indicating which backend is in use by the firmware.
18+
This determines the format of the variable and the accepted
19+
format of variable updates.
20+
21+
What: /sys/firmware/secvar/vars/<variable name>
22+
Date: August 2019
23+
Contact: Nayna Jain <[email protected]>
24+
Description: Each secure variable is represented as a directory named as
25+
<variable_name>. The variable name is unique and is in ASCII
26+
representation. The data and size can be determined by reading
27+
their respective attribute files.
28+
29+
What: /sys/firmware/secvar/vars/<variable_name>/size
30+
Date: August 2019
31+
Contact: Nayna Jain <[email protected]>
32+
Description: An integer representation of the size of the content of the
33+
variable. In other words, it represents the size of the data.
34+
35+
What: /sys/firmware/secvar/vars/<variable_name>/data
36+
Date: August 2019
37+
Contact: Nayna Jain h<[email protected]>
38+
Description: A read-only file containing the value of the variable. The size
39+
of the file represents the maximum size of the variable data.
40+
41+
What: /sys/firmware/secvar/vars/<variable_name>/update
42+
Date: August 2019
43+
Contact: Nayna Jain <[email protected]>
44+
Description: A write-only file that is used to submit the new value for the
45+
variable. The size of the file represents the maximum size of
46+
the variable data that can be written.

Documentation/devicetree/bindings/board/fsl-board.txt

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,36 +47,6 @@ Example (LS2080A-RDB):
4747
reg = <0x3 0 0x10000>;
4848
};
4949

50-
* Freescale BCSR GPIO banks
51-
52-
Some BCSR registers act as simple GPIO controllers, each such
53-
register can be represented by the gpio-controller node.
54-
55-
Required properities:
56-
- compatible : Should be "fsl,<board>-bcsr-gpio".
57-
- reg : Should contain the address and the length of the GPIO bank
58-
register.
59-
- #gpio-cells : Should be two. The first cell is the pin number and the
60-
second cell is used to specify optional parameters (currently unused).
61-
- gpio-controller : Marks the port as GPIO controller.
62-
63-
Example:
64-
65-
bcsr@1,0 {
66-
#address-cells = <1>;
67-
#size-cells = <1>;
68-
compatible = "fsl,mpc8360mds-bcsr";
69-
reg = <1 0 0x8000>;
70-
ranges = <0 1 0 0x8000>;
71-
72-
bcsr13: gpio-controller@d {
73-
#gpio-cells = <2>;
74-
compatible = "fsl,mpc8360mds-bcsr-gpio";
75-
reg = <0xd 1>;
76-
gpio-controller;
77-
};
78-
};
79-
8050
* Freescale on-board FPGA connected on I2C bus
8151

8252
Some Freescale boards like BSC9132QDS have on board FPGA connected on

Documentation/powerpc/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ powerpc
1919
firmware-assisted-dump
2020
hvcs
2121
isa-versions
22+
kaslr-booke32
2223
mpc52xx
2324
pci_iov_resource_on_powernv
2425
pmu-ebb
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
===========================
4+
KASLR for Freescale BookE32
5+
===========================
6+
7+
The word KASLR stands for Kernel Address Space Layout Randomization.
8+
9+
This document tries to explain the implementation of the KASLR for
10+
Freescale BookE32. KASLR is a security feature that deters exploit
11+
attempts relying on knowledge of the location of kernel internals.
12+
13+
Since CONFIG_RELOCATABLE has already supported, what we need to do is
14+
map or copy kernel to a proper place and relocate. Freescale Book-E
15+
parts expect lowmem to be mapped by fixed TLB entries(TLB1). The TLB1
16+
entries are not suitable to map the kernel directly in a randomized
17+
region, so we chose to copy the kernel to a proper place and restart to
18+
relocate.
19+
20+
Entropy is derived from the banner and timer base, which will change every
21+
build and boot. This not so much safe so additionally the bootloader may
22+
pass entropy via the /chosen/kaslr-seed node in device tree.
23+
24+
We will use the first 512M of the low memory to randomize the kernel
25+
image. The memory will be split in 64M zones. We will use the lower 8
26+
bit of the entropy to decide the index of the 64M zone. Then we chose a
27+
16K aligned offset inside the 64M zone to put the kernel in::
28+
29+
KERNELBASE
30+
31+
|--> 64M <--|
32+
| |
33+
+---------------+ +----------------+---------------+
34+
| |....| |kernel| | |
35+
+---------------+ +----------------+---------------+
36+
| |
37+
|-----> offset <-----|
38+
39+
kernstart_virt_addr
40+
41+
To enable KASLR, set CONFIG_RANDOMIZE_BASE = y. If KASLR is enable and you
42+
want to disable it at runtime, add "nokaslr" to the kernel cmdline.

arch/powerpc/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ obj-$(CONFIG_XMON) += xmon/
1414
obj-$(CONFIG_KVM) += kvm/
1515

1616
obj-$(CONFIG_PERF_EVENTS) += perf/
17+
obj-$(CONFIG_KEXEC_CORE) += kexec/
1718
obj-$(CONFIG_KEXEC_FILE) += purgatory/

arch/powerpc/Kconfig

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ config PPC
161161
select GENERIC_CMOS_UPDATE
162162
select GENERIC_CPU_AUTOPROBE
163163
select GENERIC_CPU_VULNERABILITIES if PPC_BARRIER_NOSPEC
164+
select GENERIC_EARLY_IOREMAP
164165
select GENERIC_IRQ_SHOW
165166
select GENERIC_IRQ_SHOW_LEVEL
166167
select GENERIC_PCI_IOMAP if PCI
@@ -551,6 +552,17 @@ config RELOCATABLE
551552
setting can still be useful to bootwrappers that need to know the
552553
load address of the kernel (eg. u-boot/mkimage).
553554

555+
config RANDOMIZE_BASE
556+
bool "Randomize the address of the kernel image"
557+
depends on (FSL_BOOKE && FLATMEM && PPC32)
558+
depends on RELOCATABLE
559+
help
560+
Randomizes the virtual address at which the kernel image is
561+
loaded, as a security feature that deters exploit attempts
562+
relying on knowledge of the location of kernel internals.
563+
564+
If unsure, say Y.
565+
554566
config RELOCATABLE_TEST
555567
bool "Test relocatable kernel"
556568
depends on (PPC64 && RELOCATABLE)
@@ -874,15 +886,33 @@ config CMDLINE
874886
some command-line options at build time by entering them here. In
875887
most cases you will need to specify the root device here.
876888

889+
choice
890+
prompt "Kernel command line type" if CMDLINE != ""
891+
default CMDLINE_FROM_BOOTLOADER
892+
893+
config CMDLINE_FROM_BOOTLOADER
894+
bool "Use bootloader kernel arguments if available"
895+
help
896+
Uses the command-line options passed by the boot loader. If
897+
the boot loader doesn't provide any, the default kernel command
898+
string provided in CMDLINE will be used.
899+
900+
config CMDLINE_EXTEND
901+
bool "Extend bootloader kernel arguments"
902+
help
903+
The command-line arguments provided by the boot loader will be
904+
appended to the default kernel command string.
905+
877906
config CMDLINE_FORCE
878907
bool "Always use the default kernel command string"
879-
depends on CMDLINE_BOOL
880908
help
881909
Always use the default kernel command string, even if the boot
882910
loader passes other arguments to the kernel.
883911
This is useful if you cannot or don't want to change the
884912
command-line options your boot loader passes to the kernel.
885913

914+
endchoice
915+
886916
config EXTRA_TARGETS
887917
string "Additional default image types"
888918
help
@@ -934,6 +964,28 @@ config PPC_MEM_KEYS
934964

935965
If unsure, say y.
936966

967+
config PPC_SECURE_BOOT
968+
prompt "Enable secure boot support"
969+
bool
970+
depends on PPC_POWERNV
971+
depends on IMA_ARCH_POLICY
972+
help
973+
Systems with firmware secure boot enabled need to define security
974+
policies to extend secure boot to the OS. This config allows a user
975+
to enable OS secure boot on systems that have firmware support for
976+
it. If in doubt say N.
977+
978+
config PPC_SECVAR_SYSFS
979+
bool "Enable sysfs interface for POWER secure variables"
980+
default y
981+
depends on PPC_SECURE_BOOT
982+
depends on SYSFS
983+
help
984+
POWER secure variables are managed and controlled by firmware.
985+
These variables are exposed to userspace via sysfs to enable
986+
read/write operations on these variables. Say Y if you have
987+
secure boot enabled and want to expose variables to userspace.
988+
937989
endmenu
938990

939991
config ISA_DMA_API

arch/powerpc/Kconfig.debug

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ config XMON_DEFAULT_RO_MODE
122122
depends on XMON
123123
default y
124124
help
125-
Operate xmon in read-only mode. The cmdline options 'xmon=rw' and
126-
'xmon=ro' override this default.
125+
Operate xmon in read-only mode. The cmdline options 'xmon=rw' and
126+
'xmon=ro' override this default.
127127

128128
config DEBUGGER
129129
bool
@@ -222,7 +222,7 @@ config PPC_EARLY_DEBUG_44x
222222
help
223223
Select this to enable early debugging for IBM 44x chips via the
224224
inbuilt serial port. If you enable this, ensure you set
225-
PPC_EARLY_DEBUG_44x_PHYSLOW below to suit your target board.
225+
PPC_EARLY_DEBUG_44x_PHYSLOW below to suit your target board.
226226

227227
config PPC_EARLY_DEBUG_40x
228228
bool "Early serial debugging for IBM/AMCC 40x CPUs"
@@ -325,7 +325,7 @@ config PPC_EARLY_DEBUG_44x_PHYSLOW
325325
default "0x40000200"
326326
help
327327
You probably want 0x40000200 for ebony boards and
328-
0x40000300 for taishan
328+
0x40000300 for taishan
329329

330330
config PPC_EARLY_DEBUG_44x_PHYSHIGH
331331
hex "EPRN of early debug UART physical address"
@@ -359,9 +359,9 @@ config FAIL_IOMMU
359359
If you are unsure, say N.
360360

361361
config PPC_PTDUMP
362-
bool "Export kernel pagetable layout to userspace via debugfs"
363-
depends on DEBUG_KERNEL && DEBUG_FS
364-
help
362+
bool "Export kernel pagetable layout to userspace via debugfs"
363+
depends on DEBUG_KERNEL && DEBUG_FS
364+
help
365365
This option exports the state of the kernel pagetables to a
366366
debugfs file. This is only useful for kernel developers who are
367367
working in architecture specific areas of the kernel - probably
@@ -390,8 +390,8 @@ config PPC_DEBUG_WX
390390

391391
config PPC_FAST_ENDIAN_SWITCH
392392
bool "Deprecated fast endian-switch syscall"
393-
depends on DEBUG_KERNEL && PPC_BOOK3S_64
394-
help
393+
depends on DEBUG_KERNEL && PPC_BOOK3S_64
394+
help
395395
If you're unsure what this is, say N.
396396

397397
config KASAN_SHADOW_OFFSET

arch/powerpc/Makefile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,13 @@ MULTIPLEWORD := -mmultiple
9191
endif
9292

9393
ifdef CONFIG_PPC64
94+
ifndef CONFIG_CC_IS_CLANG
9495
cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1)
9596
cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mcall-aixdesc)
9697
aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1)
9798
aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mabi=elfv2
9899
endif
100+
endif
99101

100102
ifndef CONFIG_CC_IS_CLANG
101103
cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align
@@ -141,6 +143,7 @@ endif
141143
endif
142144

143145
CFLAGS-$(CONFIG_PPC64) := $(call cc-option,-mtraceback=no)
146+
ifndef CONFIG_CC_IS_CLANG
144147
ifdef CONFIG_CPU_LITTLE_ENDIAN
145148
CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc))
146149
AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2)
@@ -149,6 +152,7 @@ CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1)
149152
CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcall-aixdesc)
150153
AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1)
151154
endif
155+
endif
152156
CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc))
153157
CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)
154158

@@ -330,32 +334,32 @@ powernv_be_defconfig:
330334

331335
PHONY += mpc85xx_defconfig
332336
mpc85xx_defconfig:
333-
$(call merge_into_defconfig,mpc85xx_basic_defconfig,\
337+
$(call merge_into_defconfig,mpc85xx_base.config,\
334338
85xx-32bit 85xx-hw fsl-emb-nonhw)
335339

336340
PHONY += mpc85xx_smp_defconfig
337341
mpc85xx_smp_defconfig:
338-
$(call merge_into_defconfig,mpc85xx_basic_defconfig,\
342+
$(call merge_into_defconfig,mpc85xx_base.config,\
339343
85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw)
340344

341345
PHONY += corenet32_smp_defconfig
342346
corenet32_smp_defconfig:
343-
$(call merge_into_defconfig,corenet_basic_defconfig,\
347+
$(call merge_into_defconfig,corenet_base.config,\
344348
85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw dpaa)
345349

346350
PHONY += corenet64_smp_defconfig
347351
corenet64_smp_defconfig:
348-
$(call merge_into_defconfig,corenet_basic_defconfig,\
352+
$(call merge_into_defconfig,corenet_base.config,\
349353
85xx-64bit 85xx-smp altivec 85xx-hw fsl-emb-nonhw dpaa)
350354

351355
PHONY += mpc86xx_defconfig
352356
mpc86xx_defconfig:
353-
$(call merge_into_defconfig,mpc86xx_basic_defconfig,\
357+
$(call merge_into_defconfig,mpc86xx_base.config,\
354358
86xx-hw fsl-emb-nonhw)
355359

356360
PHONY += mpc86xx_smp_defconfig
357361
mpc86xx_smp_defconfig:
358-
$(call merge_into_defconfig,mpc86xx_basic_defconfig,\
362+
$(call merge_into_defconfig,mpc86xx_base.config,\
359363
86xx-smp 86xx-hw fsl-emb-nonhw)
360364

361365
PHONY += ppc32_allmodconfig

0 commit comments

Comments
 (0)