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 10:07:57 -04:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2020-09-07 11:20:05 -04:00
|
|
|
#include <linux/set_memory.h>
|
2020-09-04 11:41:27 -04:00
|
|
|
#include <linux/ptdump.h>
|
2012-10-04 08:46:12 -04:00
|
|
|
#include <linux/seq_file.h>
|
|
|
|
#include <linux/debugfs.h>
|
|
|
|
#include <linux/mm.h>
|
2021-07-28 15:02:54 -04:00
|
|
|
#include <linux/kfence.h>
|
2017-11-17 11:59:53 -05:00
|
|
|
#include <linux/kasan.h>
|
2017-11-17 11:40:16 -05:00
|
|
|
#include <asm/kasan.h>
|
2022-07-20 02:32:13 -04:00
|
|
|
#include <asm/abs_lowcore.h>
|
2021-04-07 03:20:17 -04:00
|
|
|
#include <asm/nospec-branch.h>
|
2012-10-04 08:46:12 -04:00
|
|
|
#include <asm/sections.h>
|
2022-09-04 04:32:32 -04:00
|
|
|
#include <asm/maccess.h>
|
2012-10-04 08:46:12 -04:00
|
|
|
|
|
|
|
static unsigned long max_addr;
|
|
|
|
|
|
|
|
struct addr_marker {
|
|
|
|
unsigned long start_address;
|
|
|
|
const char *name;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum address_markers_idx {
|
2020-09-11 06:51:59 -04:00
|
|
|
IDENTITY_BEFORE_NR = 0,
|
|
|
|
IDENTITY_BEFORE_END_NR,
|
2022-09-05 08:36:19 -04:00
|
|
|
AMODE31_START_NR,
|
|
|
|
AMODE31_END_NR,
|
2012-10-04 08:46:12 -04:00
|
|
|
KERNEL_START_NR,
|
|
|
|
KERNEL_END_NR,
|
2021-07-28 15:02:54 -04:00
|
|
|
#ifdef CONFIG_KFENCE
|
|
|
|
KFENCE_START_NR,
|
|
|
|
KFENCE_END_NR,
|
|
|
|
#endif
|
2020-09-11 06:51:59 -04:00
|
|
|
IDENTITY_AFTER_NR,
|
|
|
|
IDENTITY_AFTER_END_NR,
|
2012-10-04 08:46:12 -04:00
|
|
|
VMEMMAP_NR,
|
2020-09-11 06:51:59 -04:00
|
|
|
VMEMMAP_END_NR,
|
2012-10-04 08:46:12 -04:00
|
|
|
VMALLOC_NR,
|
2020-09-11 06:51:59 -04:00
|
|
|
VMALLOC_END_NR,
|
2012-10-05 10:52:18 -04:00
|
|
|
MODULES_NR,
|
2020-09-11 06:51:59 -04:00
|
|
|
MODULES_END_NR,
|
2022-07-20 02:32:13 -04:00
|
|
|
ABS_LOWCORE_NR,
|
|
|
|
ABS_LOWCORE_END_NR,
|
2022-09-04 04:32:32 -04:00
|
|
|
MEMCPY_REAL_NR,
|
|
|
|
MEMCPY_REAL_END_NR,
|
2023-01-24 12:08:38 -05:00
|
|
|
#ifdef CONFIG_KASAN
|
|
|
|
KASAN_SHADOW_START_NR,
|
|
|
|
KASAN_SHADOW_END_NR,
|
|
|
|
#endif
|
2012-10-04 08:46:12 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct addr_marker address_markers[] = {
|
2020-09-11 06:51:59 -04:00
|
|
|
[IDENTITY_BEFORE_NR] = {0, "Identity Mapping Start"},
|
|
|
|
[IDENTITY_BEFORE_END_NR] = {(unsigned long)_stext, "Identity Mapping End"},
|
2022-09-05 08:36:19 -04:00
|
|
|
[AMODE31_START_NR] = {0, "Amode31 Area Start"},
|
|
|
|
[AMODE31_END_NR] = {0, "Amode31 Area End"},
|
2017-11-17 11:40:16 -05:00
|
|
|
[KERNEL_START_NR] = {(unsigned long)_stext, "Kernel Image Start"},
|
|
|
|
[KERNEL_END_NR] = {(unsigned long)_end, "Kernel Image End"},
|
2021-07-28 15:02:54 -04:00
|
|
|
#ifdef CONFIG_KFENCE
|
|
|
|
[KFENCE_START_NR] = {0, "KFence Pool Start"},
|
|
|
|
[KFENCE_END_NR] = {0, "KFence Pool End"},
|
|
|
|
#endif
|
2020-09-11 06:51:59 -04:00
|
|
|
[IDENTITY_AFTER_NR] = {(unsigned long)_end, "Identity Mapping Start"},
|
|
|
|
[IDENTITY_AFTER_END_NR] = {0, "Identity Mapping End"},
|
|
|
|
[VMEMMAP_NR] = {0, "vmemmap Area Start"},
|
|
|
|
[VMEMMAP_END_NR] = {0, "vmemmap Area End"},
|
|
|
|
[VMALLOC_NR] = {0, "vmalloc Area Start"},
|
|
|
|
[VMALLOC_END_NR] = {0, "vmalloc Area End"},
|
|
|
|
[MODULES_NR] = {0, "Modules Area Start"},
|
|
|
|
[MODULES_END_NR] = {0, "Modules Area End"},
|
2022-07-20 02:32:13 -04:00
|
|
|
[ABS_LOWCORE_NR] = {0, "Lowcore Area Start"},
|
|
|
|
[ABS_LOWCORE_END_NR] = {0, "Lowcore Area End"},
|
2022-09-04 04:32:32 -04:00
|
|
|
[MEMCPY_REAL_NR] = {0, "Real Memory Copy Area Start"},
|
|
|
|
[MEMCPY_REAL_END_NR] = {0, "Real Memory Copy Area End"},
|
2023-01-24 12:08:38 -05:00
|
|
|
#ifdef CONFIG_KASAN
|
|
|
|
[KASAN_SHADOW_START_NR] = {KASAN_SHADOW_START, "Kasan Shadow Start"},
|
|
|
|
[KASAN_SHADOW_END_NR] = {KASAN_SHADOW_END, "Kasan Shadow End"},
|
|
|
|
#endif
|
2012-10-04 08:46:12 -04:00
|
|
|
{ -1, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pg_state {
|
2020-09-04 11:41:27 -04:00
|
|
|
struct ptdump_state ptdump;
|
|
|
|
struct seq_file *seq;
|
2012-10-04 08:46:12 -04:00
|
|
|
int level;
|
|
|
|
unsigned int current_prot;
|
2020-09-09 11:10:29 -04:00
|
|
|
bool check_wx;
|
|
|
|
unsigned long wx_pages;
|
2012-10-04 08:46:12 -04:00
|
|
|
unsigned long start_address;
|
|
|
|
const struct addr_marker *marker;
|
|
|
|
};
|
|
|
|
|
2020-09-09 05:14:52 -04:00
|
|
|
#define pt_dump_seq_printf(m, fmt, args...) \
|
|
|
|
({ \
|
|
|
|
struct seq_file *__m = (m); \
|
|
|
|
\
|
|
|
|
if (__m) \
|
|
|
|
seq_printf(__m, fmt, ##args); \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define pt_dump_seq_puts(m, fmt) \
|
|
|
|
({ \
|
|
|
|
struct seq_file *__m = (m); \
|
|
|
|
\
|
|
|
|
if (__m) \
|
|
|
|
seq_printf(__m, fmt); \
|
|
|
|
})
|
|
|
|
|
2012-10-04 08:46:12 -04:00
|
|
|
static void print_prot(struct seq_file *m, unsigned int pr, int level)
|
|
|
|
{
|
|
|
|
static const char * const level_name[] =
|
|
|
|
{ "ASCE", "PGD", "PUD", "PMD", "PTE" };
|
|
|
|
|
2020-09-09 05:14:52 -04:00
|
|
|
pt_dump_seq_printf(m, "%s ", level_name[level]);
|
2013-02-16 05:47:27 -05:00
|
|
|
if (pr & _PAGE_INVALID) {
|
2020-09-09 05:14:52 -04:00
|
|
|
pt_dump_seq_printf(m, "I\n");
|
2013-02-16 05:47:27 -05:00
|
|
|
return;
|
|
|
|
}
|
2020-09-09 05:14:52 -04:00
|
|
|
pt_dump_seq_puts(m, (pr & _PAGE_PROTECT) ? "RO " : "RW ");
|
|
|
|
pt_dump_seq_puts(m, (pr & _PAGE_NOEXEC) ? "NX\n" : "X\n");
|
2012-10-04 08:46:12 -04:00
|
|
|
}
|
|
|
|
|
2020-09-09 11:10:29 -04:00
|
|
|
static void note_prot_wx(struct pg_state *st, unsigned long addr)
|
|
|
|
{
|
|
|
|
if (!st->check_wx)
|
|
|
|
return;
|
|
|
|
if (st->current_prot & _PAGE_INVALID)
|
|
|
|
return;
|
|
|
|
if (st->current_prot & _PAGE_PROTECT)
|
|
|
|
return;
|
|
|
|
if (st->current_prot & _PAGE_NOEXEC)
|
|
|
|
return;
|
2021-04-07 03:20:17 -04:00
|
|
|
/*
|
|
|
|
* The first lowcore page is W+X if spectre mitigations are using
|
|
|
|
* trampolines or the BEAR enhancements facility is not installed,
|
|
|
|
* in which case we have two lpswe instructions in lowcore that need
|
|
|
|
* to be executable.
|
|
|
|
*/
|
|
|
|
if (addr == PAGE_SIZE && (nospec_uses_trampoline() || !static_key_enabled(&cpu_has_bear)))
|
2020-09-09 11:10:29 -04:00
|
|
|
return;
|
2024-01-30 05:34:34 -05:00
|
|
|
WARN_ONCE(IS_ENABLED(CONFIG_DEBUG_WX),
|
|
|
|
"s390/mm: Found insecure W+X mapping at address %pS\n",
|
2020-09-09 11:10:29 -04:00
|
|
|
(void *)st->start_address);
|
|
|
|
st->wx_pages += (addr - st->start_address) / PAGE_SIZE;
|
|
|
|
}
|
|
|
|
|
2020-09-04 11:41:27 -04:00
|
|
|
static void note_page(struct ptdump_state *pt_st, unsigned long addr, int level, u64 val)
|
2012-10-04 08:46:12 -04:00
|
|
|
{
|
|
|
|
int width = sizeof(unsigned long) * 2;
|
2020-09-04 11:41:27 -04:00
|
|
|
static const char units[] = "KMGTPE";
|
2012-10-04 08:46:12 -04:00
|
|
|
const char *unit = units;
|
|
|
|
unsigned long delta;
|
2020-09-04 11:41:27 -04:00
|
|
|
struct pg_state *st;
|
|
|
|
struct seq_file *m;
|
|
|
|
unsigned int prot;
|
2012-10-04 08:46:12 -04:00
|
|
|
|
2020-09-04 11:41:27 -04:00
|
|
|
st = container_of(pt_st, struct pg_state, ptdump);
|
|
|
|
m = st->seq;
|
|
|
|
prot = val & (_PAGE_PROTECT | _PAGE_NOEXEC);
|
|
|
|
if (level == 4 && (val & _PAGE_INVALID))
|
|
|
|
prot = _PAGE_INVALID;
|
|
|
|
/* For pmd_none() & friends val gets passed as zero. */
|
|
|
|
if (level != 4 && !val)
|
|
|
|
prot = _PAGE_INVALID;
|
|
|
|
/* Final flush from generic code. */
|
|
|
|
if (level == -1)
|
|
|
|
addr = max_addr;
|
|
|
|
if (st->level == -1) {
|
2020-09-09 05:14:52 -04:00
|
|
|
pt_dump_seq_printf(m, "---[ %s ]---\n", st->marker->name);
|
2020-09-04 11:41:27 -04:00
|
|
|
st->start_address = addr;
|
|
|
|
st->current_prot = prot;
|
|
|
|
st->level = level;
|
|
|
|
} else if (prot != st->current_prot || level != st->level ||
|
|
|
|
addr >= st->marker[1].start_address) {
|
2020-09-09 11:10:29 -04:00
|
|
|
note_prot_wx(st, addr);
|
2020-09-09 05:14:52 -04:00
|
|
|
pt_dump_seq_printf(m, "0x%0*lx-0x%0*lx ",
|
|
|
|
width, st->start_address,
|
|
|
|
width, addr);
|
2020-09-04 11:41:27 -04:00
|
|
|
delta = (addr - st->start_address) >> 10;
|
2012-10-04 08:46:12 -04:00
|
|
|
while (!(delta & 0x3ff) && unit[1]) {
|
|
|
|
delta >>= 10;
|
|
|
|
unit++;
|
|
|
|
}
|
2020-09-09 05:14:52 -04:00
|
|
|
pt_dump_seq_printf(m, "%9lu%c ", delta, *unit);
|
2012-10-04 08:46:12 -04:00
|
|
|
print_prot(m, st->current_prot, st->level);
|
2020-09-04 11:41:27 -04:00
|
|
|
while (addr >= st->marker[1].start_address) {
|
2012-10-04 08:46:12 -04:00
|
|
|
st->marker++;
|
2020-09-09 05:14:52 -04:00
|
|
|
pt_dump_seq_printf(m, "---[ %s ]---\n", st->marker->name);
|
2012-10-04 08:46:12 -04:00
|
|
|
}
|
2020-09-04 11:41:27 -04:00
|
|
|
st->start_address = addr;
|
|
|
|
st->current_prot = prot;
|
2012-10-04 08:46:12 -04:00
|
|
|
st->level = level;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-30 05:34:35 -05:00
|
|
|
bool ptdump_check_wx(void)
|
2020-09-09 11:10:29 -04:00
|
|
|
{
|
|
|
|
struct pg_state st = {
|
|
|
|
.ptdump = {
|
|
|
|
.note_page = note_page,
|
|
|
|
.range = (struct ptdump_range[]) {
|
|
|
|
{.start = 0, .end = max_addr},
|
|
|
|
{.start = 0, .end = 0},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.seq = NULL,
|
|
|
|
.level = -1,
|
|
|
|
.current_prot = 0,
|
|
|
|
.check_wx = true,
|
|
|
|
.wx_pages = 0,
|
|
|
|
.start_address = 0,
|
|
|
|
.marker = (struct addr_marker[]) {
|
|
|
|
{ .start_address = 0, .name = NULL},
|
|
|
|
{ .start_address = -1, .name = NULL},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
if (!MACHINE_HAS_NX)
|
2024-01-30 05:34:35 -05:00
|
|
|
return true;
|
2020-09-09 11:10:29 -04:00
|
|
|
ptdump_walk_pgd(&st.ptdump, &init_mm, NULL);
|
2024-01-30 05:34:35 -05:00
|
|
|
if (st.wx_pages) {
|
2020-09-09 11:10:29 -04:00
|
|
|
pr_warn("Checked W+X mappings: FAILED, %lu W+X pages found\n", st.wx_pages);
|
2024-01-30 05:34:35 -05:00
|
|
|
|
|
|
|
return false;
|
|
|
|
} else {
|
2021-04-07 03:20:17 -04:00
|
|
|
pr_info("Checked W+X mappings: passed, no %sW+X pages found\n",
|
|
|
|
(nospec_uses_trampoline() || !static_key_enabled(&cpu_has_bear)) ?
|
|
|
|
"unexpected " : "");
|
2024-01-30 05:34:35 -05:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2020-09-09 11:10:29 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_PTDUMP_DEBUGFS
|
2012-10-04 08:46:12 -04:00
|
|
|
static int ptdump_show(struct seq_file *m, void *v)
|
|
|
|
{
|
2020-09-04 11:41:27 -04:00
|
|
|
struct pg_state st = {
|
|
|
|
.ptdump = {
|
|
|
|
.note_page = note_page,
|
|
|
|
.range = (struct ptdump_range[]) {
|
|
|
|
{.start = 0, .end = max_addr},
|
|
|
|
{.start = 0, .end = 0},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
.seq = m,
|
|
|
|
.level = -1,
|
|
|
|
.current_prot = 0,
|
2020-09-09 11:10:29 -04:00
|
|
|
.check_wx = false,
|
|
|
|
.wx_pages = 0,
|
2020-09-04 11:41:27 -04:00
|
|
|
.start_address = 0,
|
|
|
|
.marker = address_markers,
|
|
|
|
};
|
|
|
|
|
2020-09-07 11:11:36 -04:00
|
|
|
get_online_mems();
|
2020-09-07 11:20:05 -04:00
|
|
|
mutex_lock(&cpa_mutex);
|
2020-09-04 11:41:27 -04:00
|
|
|
ptdump_walk_pgd(&st.ptdump, &init_mm, NULL);
|
2020-09-07 11:20:05 -04:00
|
|
|
mutex_unlock(&cpa_mutex);
|
2020-09-07 11:11:36 -04:00
|
|
|
put_online_mems();
|
2012-10-04 08:46:12 -04:00
|
|
|
return 0;
|
|
|
|
}
|
2020-09-04 11:41:27 -04:00
|
|
|
DEFINE_SHOW_ATTRIBUTE(ptdump);
|
2020-09-09 11:10:29 -04:00
|
|
|
#endif /* CONFIG_PTDUMP_DEBUGFS */
|
2012-10-04 08:46:12 -04:00
|
|
|
|
2020-09-10 16:51:17 -04:00
|
|
|
/*
|
|
|
|
* Heapsort from lib/sort.c is not a stable sorting algorithm, do a simple
|
|
|
|
* insertion sort to preserve the original order of markers with the same
|
|
|
|
* start address.
|
|
|
|
*/
|
|
|
|
static void sort_address_markers(void)
|
|
|
|
{
|
|
|
|
struct addr_marker tmp;
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
for (i = 1; i < ARRAY_SIZE(address_markers) - 1; i++) {
|
|
|
|
tmp = address_markers[i];
|
|
|
|
for (j = i - 1; j >= 0 && address_markers[j].start_address > tmp.start_address; j--)
|
|
|
|
address_markers[j + 1] = address_markers[j];
|
|
|
|
address_markers[j + 1] = tmp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-04 08:46:12 -04:00
|
|
|
static int pt_dump_init(void)
|
|
|
|
{
|
2021-07-28 15:02:54 -04:00
|
|
|
#ifdef CONFIG_KFENCE
|
|
|
|
unsigned long kfence_start = (unsigned long)__kfence_pool;
|
|
|
|
#endif
|
2012-10-04 08:46:12 -04:00
|
|
|
/*
|
|
|
|
* Figure out the maximum virtual address being accessible with the
|
|
|
|
* kernel ASCE. We need this to keep the page table walker functions
|
|
|
|
* from accessing non-existent entries.
|
|
|
|
*/
|
2023-09-11 15:40:04 -04:00
|
|
|
max_addr = (S390_lowcore.kernel_asce.val & _REGION_ENTRY_TYPE_MASK) >> 2;
|
2012-10-04 08:46:12 -04:00
|
|
|
max_addr = 1UL << (max_addr * 11 + 31);
|
2020-10-19 05:01:33 -04:00
|
|
|
address_markers[IDENTITY_AFTER_END_NR].start_address = ident_map_size;
|
2023-08-25 08:29:49 -04:00
|
|
|
address_markers[AMODE31_START_NR].start_address = (unsigned long)__samode31;
|
|
|
|
address_markers[AMODE31_END_NR].start_address = (unsigned long)__eamode31;
|
2012-10-05 10:52:18 -04:00
|
|
|
address_markers[MODULES_NR].start_address = MODULES_VADDR;
|
2020-09-11 06:51:59 -04:00
|
|
|
address_markers[MODULES_END_NR].start_address = MODULES_END;
|
2022-07-20 02:32:13 -04:00
|
|
|
address_markers[ABS_LOWCORE_NR].start_address = __abs_lowcore;
|
|
|
|
address_markers[ABS_LOWCORE_END_NR].start_address = __abs_lowcore + ABS_LOWCORE_MAP_SIZE;
|
2022-09-04 04:32:32 -04:00
|
|
|
address_markers[MEMCPY_REAL_NR].start_address = __memcpy_real_area;
|
2023-08-04 09:39:06 -04:00
|
|
|
address_markers[MEMCPY_REAL_END_NR].start_address = __memcpy_real_area + MEMCPY_REAL_SIZE;
|
2012-10-04 08:46:12 -04:00
|
|
|
address_markers[VMEMMAP_NR].start_address = (unsigned long) vmemmap;
|
2020-09-11 06:51:59 -04:00
|
|
|
address_markers[VMEMMAP_END_NR].start_address = (unsigned long)vmemmap + vmemmap_size;
|
2012-10-04 08:46:12 -04:00
|
|
|
address_markers[VMALLOC_NR].start_address = VMALLOC_START;
|
2020-09-11 06:51:59 -04:00
|
|
|
address_markers[VMALLOC_END_NR].start_address = VMALLOC_END;
|
2021-07-28 15:02:54 -04:00
|
|
|
#ifdef CONFIG_KFENCE
|
|
|
|
address_markers[KFENCE_START_NR].start_address = kfence_start;
|
|
|
|
address_markers[KFENCE_END_NR].start_address = kfence_start + KFENCE_POOL_SIZE;
|
|
|
|
#endif
|
2020-09-10 16:51:17 -04:00
|
|
|
sort_address_markers();
|
2020-09-15 06:52:36 -04:00
|
|
|
#ifdef CONFIG_PTDUMP_DEBUGFS
|
|
|
|
debugfs_create_file("kernel_page_tables", 0400, NULL, NULL, &ptdump_fops);
|
|
|
|
#endif /* CONFIG_PTDUMP_DEBUGFS */
|
2012-10-04 08:46:12 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
device_initcall(pt_dump_init);
|