Commit 4f42d0bf authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull s390 updates from Alexander Gordeev:

 - Select config option KASAN_VMALLOC if KASAN is enabled

 - Select config option VMAP_STACK unconditionally

 - Implement arch_atomic_inc() / arch_atomic_dec() functions which
   result in a single instruction if compiled for z196 or newer
   architectures

 - Make layering between atomic.h and atomic_ops.h consistent

 - Comment s390 preempt_count implementation

 - Remove pre MARCH_HAS_Z196_FEATURES preempt count implementation

 - GCC uses the number of lines of an inline assembly to calculate
   number of instructions and decide on inlining. Therefore remove
   superfluous new lines from a couple of inline assemblies.

 - Provide arch_atomic_*_and_test() implementations that allow the
   compiler to generate slightly better code.

 - Optimize __preempt_count_dec_and_test()

 - Remove __bootdata annotations from declarations in header files

 - Add missing include of <linux/smp.h> in abs_lowcore.h to provide
   declarations for get_cpu() and put_cpu() used in the code

 - Fix suboptimal kernel image base when running make kasan.config

 - Remove huge_pte_none() and huge_pte_none_mostly() as are identical to
   the generic variants

 - Remove unused PAGE_KERNEL_EXEC, SEGMENT_KERNEL_EXEC, and
   REGION3_KERNEL_EXEC defines

 - Simplify noexec page protection handling and change the page, segment
   and region3 protection definitions automatically if the instruction
   execution-protection facility is not available

 - Save one instruction and prefer EXRL instruction over EX in string,
   xor_*(), amode31 and other functions

 - Create /dev/diag misc device to fetch diagnose specific information
   from the kernel and provide it to userspace

 - Retrieve electrical power readings using DIAGNOSE 0x324 ioctl

 - Make ccw_device_get_ciw() consistent and use array indices instead of
   pointer arithmetic

 - s390/qdio: Move memory alloc/pointer arithmetic for slib and sl into
   one place

 - The sysfs core now allows instances of 'struct bin_attribute' to be
   moved into read-only memory. Make use of that in s390 code

 - Add missing TLB range adjustment in pud_free_tlb()

 - Improve topology setup by adding early polarization detection

 - Fix length checks in codepage_convert() function

 - The generic bitops implementation is nearly identical to the s390
   one. Switch to the generic variant and decrease a bit the kernel
   image size

 - Provide an optimized arch_test_bit() implementation which makes use
   of flag output constraint. This generates slightly better code

 - Provide memory topology information obtanied with DIAGNOSE 0x310
   using ioctl.

 - Various other small improvements, fixes, and cleanups

Also, some changes came in through a merge of 'pci-device-recovery'
branch:

 - Add PCI error recovery status mechanism

 - Simplify and document debug_next_entry() logic

 - Split private data allocation and freeing out of debug file open()
   and close() operations

 - Add debug_dump() function that gets a textual representation of a
   debug info (e.g. PCI recovery hardware error logs)

 - Add formatted content of pci_debug_msg_id to the PCI report

* tag 's390-6.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (48 commits)
  s390/futex: Fix FUTEX_OP_ANDN implementation
  s390/diag: Add memory topology information via diag310
  s390/bitops: Provide optimized arch_test_bit()
  s390/bitops: Switch to generic bitops
  s390/ebcdic: Fix length decrement in codepage_convert()
  s390/ebcdic: Fix length check in codepage_convert()
  s390/ebcdic: Use exrl instead of ex
  s390/amode31: Use exrl instead of ex
  s390/stackleak: Use exrl instead of ex in __stackleak_poison()
  s390/lib: Use exrl instead of ex in xor functions
  s390/topology: Improve topology detection
  s390/tlb: Add missing TLB range adjustment
  s390/pkey: Constify 'struct bin_attribute'
  s390/sclp: Constify 'struct bin_attribute'
  s390/pci: Constify 'struct bin_attribute'
  s390/ipl: Constify 'struct bin_attribute'
  s390/crypto/cpacf: Constify 'struct bin_attribute'
  s390/qdio: Move memory alloc/pointer arithmetic for slib and sl into one place
  s390/cio: Use array indices instead of pointer arithmetic
  s390/qdio: Rename feature flag aif_osa to aif_qdio
  ...
