mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 08:58:07 +00:00
b250e6d141
- Add -s option (strict mode) to merge_config.sh to make it fail when any symbol is redefined. - Show a warning if a different compiler is used for building external modules. - Infer --target from ARCH for CC=clang to let you cross-compile the kernel without CROSS_COMPILE. - Make the integrated assembler default (LLVM_IAS=1) for CC=clang. - Add <linux/stdarg.h> to the kernel source instead of borrowing <stdarg.h> from the compiler. - Add Nick Desaulniers as a Kbuild reviewer. - Drop stale cc-option tests. - Fix the combination of CONFIG_TRIM_UNUSED_KSYMS and CONFIG_LTO_CLANG to handle symbols in inline assembly. - Show a warning if 'FORCE' is missing for if_changed rules. - Various cleanups -----BEGIN PGP SIGNATURE----- iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAmExXHoVHG1hc2FoaXJv eUBrZXJuZWwub3JnAAoJED2LAQed4NsGAZwP/iHdEZzuQ4cz2uXUaV0fevj9jjPU zJ8wrrNabAiT6f5x861DsARQSR4OSt3zN0tyBNgZwUdotbe7ED5GegrgIUBMWlML QskhTEIZj7TexAX/20vx671gtzI3JzFg4c9BuriXCFRBvychSevdJPr65gMDOesL vOJnXe+SGXG2+fPWi/PxrcOItNRcveqo2GiWHT3g0Cv/DJUulu81gEkz3hrufnMR cjMeSkV0nJJcvI755OQBOUnEuigW64k4m2WxHPG24tU8cQOCqV6lqwOfNQBAn4+F OoaCMyPQT9gvGYwGExQMCXGg0wbUt1qnxzOVoA2qFCwbo+MFhqjBvPXab6VJm7CE mY3RrTtvxSqBdHI6EGcYeLjhycK9b+LLoJ1qc3S9FK8It6NoFFp4XV0R6ItPBls7 mWi9VSpyI6k0AwLq+bGXEHvaX/bnnf/vfqn8H+w6mRZdXjFV8EB2DiOSRX/OqjVG RnvTtXzWWThLyXvWR3Jox4+7X6728oL7akLemoeZI6oTbJDm7dQgwpz5HbSyHXLh d+gUF3Y/6lqxT5N9GSVDxpD1bEMh2I7nGQ4M7WGbGas/3yUemF8wbBqGQo4a+YeD d9vGAUxDp2PQTtL2sjFo5Gd4PZEM9g7vwWzRvHe0o5NxKEXcBg25b8cD1hxrN9Y4 Y1AAnc0kLO+My3PC =lw3M -----END PGP SIGNATURE----- Merge tag 'kbuild-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild Pull Kbuild updates from Masahiro Yamada: - Add -s option (strict mode) to merge_config.sh to make it fail when any symbol is redefined. - Show a warning if a different compiler is used for building external modules. - Infer --target from ARCH for CC=clang to let you cross-compile the kernel without CROSS_COMPILE. - Make the integrated assembler default (LLVM_IAS=1) for CC=clang. - Add <linux/stdarg.h> to the kernel source instead of borrowing <stdarg.h> from the compiler. - Add Nick Desaulniers as a Kbuild reviewer. - Drop stale cc-option tests. - Fix the combination of CONFIG_TRIM_UNUSED_KSYMS and CONFIG_LTO_CLANG to handle symbols in inline assembly. - Show a warning if 'FORCE' is missing for if_changed rules. - Various cleanups * tag 'kbuild-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (39 commits) kbuild: redo fake deps at include/ksym/*.h kbuild: clean up objtool_args slightly modpost: get the *.mod file path more simply checkkconfigsymbols.py: Fix the '--ignore' option kbuild: merge vmlinux_link() between ARCH=um and other architectures kbuild: do not remove 'linux' link in scripts/link-vmlinux.sh kbuild: merge vmlinux_link() between the ordinary link and Clang LTO kbuild: remove stale *.symversions kbuild: remove unused quiet_cmd_update_lto_symversions gen_compile_commands: extract compiler command from a series of commands x86: remove cc-option-yn test for -mtune= arc: replace cc-option-yn uses with cc-option s390: replace cc-option-yn uses with cc-option ia64: move core-y in arch/ia64/Makefile to arch/ia64/Kbuild sparc: move the install rule to arch/sparc/Makefile security: remove unneeded subdir-$(CONFIG_...) kbuild: sh: remove unused install script kbuild: Fix 'no symbols' warning when CONFIG_TRIM_UNUSD_KSYMS=y kbuild: Switch to 'f' variants of integrated assembler flag kbuild: Shuffle blank line to improve comment meaning ...
180 lines
4.9 KiB
C
180 lines
4.9 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <linux/kernel.h>
|
|
#include <linux/stdarg.h>
|
|
#include <linux/string.h>
|
|
#include <linux/ctype.h>
|
|
#include <asm/stacktrace.h>
|
|
#include <asm/boot_data.h>
|
|
#include <asm/lowcore.h>
|
|
#include <asm/setup.h>
|
|
#include <asm/sclp.h>
|
|
#include <asm/uv.h>
|
|
#include "boot.h"
|
|
|
|
const char hex_asc[] = "0123456789abcdef";
|
|
|
|
static char *as_hex(char *dst, unsigned long val, int pad)
|
|
{
|
|
char *p, *end = p = dst + max(pad, (int)__fls(val | 1) / 4 + 1);
|
|
|
|
for (*p-- = 0; p >= dst; val >>= 4)
|
|
*p-- = hex_asc[val & 0x0f];
|
|
return end;
|
|
}
|
|
|
|
static char *symstart(char *p)
|
|
{
|
|
while (*p)
|
|
p--;
|
|
return p + 1;
|
|
}
|
|
|
|
static noinline char *findsym(unsigned long ip, unsigned short *off, unsigned short *len)
|
|
{
|
|
/* symbol entries are in a form "10000 c4 startup\0" */
|
|
char *a = _decompressor_syms_start;
|
|
char *b = _decompressor_syms_end;
|
|
unsigned long start;
|
|
unsigned long size;
|
|
char *pivot;
|
|
char *endp;
|
|
|
|
while (a < b) {
|
|
pivot = symstart(a + (b - a) / 2);
|
|
start = simple_strtoull(pivot, &endp, 16);
|
|
size = simple_strtoull(endp + 1, &endp, 16);
|
|
if (ip < start) {
|
|
b = pivot;
|
|
continue;
|
|
}
|
|
if (ip > start + size) {
|
|
a = pivot + strlen(pivot) + 1;
|
|
continue;
|
|
}
|
|
*off = ip - start;
|
|
*len = size;
|
|
return endp + 1;
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
static noinline char *strsym(void *ip)
|
|
{
|
|
static char buf[64];
|
|
unsigned short off;
|
|
unsigned short len;
|
|
char *p;
|
|
|
|
p = findsym((unsigned long)ip, &off, &len);
|
|
if (p) {
|
|
strncpy(buf, p, sizeof(buf));
|
|
/* reserve 15 bytes for offset/len in symbol+0x1234/0x1234 */
|
|
p = buf + strnlen(buf, sizeof(buf) - 15);
|
|
strcpy(p, "+0x");
|
|
p = as_hex(p + 3, off, 0);
|
|
strcpy(p, "/0x");
|
|
as_hex(p + 3, len, 0);
|
|
} else {
|
|
as_hex(buf, (unsigned long)ip, 16);
|
|
}
|
|
return buf;
|
|
}
|
|
|
|
void decompressor_printk(const char *fmt, ...)
|
|
{
|
|
char buf[1024] = { 0 };
|
|
char *end = buf + sizeof(buf) - 1; /* make sure buf is 0 terminated */
|
|
unsigned long pad;
|
|
char *p = buf;
|
|
va_list args;
|
|
|
|
va_start(args, fmt);
|
|
for (; p < end && *fmt; fmt++) {
|
|
if (*fmt != '%') {
|
|
*p++ = *fmt;
|
|
continue;
|
|
}
|
|
pad = isdigit(*++fmt) ? simple_strtol(fmt, (char **)&fmt, 10) : 0;
|
|
switch (*fmt) {
|
|
case 's':
|
|
p = buf + strlcat(buf, va_arg(args, char *), sizeof(buf));
|
|
break;
|
|
case 'p':
|
|
if (*++fmt != 'S')
|
|
goto out;
|
|
p = buf + strlcat(buf, strsym(va_arg(args, void *)), sizeof(buf));
|
|
break;
|
|
case 'l':
|
|
if (*++fmt != 'x' || end - p <= max(sizeof(long) * 2, pad))
|
|
goto out;
|
|
p = as_hex(p, va_arg(args, unsigned long), pad);
|
|
break;
|
|
case 'x':
|
|
if (end - p <= max(sizeof(int) * 2, pad))
|
|
goto out;
|
|
p = as_hex(p, va_arg(args, unsigned int), pad);
|
|
break;
|
|
default:
|
|
goto out;
|
|
}
|
|
}
|
|
out:
|
|
va_end(args);
|
|
sclp_early_printk(buf);
|
|
}
|
|
|
|
static noinline void print_stacktrace(void)
|
|
{
|
|
struct stack_info boot_stack = { STACK_TYPE_TASK, (unsigned long)_stack_start,
|
|
(unsigned long)_stack_end };
|
|
unsigned long sp = S390_lowcore.gpregs_save_area[15];
|
|
bool first = true;
|
|
|
|
decompressor_printk("Call Trace:\n");
|
|
while (!(sp & 0x7) && on_stack(&boot_stack, sp, sizeof(struct stack_frame))) {
|
|
struct stack_frame *sf = (struct stack_frame *)sp;
|
|
|
|
decompressor_printk(first ? "(sp:%016lx [<%016lx>] %pS)\n" :
|
|
" sp:%016lx [<%016lx>] %pS\n",
|
|
sp, sf->gprs[8], (void *)sf->gprs[8]);
|
|
if (sf->back_chain <= sp)
|
|
break;
|
|
sp = sf->back_chain;
|
|
first = false;
|
|
}
|
|
}
|
|
|
|
void print_pgm_check_info(void)
|
|
{
|
|
unsigned long *gpregs = (unsigned long *)S390_lowcore.gpregs_save_area;
|
|
struct psw_bits *psw = &psw_bits(S390_lowcore.psw_save_area);
|
|
|
|
decompressor_printk("Linux version %s\n", kernel_version);
|
|
if (!is_prot_virt_guest() && early_command_line[0])
|
|
decompressor_printk("Kernel command line: %s\n", early_command_line);
|
|
decompressor_printk("Kernel fault: interruption code %04x ilc:%x\n",
|
|
S390_lowcore.pgm_code, S390_lowcore.pgm_ilc >> 1);
|
|
if (kaslr_enabled)
|
|
decompressor_printk("Kernel random base: %lx\n", __kaslr_offset);
|
|
decompressor_printk("PSW : %016lx %016lx (%pS)\n",
|
|
S390_lowcore.psw_save_area.mask,
|
|
S390_lowcore.psw_save_area.addr,
|
|
(void *)S390_lowcore.psw_save_area.addr);
|
|
decompressor_printk(
|
|
" R:%x T:%x IO:%x EX:%x Key:%x M:%x W:%x P:%x AS:%x CC:%x PM:%x RI:%x EA:%x\n",
|
|
psw->per, psw->dat, psw->io, psw->ext, psw->key, psw->mcheck,
|
|
psw->wait, psw->pstate, psw->as, psw->cc, psw->pm, psw->ri,
|
|
psw->eaba);
|
|
decompressor_printk("GPRS: %016lx %016lx %016lx %016lx\n",
|
|
gpregs[0], gpregs[1], gpregs[2], gpregs[3]);
|
|
decompressor_printk(" %016lx %016lx %016lx %016lx\n",
|
|
gpregs[4], gpregs[5], gpregs[6], gpregs[7]);
|
|
decompressor_printk(" %016lx %016lx %016lx %016lx\n",
|
|
gpregs[8], gpregs[9], gpregs[10], gpregs[11]);
|
|
decompressor_printk(" %016lx %016lx %016lx %016lx\n",
|
|
gpregs[12], gpregs[13], gpregs[14], gpregs[15]);
|
|
print_stacktrace();
|
|
decompressor_printk("Last Breaking-Event-Address:\n");
|
|
decompressor_printk(" [<%016lx>] %pS\n", (unsigned long)S390_lowcore.breaking_event_addr,
|
|
(void *)S390_lowcore.breaking_event_addr);
|
|
}
|