License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 15:07:57 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-04-16 15:20:36 -07:00
|
|
|
/*
|
2012-07-20 11:15:04 +02:00
|
|
|
* Copyright IBM Corp. 1999, 2012
|
2010-02-26 22:37:43 +01:00
|
|
|
* Author(s): Hartmut Penner <hp@de.ibm.com>,
|
|
|
|
* Martin Schwidefsky <schwidefsky@de.ibm.com>,
|
|
|
|
* Denis Joseph Barrow,
|
2005-04-16 15:20:36 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ASM_S390_LOWCORE_H
|
|
|
|
#define _ASM_S390_LOWCORE_H
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
2025-02-07 15:48:57 +01:00
|
|
|
#include <asm/machine.h>
|
2010-02-26 22:37:43 +01:00
|
|
|
#include <asm/ptrace.h>
|
2023-09-11 21:40:04 +02:00
|
|
|
#include <asm/ctlreg.h>
|
2010-02-26 22:37:43 +01:00
|
|
|
#include <asm/cpu.h>
|
2014-10-06 17:57:43 +02:00
|
|
|
#include <asm/types.h>
|
s390: Add infrastructure to patch lowcore accesses
The s390 architecture defines two special per-CPU data pages
called the "prefix area". In s390-linux terminology this is usually
called "lowcore". This memory area contains system configuration
data like old/new PSW's for system call/interrupt/machine check
handlers and lots of other data. It is normally mapped to logical
address 0. This area can only be accessed when in supervisor mode.
This means that kernel code can dereference NULL pointers, because
accesses to address 0 are allowed. Parts of lowcore can be write
protected, but read accesses and write accesses outside of the write
protected areas are not caught.
To remove this limitation for debugging and testing, remap lowcore to
another address and define a function get_lowcore() which simply
returns the address where lowcore is mapped at. This would normally
introduce a pointer dereference (=memory read). As lowcore is used
for several very often used variables, add code to patch this function
during runtime, so we avoid the memory reads.
For C code get_lowcore() has to be used, for assembly code it is
the GET_LC macro. When using this macro/function a reference is added
to alternative patching. All these locations will be patched to the
actual lowcore location when the kernel is booted or a module is loaded.
To make debugging/bisecting problems easier, this patch adds all the
infrastructure but the lowcore address is still hardwired to 0. This
way the code can be converted on a per function basis, and the
functionality is enabled in a patch after all the functions have
been converted.
Note that this requires at least z16 because the old lpsw instruction
only allowed a 12 bit displacement. z16 introduced lpswey which allows
20 bits (signed), so the lowcore can effectively be mapped from
address 0 - 0x7e000. To use 0x7e000 as address, a 6 byte lgfi
instruction would have to be used in the alternative. To save two
bytes, llilh can be used, but this only allows to set bits 16-31 of
the address. In order to use the llilh instruction, use 0x70000 as
alternative lowcore address. This is still large enough to catch
NULL pointer dereferences into large arrays.
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2024-07-22 15:41:14 +02:00
|
|
|
#include <asm/alternative.h>
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2010-02-26 22:37:43 +01:00
|
|
|
#define LC_ORDER 1
|
|
|
|
#define LC_PAGES 2
|
|
|
|
|
s390: Add infrastructure to patch lowcore accesses
The s390 architecture defines two special per-CPU data pages
called the "prefix area". In s390-linux terminology this is usually
called "lowcore". This memory area contains system configuration
data like old/new PSW's for system call/interrupt/machine check
handlers and lots of other data. It is normally mapped to logical
address 0. This area can only be accessed when in supervisor mode.
This means that kernel code can dereference NULL pointers, because
accesses to address 0 are allowed. Parts of lowcore can be write
protected, but read accesses and write accesses outside of the write
protected areas are not caught.
To remove this limitation for debugging and testing, remap lowcore to
another address and define a function get_lowcore() which simply
returns the address where lowcore is mapped at. This would normally
introduce a pointer dereference (=memory read). As lowcore is used
for several very often used variables, add code to patch this function
during runtime, so we avoid the memory reads.
For C code get_lowcore() has to be used, for assembly code it is
the GET_LC macro. When using this macro/function a reference is added
to alternative patching. All these locations will be patched to the
actual lowcore location when the kernel is booted or a module is loaded.
To make debugging/bisecting problems easier, this patch adds all the
infrastructure but the lowcore address is still hardwired to 0. This
way the code can be converted on a per function basis, and the
functionality is enabled in a patch after all the functions have
been converted.
Note that this requires at least z16 because the old lpsw instruction
only allowed a 12 bit displacement. z16 introduced lpswey which allows
20 bits (signed), so the lowcore can effectively be mapped from
address 0 - 0x7e000. To use 0x7e000 as address, a 6 byte lgfi
instruction would have to be used in the alternative. To save two
bytes, llilh can be used, but this only allows to set bits 16-31 of
the address. In order to use the llilh instruction, use 0x70000 as
alternative lowcore address. This is still large enough to catch
NULL pointer dereferences into large arrays.
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2024-07-22 15:41:14 +02:00
|
|
|
#define LOWCORE_ALT_ADDRESS _AC(0x70000, UL)
|
|
|
|
|
2025-06-11 16:00:46 +02:00
|
|
|
#ifndef __ASSEMBLER__
|
s390: Add infrastructure to patch lowcore accesses
The s390 architecture defines two special per-CPU data pages
called the "prefix area". In s390-linux terminology this is usually
called "lowcore". This memory area contains system configuration
data like old/new PSW's for system call/interrupt/machine check
handlers and lots of other data. It is normally mapped to logical
address 0. This area can only be accessed when in supervisor mode.
This means that kernel code can dereference NULL pointers, because
accesses to address 0 are allowed. Parts of lowcore can be write
protected, but read accesses and write accesses outside of the write
protected areas are not caught.
To remove this limitation for debugging and testing, remap lowcore to
another address and define a function get_lowcore() which simply
returns the address where lowcore is mapped at. This would normally
introduce a pointer dereference (=memory read). As lowcore is used
for several very often used variables, add code to patch this function
during runtime, so we avoid the memory reads.
For C code get_lowcore() has to be used, for assembly code it is
the GET_LC macro. When using this macro/function a reference is added
to alternative patching. All these locations will be patched to the
actual lowcore location when the kernel is booted or a module is loaded.
To make debugging/bisecting problems easier, this patch adds all the
infrastructure but the lowcore address is still hardwired to 0. This
way the code can be converted on a per function basis, and the
functionality is enabled in a patch after all the functions have
been converted.
Note that this requires at least z16 because the old lpsw instruction
only allowed a 12 bit displacement. z16 introduced lpswey which allows
20 bits (signed), so the lowcore can effectively be mapped from
address 0 - 0x7e000. To use 0x7e000 as address, a 6 byte lgfi
instruction would have to be used in the alternative. To save two
bytes, llilh can be used, but this only allows to set bits 16-31 of
the address. In order to use the llilh instruction, use 0x70000 as
alternative lowcore address. This is still large enough to catch
NULL pointer dereferences into large arrays.
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2024-07-22 15:41:14 +02:00
|
|
|
|
2021-05-05 22:01:16 +02:00
|
|
|
struct pgm_tdb {
|
|
|
|
u64 data[32];
|
|
|
|
};
|
|
|
|
|
2015-12-31 10:29:00 +01:00
|
|
|
struct lowcore {
|
2010-02-26 22:37:43 +01:00
|
|
|
__u8 pad_0x0000[0x0014-0x0000]; /* 0x0000 */
|
|
|
|
__u32 ipl_parmblock_ptr; /* 0x0014 */
|
2009-03-26 15:24:44 +01:00
|
|
|
__u8 pad_0x0018[0x0080-0x0018]; /* 0x0018 */
|
|
|
|
__u32 ext_params; /* 0x0080 */
|
2021-05-05 22:01:11 +02:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
__u16 ext_cpu_addr; /* 0x0084 */
|
|
|
|
__u16 ext_int_code; /* 0x0086 */
|
2021-06-01 10:59:09 +02:00
|
|
|
};
|
2021-05-05 22:01:11 +02:00
|
|
|
__u32 ext_int_code_addr;
|
2021-06-01 10:59:09 +02:00
|
|
|
};
|
2021-05-05 22:01:09 +02:00
|
|
|
__u32 svc_int_code; /* 0x0088 */
|
2022-03-06 11:15:27 +01:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
__u16 pgm_ilc; /* 0x008c */
|
|
|
|
__u16 pgm_code; /* 0x008e */
|
|
|
|
};
|
|
|
|
__u32 pgm_int_code;
|
|
|
|
};
|
2009-03-26 15:24:44 +01:00
|
|
|
__u32 data_exc_code; /* 0x0090 */
|
|
|
|
__u16 mon_class_num; /* 0x0094 */
|
2022-03-06 10:59:05 +01:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
__u8 per_code; /* 0x0096 */
|
|
|
|
__u8 per_atmid; /* 0x0097 */
|
|
|
|
};
|
|
|
|
__u16 per_code_combined;
|
|
|
|
};
|
2010-05-17 10:00:00 +02:00
|
|
|
__u64 per_address; /* 0x0098 */
|
2009-03-26 15:24:44 +01:00
|
|
|
__u8 exc_access_id; /* 0x00a0 */
|
|
|
|
__u8 per_access_id; /* 0x00a1 */
|
|
|
|
__u8 op_access_id; /* 0x00a2 */
|
2014-02-10 10:55:37 +01:00
|
|
|
__u8 ar_mode_id; /* 0x00a3 */
|
2009-03-26 15:24:44 +01:00
|
|
|
__u8 pad_0x00a4[0x00a8-0x00a4]; /* 0x00a4 */
|
2010-05-17 10:00:00 +02:00
|
|
|
__u64 trans_exc_code; /* 0x00a8 */
|
|
|
|
__u64 monitor_code; /* 0x00b0 */
|
2021-05-10 21:10:18 +02:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
__u16 subchannel_id; /* 0x00b8 */
|
|
|
|
__u16 subchannel_nr; /* 0x00ba */
|
|
|
|
__u32 io_int_parm; /* 0x00bc */
|
|
|
|
__u32 io_int_word; /* 0x00c0 */
|
|
|
|
};
|
|
|
|
struct tpi_info tpi_info; /* 0x00b8 */
|
|
|
|
};
|
2009-03-26 15:24:44 +01:00
|
|
|
__u8 pad_0x00c4[0x00c8-0x00c4]; /* 0x00c4 */
|
|
|
|
__u32 stfl_fac_list; /* 0x00c8 */
|
|
|
|
__u8 pad_0x00cc[0x00e8-0x00cc]; /* 0x00cc */
|
2015-10-06 14:45:35 +02:00
|
|
|
__u64 mcck_interruption_code; /* 0x00e8 */
|
2009-03-26 15:24:44 +01:00
|
|
|
__u8 pad_0x00f0[0x00f4-0x00f0]; /* 0x00f0 */
|
|
|
|
__u32 external_damage_code; /* 0x00f4 */
|
2010-05-17 10:00:00 +02:00
|
|
|
__u64 failing_storage_address; /* 0x00f8 */
|
2010-02-26 22:37:43 +01:00
|
|
|
__u8 pad_0x0100[0x0110-0x0100]; /* 0x0100 */
|
2021-10-01 17:08:09 +02:00
|
|
|
__u64 pgm_last_break; /* 0x0110 */
|
2010-02-26 22:37:43 +01:00
|
|
|
__u8 pad_0x0118[0x0120-0x0118]; /* 0x0118 */
|
2009-03-26 15:24:44 +01:00
|
|
|
psw_t restart_old_psw; /* 0x0120 */
|
|
|
|
psw_t external_old_psw; /* 0x0130 */
|
|
|
|
psw_t svc_old_psw; /* 0x0140 */
|
|
|
|
psw_t program_old_psw; /* 0x0150 */
|
|
|
|
psw_t mcck_old_psw; /* 0x0160 */
|
|
|
|
psw_t io_old_psw; /* 0x0170 */
|
|
|
|
__u8 pad_0x0180[0x01a0-0x0180]; /* 0x0180 */
|
|
|
|
psw_t restart_psw; /* 0x01a0 */
|
|
|
|
psw_t external_new_psw; /* 0x01b0 */
|
|
|
|
psw_t svc_new_psw; /* 0x01c0 */
|
|
|
|
psw_t program_new_psw; /* 0x01d0 */
|
|
|
|
psw_t mcck_new_psw; /* 0x01e0 */
|
|
|
|
psw_t io_new_psw; /* 0x01f0 */
|
|
|
|
|
2011-12-27 11:27:15 +01:00
|
|
|
/* Save areas. */
|
2024-08-28 13:50:04 +02:00
|
|
|
__u64 save_area[8]; /* 0x0200 */
|
|
|
|
__u8 pad_0x0240[0x0280-0x0240]; /* 0x0240 */
|
2011-12-27 11:27:15 +01:00
|
|
|
__u64 save_area_restart[1]; /* 0x0280 */
|
2014-04-15 12:55:07 +02:00
|
|
|
|
2024-07-16 09:26:15 +02:00
|
|
|
__u64 pcpu; /* 0x0288 */
|
2011-12-27 11:27:15 +01:00
|
|
|
|
|
|
|
/* Return psws. */
|
|
|
|
psw_t return_psw; /* 0x0290 */
|
|
|
|
psw_t return_mcck_psw; /* 0x02a0 */
|
2009-03-26 15:24:44 +01:00
|
|
|
|
2021-04-07 09:20:17 +02:00
|
|
|
__u64 last_break; /* 0x02b0 */
|
|
|
|
|
2009-03-26 15:24:44 +01:00
|
|
|
/* CPU accounting and timing values. */
|
2021-04-07 09:20:17 +02:00
|
|
|
__u64 sys_enter_timer; /* 0x02b8 */
|
2011-12-27 11:27:15 +01:00
|
|
|
__u64 mcck_enter_timer; /* 0x02c0 */
|
|
|
|
__u64 exit_timer; /* 0x02c8 */
|
|
|
|
__u64 user_timer; /* 0x02d0 */
|
2017-01-05 18:11:49 +01:00
|
|
|
__u64 guest_timer; /* 0x02d8 */
|
|
|
|
__u64 system_timer; /* 0x02e0 */
|
|
|
|
__u64 hardirq_timer; /* 0x02e8 */
|
|
|
|
__u64 softirq_timer; /* 0x02f0 */
|
|
|
|
__u64 steal_timer; /* 0x02f8 */
|
2019-03-06 13:31:21 +02:00
|
|
|
__u64 avg_steal_timer; /* 0x0300 */
|
|
|
|
__u64 last_update_timer; /* 0x0308 */
|
|
|
|
__u64 last_update_clock; /* 0x0310 */
|
2023-06-29 08:59:43 +02:00
|
|
|
__u64 int_clock; /* 0x0318 */
|
|
|
|
__u8 pad_0x0320[0x0328-0x0320]; /* 0x0320 */
|
2019-03-06 13:31:21 +02:00
|
|
|
__u64 clock_comparator; /* 0x0328 */
|
2025-02-07 15:48:59 +01:00
|
|
|
__u8 pad_0x0330[0x0340-0x0330]; /* 0x0330 */
|
2009-03-26 15:24:44 +01:00
|
|
|
|
|
|
|
/* Current process. */
|
2019-03-06 13:31:21 +02:00
|
|
|
__u64 current_task; /* 0x0340 */
|
|
|
|
__u64 kernel_stack; /* 0x0348 */
|
2012-03-11 11:59:26 -04:00
|
|
|
|
2017-09-12 16:37:33 +02:00
|
|
|
/* Interrupt, DAT-off and restartstack. */
|
2019-03-06 13:31:21 +02:00
|
|
|
__u64 async_stack; /* 0x0350 */
|
|
|
|
__u64 nodat_stack; /* 0x0358 */
|
|
|
|
__u64 restart_stack; /* 0x0360 */
|
2021-02-03 09:02:51 +01:00
|
|
|
__u64 mcck_stack; /* 0x0368 */
|
2012-03-11 11:59:26 -04:00
|
|
|
/* Restart function and parameter. */
|
2021-02-03 09:02:51 +01:00
|
|
|
__u64 restart_fn; /* 0x0370 */
|
|
|
|
__u64 restart_data; /* 0x0378 */
|
2021-08-24 15:30:21 +02:00
|
|
|
__u32 restart_source; /* 0x0380 */
|
|
|
|
__u32 restart_flags; /* 0x0384 */
|
2009-03-26 15:24:44 +01:00
|
|
|
|
|
|
|
/* Address space pointer. */
|
2023-09-11 21:40:04 +02:00
|
|
|
struct ctlreg kernel_asce; /* 0x0388 */
|
|
|
|
struct ctlreg user_asce; /* 0x0390 */
|
2015-10-06 18:06:15 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The lpp and current_pid fields form a
|
|
|
|
* 64-bit value that is set as program
|
|
|
|
* parameter with the LPP instruction.
|
|
|
|
*/
|
2019-03-06 13:31:21 +02:00
|
|
|
__u32 lpp; /* 0x0398 */
|
|
|
|
__u32 current_pid; /* 0x039c */
|
2009-03-26 15:24:44 +01:00
|
|
|
|
|
|
|
/* SMP info area */
|
2019-03-06 13:31:21 +02:00
|
|
|
__u32 cpu_nr; /* 0x03a0 */
|
|
|
|
__u32 softirq_pending; /* 0x03a4 */
|
2019-04-15 10:35:54 +02:00
|
|
|
__s32 preempt_count; /* 0x03a8 */
|
2019-03-06 13:31:21 +02:00
|
|
|
__u32 spinlock_lockval; /* 0x03ac */
|
|
|
|
__u32 spinlock_index; /* 0x03b0 */
|
2024-02-03 11:45:12 +01:00
|
|
|
__u8 pad_0x03b4[0x03b8-0x03b4]; /* 0x03b4 */
|
2019-03-06 13:31:21 +02:00
|
|
|
__u64 percpu_offset; /* 0x03b8 */
|
2025-03-20 14:49:09 +01:00
|
|
|
__u8 pad_0x03c0[0x0400-0x03c0]; /* 0x03c0 */
|
2018-01-26 12:46:47 +01:00
|
|
|
|
2022-02-24 22:43:31 +01:00
|
|
|
__u32 return_lpswe; /* 0x0400 */
|
|
|
|
__u32 return_mcck_lpswe; /* 0x0404 */
|
|
|
|
__u8 pad_0x040a[0x0e00-0x0408]; /* 0x0408 */
|
2009-03-26 15:24:44 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 0xe00 contains the address of the IPL Parameter Information
|
|
|
|
* block. Dump tools need IPIB for IPL after dump.
|
|
|
|
* Note: do not change the position of any fields in 0x0e00-0x0f00
|
|
|
|
*/
|
|
|
|
__u64 ipib; /* 0x0e00 */
|
|
|
|
__u32 ipib_checksum; /* 0x0e08 */
|
2012-06-05 09:59:52 +02:00
|
|
|
__u64 vmcore_info; /* 0x0e0c */
|
2012-03-11 11:59:34 -04:00
|
|
|
__u8 pad_0x0e14[0x0e18-0x0e14]; /* 0x0e14 */
|
|
|
|
__u64 os_info; /* 0x0e18 */
|
2021-05-05 22:01:10 +02:00
|
|
|
__u8 pad_0x0e20[0x11b0-0x0e20]; /* 0x0e20 */
|
2014-10-06 17:53:53 +02:00
|
|
|
|
2016-01-26 14:10:34 +01:00
|
|
|
/* Pointer to the machine check extended save area */
|
|
|
|
__u64 mcesad; /* 0x11b0 */
|
2009-03-26 15:24:44 +01:00
|
|
|
|
|
|
|
/* 64 bit extparam used for pfault/diag 250: defined by architecture */
|
|
|
|
__u64 ext_params2; /* 0x11B8 */
|
|
|
|
__u8 pad_0x11c0[0x1200-0x11C0]; /* 0x11C0 */
|
|
|
|
|
|
|
|
/* CPU register save area: defined by architecture */
|
|
|
|
__u64 floating_pt_save_area[16]; /* 0x1200 */
|
|
|
|
__u64 gpregs_save_area[16]; /* 0x1280 */
|
2010-02-26 22:37:43 +01:00
|
|
|
psw_t psw_save_area; /* 0x1300 */
|
2009-03-26 15:24:44 +01:00
|
|
|
__u8 pad_0x1310[0x1318-0x1310]; /* 0x1310 */
|
|
|
|
__u32 prefixreg_save_area; /* 0x1318 */
|
|
|
|
__u32 fpt_creg_save_area; /* 0x131c */
|
|
|
|
__u8 pad_0x1320[0x1324-0x1320]; /* 0x1320 */
|
|
|
|
__u32 tod_progreg_save_area; /* 0x1324 */
|
|
|
|
__u32 cpu_timer_save_area[2]; /* 0x1328 */
|
|
|
|
__u32 clock_comp_save_area[2]; /* 0x1330 */
|
2021-04-07 09:20:17 +02:00
|
|
|
__u64 last_break_save_area; /* 0x1338 */
|
2009-03-26 15:24:44 +01:00
|
|
|
__u32 access_regs_save_area[16]; /* 0x1340 */
|
2023-09-11 21:40:04 +02:00
|
|
|
struct ctlreg cregs_save_area[16]; /* 0x1380 */
|
2022-05-04 08:23:51 +02:00
|
|
|
__u8 pad_0x1400[0x1500-0x1400]; /* 0x1400 */
|
|
|
|
/* Cryptography-counter designation */
|
|
|
|
__u64 ccd; /* 0x1500 */
|
2022-06-30 11:53:48 +02:00
|
|
|
/* AI-extension counter designation */
|
|
|
|
__u64 aicd; /* 0x1508 */
|
|
|
|
__u8 pad_0x1510[0x1800-0x1510]; /* 0x1510 */
|
2012-07-31 11:03:04 +02:00
|
|
|
|
|
|
|
/* Transaction abort diagnostic block */
|
2021-05-05 22:01:16 +02:00
|
|
|
struct pgm_tdb pgm_tdb; /* 0x1800 */
|
2016-01-26 14:10:34 +01:00
|
|
|
__u8 pad_0x1900[0x2000-0x1900]; /* 0x1900 */
|
2018-06-28 13:12:27 +02:00
|
|
|
} __packed __aligned(8192);
|
2010-02-26 22:37:43 +01:00
|
|
|
|
2024-06-10 13:45:24 +02:00
|
|
|
static __always_inline struct lowcore *get_lowcore(void)
|
|
|
|
{
|
s390: Add infrastructure to patch lowcore accesses
The s390 architecture defines two special per-CPU data pages
called the "prefix area". In s390-linux terminology this is usually
called "lowcore". This memory area contains system configuration
data like old/new PSW's for system call/interrupt/machine check
handlers and lots of other data. It is normally mapped to logical
address 0. This area can only be accessed when in supervisor mode.
This means that kernel code can dereference NULL pointers, because
accesses to address 0 are allowed. Parts of lowcore can be write
protected, but read accesses and write accesses outside of the write
protected areas are not caught.
To remove this limitation for debugging and testing, remap lowcore to
another address and define a function get_lowcore() which simply
returns the address where lowcore is mapped at. This would normally
introduce a pointer dereference (=memory read). As lowcore is used
for several very often used variables, add code to patch this function
during runtime, so we avoid the memory reads.
For C code get_lowcore() has to be used, for assembly code it is
the GET_LC macro. When using this macro/function a reference is added
to alternative patching. All these locations will be patched to the
actual lowcore location when the kernel is booted or a module is loaded.
To make debugging/bisecting problems easier, this patch adds all the
infrastructure but the lowcore address is still hardwired to 0. This
way the code can be converted on a per function basis, and the
functionality is enabled in a patch after all the functions have
been converted.
Note that this requires at least z16 because the old lpsw instruction
only allowed a 12 bit displacement. z16 introduced lpswey which allows
20 bits (signed), so the lowcore can effectively be mapped from
address 0 - 0x7e000. To use 0x7e000 as address, a 6 byte lgfi
instruction would have to be used in the alternative. To save two
bytes, llilh can be used, but this only allows to set bits 16-31 of
the address. In order to use the llilh instruction, use 0x70000 as
alternative lowcore address. This is still large enough to catch
NULL pointer dereferences into large arrays.
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2024-07-22 15:41:14 +02:00
|
|
|
struct lowcore *lc;
|
|
|
|
|
|
|
|
if (__is_defined(__DECOMPRESSOR))
|
|
|
|
return NULL;
|
2025-03-10 10:33:38 +01:00
|
|
|
asm_inline(
|
2025-03-10 10:33:43 +01:00
|
|
|
ALTERNATIVE(" lghi %[lc],0",
|
2025-03-10 10:33:38 +01:00
|
|
|
" llilh %[lc],%[alt]",
|
|
|
|
ALT_FEATURE(MFEATURE_LOWCORE))
|
|
|
|
: [lc] "=d" (lc)
|
|
|
|
: [alt] "i" (LOWCORE_ALT_ADDRESS >> 16));
|
s390: Add infrastructure to patch lowcore accesses
The s390 architecture defines two special per-CPU data pages
called the "prefix area". In s390-linux terminology this is usually
called "lowcore". This memory area contains system configuration
data like old/new PSW's for system call/interrupt/machine check
handlers and lots of other data. It is normally mapped to logical
address 0. This area can only be accessed when in supervisor mode.
This means that kernel code can dereference NULL pointers, because
accesses to address 0 are allowed. Parts of lowcore can be write
protected, but read accesses and write accesses outside of the write
protected areas are not caught.
To remove this limitation for debugging and testing, remap lowcore to
another address and define a function get_lowcore() which simply
returns the address where lowcore is mapped at. This would normally
introduce a pointer dereference (=memory read). As lowcore is used
for several very often used variables, add code to patch this function
during runtime, so we avoid the memory reads.
For C code get_lowcore() has to be used, for assembly code it is
the GET_LC macro. When using this macro/function a reference is added
to alternative patching. All these locations will be patched to the
actual lowcore location when the kernel is booted or a module is loaded.
To make debugging/bisecting problems easier, this patch adds all the
infrastructure but the lowcore address is still hardwired to 0. This
way the code can be converted on a per function basis, and the
functionality is enabled in a patch after all the functions have
been converted.
Note that this requires at least z16 because the old lpsw instruction
only allowed a 12 bit displacement. z16 introduced lpswey which allows
20 bits (signed), so the lowcore can effectively be mapped from
address 0 - 0x7e000. To use 0x7e000 as address, a 6 byte lgfi
instruction would have to be used in the alternative. To save two
bytes, llilh can be used, but this only allows to set bits 16-31 of
the address. In order to use the llilh instruction, use 0x70000 as
alternative lowcore address. This is still large enough to catch
NULL pointer dereferences into large arrays.
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2024-07-22 15:41:14 +02:00
|
|
|
return lc;
|
2024-06-10 13:45:24 +02:00
|
|
|
}
|
|
|
|
|
2015-12-31 10:29:00 +01:00
|
|
|
extern struct lowcore *lowcore_ptr[];
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2005-11-08 21:34:42 -08:00
|
|
|
static inline void set_prefix(__u32 address)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2017-11-13 16:37:33 +01:00
|
|
|
asm volatile("spx %0" : : "Q" (address) : "memory");
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
2025-06-11 16:00:46 +02:00
|
|
|
#else /* __ASSEMBLER__ */
|
s390: Add infrastructure to patch lowcore accesses
The s390 architecture defines two special per-CPU data pages
called the "prefix area". In s390-linux terminology this is usually
called "lowcore". This memory area contains system configuration
data like old/new PSW's for system call/interrupt/machine check
handlers and lots of other data. It is normally mapped to logical
address 0. This area can only be accessed when in supervisor mode.
This means that kernel code can dereference NULL pointers, because
accesses to address 0 are allowed. Parts of lowcore can be write
protected, but read accesses and write accesses outside of the write
protected areas are not caught.
To remove this limitation for debugging and testing, remap lowcore to
another address and define a function get_lowcore() which simply
returns the address where lowcore is mapped at. This would normally
introduce a pointer dereference (=memory read). As lowcore is used
for several very often used variables, add code to patch this function
during runtime, so we avoid the memory reads.
For C code get_lowcore() has to be used, for assembly code it is
the GET_LC macro. When using this macro/function a reference is added
to alternative patching. All these locations will be patched to the
actual lowcore location when the kernel is booted or a module is loaded.
To make debugging/bisecting problems easier, this patch adds all the
infrastructure but the lowcore address is still hardwired to 0. This
way the code can be converted on a per function basis, and the
functionality is enabled in a patch after all the functions have
been converted.
Note that this requires at least z16 because the old lpsw instruction
only allowed a 12 bit displacement. z16 introduced lpswey which allows
20 bits (signed), so the lowcore can effectively be mapped from
address 0 - 0x7e000. To use 0x7e000 as address, a 6 byte lgfi
instruction would have to be used in the alternative. To save two
bytes, llilh can be used, but this only allows to set bits 16-31 of
the address. In order to use the llilh instruction, use 0x70000 as
alternative lowcore address. This is still large enough to catch
NULL pointer dereferences into large arrays.
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2024-07-22 15:41:14 +02:00
|
|
|
|
|
|
|
.macro GET_LC reg
|
2025-03-10 10:33:43 +01:00
|
|
|
ALTERNATIVE "lghi \reg,0", \
|
s390: Add infrastructure to patch lowcore accesses
The s390 architecture defines two special per-CPU data pages
called the "prefix area". In s390-linux terminology this is usually
called "lowcore". This memory area contains system configuration
data like old/new PSW's for system call/interrupt/machine check
handlers and lots of other data. It is normally mapped to logical
address 0. This area can only be accessed when in supervisor mode.
This means that kernel code can dereference NULL pointers, because
accesses to address 0 are allowed. Parts of lowcore can be write
protected, but read accesses and write accesses outside of the write
protected areas are not caught.
To remove this limitation for debugging and testing, remap lowcore to
another address and define a function get_lowcore() which simply
returns the address where lowcore is mapped at. This would normally
introduce a pointer dereference (=memory read). As lowcore is used
for several very often used variables, add code to patch this function
during runtime, so we avoid the memory reads.
For C code get_lowcore() has to be used, for assembly code it is
the GET_LC macro. When using this macro/function a reference is added
to alternative patching. All these locations will be patched to the
actual lowcore location when the kernel is booted or a module is loaded.
To make debugging/bisecting problems easier, this patch adds all the
infrastructure but the lowcore address is still hardwired to 0. This
way the code can be converted on a per function basis, and the
functionality is enabled in a patch after all the functions have
been converted.
Note that this requires at least z16 because the old lpsw instruction
only allowed a 12 bit displacement. z16 introduced lpswey which allows
20 bits (signed), so the lowcore can effectively be mapped from
address 0 - 0x7e000. To use 0x7e000 as address, a 6 byte lgfi
instruction would have to be used in the alternative. To save two
bytes, llilh can be used, but this only allows to set bits 16-31 of
the address. In order to use the llilh instruction, use 0x70000 as
alternative lowcore address. This is still large enough to catch
NULL pointer dereferences into large arrays.
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2024-07-22 15:41:14 +02:00
|
|
|
__stringify(llilh \reg, LOWCORE_ALT_ADDRESS >> 16), \
|
2025-02-07 15:48:57 +01:00
|
|
|
ALT_FEATURE(MFEATURE_LOWCORE)
|
s390: Add infrastructure to patch lowcore accesses
The s390 architecture defines two special per-CPU data pages
called the "prefix area". In s390-linux terminology this is usually
called "lowcore". This memory area contains system configuration
data like old/new PSW's for system call/interrupt/machine check
handlers and lots of other data. It is normally mapped to logical
address 0. This area can only be accessed when in supervisor mode.
This means that kernel code can dereference NULL pointers, because
accesses to address 0 are allowed. Parts of lowcore can be write
protected, but read accesses and write accesses outside of the write
protected areas are not caught.
To remove this limitation for debugging and testing, remap lowcore to
another address and define a function get_lowcore() which simply
returns the address where lowcore is mapped at. This would normally
introduce a pointer dereference (=memory read). As lowcore is used
for several very often used variables, add code to patch this function
during runtime, so we avoid the memory reads.
For C code get_lowcore() has to be used, for assembly code it is
the GET_LC macro. When using this macro/function a reference is added
to alternative patching. All these locations will be patched to the
actual lowcore location when the kernel is booted or a module is loaded.
To make debugging/bisecting problems easier, this patch adds all the
infrastructure but the lowcore address is still hardwired to 0. This
way the code can be converted on a per function basis, and the
functionality is enabled in a patch after all the functions have
been converted.
Note that this requires at least z16 because the old lpsw instruction
only allowed a 12 bit displacement. z16 introduced lpswey which allows
20 bits (signed), so the lowcore can effectively be mapped from
address 0 - 0x7e000. To use 0x7e000 as address, a 6 byte lgfi
instruction would have to be used in the alternative. To save two
bytes, llilh can be used, but this only allows to set bits 16-31 of
the address. In order to use the llilh instruction, use 0x70000 as
alternative lowcore address. This is still large enough to catch
NULL pointer dereferences into large arrays.
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2024-07-22 15:41:14 +02:00
|
|
|
.endm
|
|
|
|
|
2024-07-22 15:41:20 +02:00
|
|
|
.macro STMG_LC start, end, savearea
|
|
|
|
ALTERNATIVE "stmg \start, \end, \savearea", \
|
|
|
|
__stringify(stmg \start, \end, LOWCORE_ALT_ADDRESS + \savearea), \
|
2025-02-07 15:48:57 +01:00
|
|
|
ALT_FEATURE(MFEATURE_LOWCORE)
|
2024-07-22 15:41:20 +02:00
|
|
|
.endm
|
|
|
|
|
2025-06-11 16:00:46 +02:00
|
|
|
#endif /* __ASSEMBLER__ */
|
2010-02-26 22:37:43 +01:00
|
|
|
#endif /* _ASM_S390_LOWCORE_H */
|