parents a312e170 26701574
Loading
Loading
Loading
Loading
+2 −26
Original line number Diff line number Diff line
@@ -233,6 +233,7 @@ config S390
	select HAVE_VIRT_CPU_ACCOUNTING_IDLE
	select IOMMU_HELPER		if PCI
	select IOMMU_SUPPORT		if PCI
	select KASAN_VMALLOC if KASAN
	select LOCK_MM_AND_FIND_VMA
	select MMU_GATHER_MERGE_VMAS
	select MMU_GATHER_NO_GATHER
@@ -255,6 +256,7 @@ config S390
	select USER_STACKTRACE_SUPPORT
	select VDSO_GETRANDOM
	select VIRT_CPU_ACCOUNTING
	select VMAP_STACK
	select ZONE_DMA
	# Note: keep the above list sorted alphabetically

@@ -688,32 +690,6 @@ config MAX_PHYSMEM_BITS
	  Increasing the number of bits also increases the kernel image size.
	  By default 46 bits (64TB) are supported.

config CHECK_STACK
	def_bool y
	depends on !VMAP_STACK
	prompt "Detect kernel stack overflow"
	help
	  This option enables the compiler option -mstack-guard and
	  -mstack-size if they are available. If the compiler supports them
	  it will emit additional code to each function prolog to trigger
	  an illegal operation if the kernel stack is about to overflow.

	  Say N if you are unsure.

config STACK_GUARD
	int "Size of the guard area (128-1024)"
	range 128 1024
	depends on CHECK_STACK
	default "256"
	help
	  This allows you to specify the size of the guard area at the lower
	  end of the kernel stack. If the kernel stack points into the guard
	  area on function entry an illegal operation is triggered. The size
	  needs to be a power of 2. Please keep in mind that the size of an
	  interrupt frame is 184 bytes for 31 bit and 328 bytes on 64 bit.
	  The minimum size for the stack guard should be 256 for 31 bit and
	  512 for 64 bit.

endmenu

menu "I/O subsystem"
+0 −9
Original line number Diff line number Diff line
@@ -72,15 +72,6 @@ cflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls
KBUILD_AFLAGS_DECOMPRESSOR += $(aflags-y)
KBUILD_CFLAGS_DECOMPRESSOR += $(cflags-y)

ifneq ($(call cc-option,-mstack-size=8192 -mstack-guard=128),)
  CC_FLAGS_CHECK_STACK := -mstack-size=$(STACK_SIZE)
  ifeq ($(call cc-option,-mstack-size=8192),)
    CC_FLAGS_CHECK_STACK += -mstack-guard=$(CONFIG_STACK_GUARD)
  endif
  export CC_FLAGS_CHECK_STACK
  cflags-$(CONFIG_CHECK_STACK) += $(CC_FLAGS_CHECK_STACK)
endif

ifdef CONFIG_EXPOLINE
  ifdef CONFIG_EXPOLINE_EXTERN
    CC_FLAGS_EXPOLINE := -mindirect-branch=thunk-extern
+0 −1
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@
struct machine_info {
	unsigned char has_edat1 : 1;
	unsigned char has_edat2 : 1;
	unsigned char has_nx : 1;
};

struct vmlinux_info {
+11 −2
Original line number Diff line number Diff line
@@ -30,6 +30,9 @@ unsigned long __bootdata_preserved(vmemmap_size);
unsigned long __bootdata_preserved(MODULES_VADDR);
unsigned long __bootdata_preserved(MODULES_END);
unsigned long __bootdata_preserved(max_mappable);
unsigned long __bootdata_preserved(page_noexec_mask);
unsigned long __bootdata_preserved(segment_noexec_mask);
unsigned long __bootdata_preserved(region_noexec_mask);
int __bootdata_preserved(relocate_lowcore);

u64 __bootdata_preserved(stfle_fac_list[16]);
@@ -51,8 +54,14 @@ static void detect_facilities(void)
	}
	if (test_facility(78))
		machine.has_edat2 = 1;
	if (test_facility(130))
		machine.has_nx = 1;
	page_noexec_mask = -1UL;
	segment_noexec_mask = -1UL;
	region_noexec_mask = -1UL;
	if (!test_facility(130)) {
		page_noexec_mask &= ~_PAGE_NOEXEC;
		segment_noexec_mask &= ~_SEGMENT_ENTRY_NOEXEC;
		region_noexec_mask &= ~_REGION_ENTRY_NOEXEC;
	}
}

static int cmma_test_essa(void)
+3 −17
Original line number Diff line number Diff line
@@ -63,13 +63,10 @@ static void kasan_populate_shadow(unsigned long kernel_start, unsigned long kern
	pud_t pud_z = __pud(__pa(kasan_early_shadow_pmd) | _REGION3_ENTRY);
	p4d_t p4d_z = __p4d(__pa(kasan_early_shadow_pud) | _REGION2_ENTRY);
	unsigned long memgap_start = 0;
	unsigned long untracked_end;
	unsigned long start, end;
	int i;

	pte_z = __pte(__pa(kasan_early_shadow_page) | pgprot_val(PAGE_KERNEL_RO));
	if (!machine.has_nx)
		pte_z = clear_pte_bit(pte_z, __pgprot(_PAGE_NOEXEC));
	crst_table_init((unsigned long *)kasan_early_shadow_p4d, p4d_val(p4d_z));
	crst_table_init((unsigned long *)kasan_early_shadow_pud, pud_val(pud_z));
	crst_table_init((unsigned long *)kasan_early_shadow_pmd, pmd_val(pmd_z));
@@ -93,15 +90,10 @@ static void kasan_populate_shadow(unsigned long kernel_start, unsigned long kern
	kasan_populate(kernel_start + TEXT_OFFSET, kernel_end, POPULATE_KASAN_MAP_SHADOW);
	kasan_populate(0, (unsigned long)__identity_va(0), POPULATE_KASAN_ZERO_SHADOW);
	kasan_populate(AMODE31_START, AMODE31_END, POPULATE_KASAN_ZERO_SHADOW);
	if (IS_ENABLED(CONFIG_KASAN_VMALLOC)) {
		untracked_end = VMALLOC_START;
	/* shallowly populate kasan shadow for vmalloc and modules */
	kasan_populate(VMALLOC_START, MODULES_END, POPULATE_KASAN_SHALLOW);
	} else {
		untracked_end = MODULES_VADDR;
	}
	/* populate kasan shadow for untracked memory */
	kasan_populate((unsigned long)__identity_va(ident_map_size), untracked_end,
	kasan_populate((unsigned long)__identity_va(ident_map_size), VMALLOC_START,
		       POPULATE_KASAN_ZERO_SHADOW);
	kasan_populate(kernel_end, _REGION1_SIZE, POPULATE_KASAN_ZERO_SHADOW);
}
@@ -300,8 +292,6 @@ static void pgtable_pte_populate(pmd_t *pmd, unsigned long addr, unsigned long e
				continue;
			entry = __pte(_pa(addr, PAGE_SIZE, mode));
			entry = set_pte_bit(entry, PAGE_KERNEL);
			if (!machine.has_nx)
				entry = clear_pte_bit(entry, __pgprot(_PAGE_NOEXEC));
			set_pte(pte, entry);
			pages++;
		}
@@ -326,8 +316,6 @@ static void pgtable_pmd_populate(pud_t *pud, unsigned long addr, unsigned long e
			if (can_large_pmd(pmd, addr, next, mode)) {
				entry = __pmd(_pa(addr, _SEGMENT_SIZE, mode));
				entry = set_pmd_bit(entry, SEGMENT_KERNEL);
				if (!machine.has_nx)
					entry = clear_pmd_bit(entry, __pgprot(_SEGMENT_ENTRY_NOEXEC));
				set_pmd(pmd, entry);
				pages++;
				continue;
@@ -359,8 +347,6 @@ static void pgtable_pud_populate(p4d_t *p4d, unsigned long addr, unsigned long e
			if (can_large_pud(pud, addr, next, mode)) {
				entry = __pud(_pa(addr, _REGION3_SIZE, mode));
				entry = set_pud_bit(entry, REGION3_KERNEL);
				if (!machine.has_nx)
					entry = clear_pud_bit(entry, __pgprot(_REGION_ENTRY_NOEXEC));
				set_pud(pud, entry);
				pages++;
				continue;
Loading