Skip to content

Commit

Permalink
Merge branch 'upstream-linux-4.14.y' of https://android.googlesource.…
Browse files Browse the repository at this point in the history
…com/kernel/common into VantomKernel
  • Loading branch information
vantoman committed Feb 20, 2023
2 parents 71a4f07 + a8ad60f commit 19cbf1c
Show file tree
Hide file tree
Showing 114 changed files with 566 additions and 244 deletions.
6 changes: 6 additions & 0 deletions Documentation/ABI/testing/sysfs-kernel-oops_count
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
What: /sys/kernel/oops_count
Date: November 2022
KernelVersion: 6.2.0
Contact: Linux Kernel Hardening List <[email protected]>
Description:
Shows how many times the system has Oopsed since last boot.
6 changes: 6 additions & 0 deletions Documentation/ABI/testing/sysfs-kernel-warn_count
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
What: /sys/kernel/warn_count
Date: November 2022
KernelVersion: 6.2.0
Contact: Linux Kernel Hardening List <[email protected]>
Description:
Shows how many times the system has Warned since last boot.
20 changes: 20 additions & 0 deletions Documentation/sysctl/kernel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ show up in /proc/sys/kernel:
- msgmnb
- msgmni
- nmi_watchdog
- oops_limit
- osrelease
- ostype
- overflowgid
Expand Down Expand Up @@ -95,6 +96,7 @@ show up in /proc/sys/kernel:
- threads-max
- unprivileged_bpf_disabled
- unknown_nmi_panic
- warn_limit
- watchdog
- watchdog_thresh
- version
Expand Down Expand Up @@ -540,6 +542,15 @@ scanned for a given scan.

==============================================================

oops_limit:

Number of kernel oopses after which the kernel should panic when
``panic_on_oops`` is not set. Setting this to 0 disables checking
the count. Setting this to 1 has the same effect as setting
``panic_on_oops=1``. The default value is 10000.

==============================================================

osrelease, ostype & version:

# cat osrelease
Expand Down Expand Up @@ -1087,6 +1098,15 @@ example. If a system hangs up, try pressing the NMI switch.

==============================================================

warn_limit:

Number of kernel warnings after which the kernel should panic when
``panic_on_warn`` is not set. Setting this to 0 disables checking
the warning count. Setting this to 1 has the same effect as setting
``panic_on_warn=1``. The default value is 0.

==============================================================

watchdog:

This parameter can be used to disable or enable the soft lockup detector
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
VERSION = 4
PATCHLEVEL = 14
SUBLEVEL = 303
SUBLEVEL = 305
EXTRAVERSION =
NAME = Petit Gorille

Expand Down
6 changes: 3 additions & 3 deletions arch/alpha/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ die_if_kernel(char * str, struct pt_regs *regs, long err, unsigned long *r9_15)
local_irq_enable();
while (1);
}
do_exit(SIGSEGV);
make_task_dead(SIGSEGV);
}

#ifndef CONFIG_MATHEMU
Expand Down Expand Up @@ -609,7 +609,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg,

printk("Bad unaligned kernel access at %016lx: %p %lx %lu\n",
pc, va, opcode, reg);
do_exit(SIGSEGV);
make_task_dead(SIGSEGV);

got_exception:
/* Ok, we caught the exception, but we don't want it. Is there
Expand Down Expand Up @@ -664,7 +664,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg,
local_irq_enable();
while (1);
}
do_exit(SIGSEGV);
make_task_dead(SIGSEGV);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion arch/alpha/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
printk(KERN_ALERT "Unable to handle kernel paging request at "
"virtual address %016lx\n", address);
die_if_kernel("Oops", regs, cause, (unsigned long*)regs - 16);
do_exit(SIGKILL);
make_task_dead(SIGKILL);

/* We ran out of memory, or some other thing happened to us that
made us unable to handle the page fault gracefully. */
Expand Down
1 change: 0 additions & 1 deletion arch/arm/boot/dts/imx6qdl-gw560x.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@
&uart1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart1>;
uart-has-rtscts;
rts-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>;
status = "okay";
};
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ static void oops_end(unsigned long flags, struct pt_regs *regs, int signr)
if (panic_on_oops)
panic("Fatal exception");
if (signr)
do_exit(signr);
make_task_dead(signr);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
show_pte(mm, addr);
die("Oops", regs, fsr);
bust_spinlocks(0);
do_exit(SIGKILL);
make_task_dead(SIGKILL);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mm/nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ void __init paging_init(const struct machine_desc *mdesc)
mpu_setup();

/* allocate the zero page. */
zero_page = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
zero_page = (void *)memblock_alloc(PAGE_SIZE, PAGE_SIZE);
if (!zero_page)
panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
__func__, PAGE_SIZE, PAGE_SIZE);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ void die(const char *str, struct pt_regs *regs, int err)
raw_spin_unlock_irqrestore(&die_lock, flags);

if (ret != NOTIFY_STOP)
do_exit(SIGSEGV);
make_task_dead(SIGSEGV);
}

void arm64_notify_die(const char *str, struct pt_regs *regs,
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ static void __do_kernel_fault(unsigned long addr, unsigned int esr,
show_pte(addr);
die("Oops", regs, esr);
bust_spinlocks(0);
do_exit(SIGKILL);
make_task_dead(SIGKILL);
}

/*
Expand Down
3 changes: 2 additions & 1 deletion arch/h8300/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/sched/debug.h>
#include <linux/sched/task.h>
#include <linux/mm_types.h>
#include <linux/kernel.h>
#include <linux/errno.h>
Expand Down Expand Up @@ -110,7 +111,7 @@ void die(const char *str, struct pt_regs *fp, unsigned long err)
dump(fp);

spin_unlock_irq(&die_lock);
do_exit(SIGSEGV);
make_task_dead(SIGSEGV);
}

static int kstack_depth_to_print = 24;
Expand Down
2 changes: 1 addition & 1 deletion arch/h8300/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
printk(" at virtual address %08lx\n", address);
if (!user_mode(regs))
die("Oops", regs, error_code);
do_exit(SIGKILL);
make_task_dead(SIGKILL);

return 1;
}
2 changes: 1 addition & 1 deletion arch/hexagon/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ int die(const char *str, struct pt_regs *regs, long err)
panic("Fatal exception");

oops_exit();
do_exit(err);
make_task_dead(err);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ config ARCH_PROC_KCORE_TEXT
depends on PROC_KCORE

config IA64_MCA_RECOVERY
tristate "MCA recovery from errors other than TLB."
bool "MCA recovery from errors other than TLB."

config PERFMON
bool "Performance monitor support"
Expand Down
3 changes: 2 additions & 1 deletion arch/ia64/kernel/mca_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <linux/types.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/sched/task.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/kallsyms.h>
Expand Down Expand Up @@ -176,7 +177,7 @@ mca_handler_bh(unsigned long paddr, void *iip, unsigned long ipsr)
spin_unlock(&mca_bh_lock);

/* This process is about to be killed itself */
do_exit(SIGKILL);
make_task_dead(SIGKILL);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ die (const char *str, struct pt_regs *regs, long err)
if (panic_on_oops)
panic("Fatal exception");

do_exit(SIGSEGV);
make_task_dead(SIGSEGV);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
regs = NULL;
bust_spinlocks(0);
if (regs)
do_exit(SIGKILL);
make_task_dead(SIGKILL);
return;

out_of_memory:
Expand Down
2 changes: 1 addition & 1 deletion arch/m68k/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ void die_if_kernel (char *str, struct pt_regs *fp, int nr)
pr_crit("%s: %08x\n", str, nr);
show_registers(fp);
add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
do_exit(SIGSEGV);
make_task_dead(SIGSEGV);
}

asmlinkage void set_esp0(unsigned long ssp)
Expand Down
2 changes: 1 addition & 1 deletion arch/m68k/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int send_fault_sig(struct pt_regs *regs)
pr_alert("Unable to handle kernel access");
pr_cont(" at virtual address %p\n", siginfo.si_addr);
die_if_kernel("Oops", regs, 0 /*error_code*/);
do_exit(SIGKILL);
make_task_dead(SIGKILL);
}

return 1;
Expand Down
4 changes: 2 additions & 2 deletions arch/microblaze/kernel/exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ void die(const char *str, struct pt_regs *fp, long err)
pr_warn("Oops: %s, sig: %ld\n", str, err);
show_regs(fp);
spin_unlock_irq(&die_lock);
/* do_exit() should take care of panic'ing from an interrupt
/* make_task_dead() should take care of panic'ing from an interrupt
* context so we don't handle it here
*/
do_exit(err);
make_task_dead(err);
}

/* for user application debugging */
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ void __noreturn die(const char *str, struct pt_regs *regs)
if (regs && kexec_should_crash(current))
crash_kexec(regs);

do_exit(sig);
make_task_dead(sig);
}

extern struct exception_table_entry __start___dbe_table[];
Expand Down
4 changes: 2 additions & 2 deletions arch/nios2/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ void die(const char *str, struct pt_regs *regs, long err)
show_regs(regs);
spin_unlock_irq(&die_lock);
/*
* do_exit() should take care of panic'ing from an interrupt
* make_task_dead() should take care of panic'ing from an interrupt
* context so we don't handle it here
*/
do_exit(err);
make_task_dead(err);
}

void _exception(int signo, struct pt_regs *regs, int code, unsigned long addr)
Expand Down
2 changes: 1 addition & 1 deletion arch/openrisc/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ void die(const char *str, struct pt_regs *regs, long err)
__asm__ __volatile__("l.nop 1");
do {} while (1);
#endif
do_exit(SIGSEGV);
make_task_dead(SIGSEGV);
}

/* This is normally the 'Oops' routine */
Expand Down
2 changes: 1 addition & 1 deletion arch/parisc/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)
panic("Fatal exception");

oops_exit();
do_exit(SIGSEGV);
make_task_dead(SIGSEGV);
}

/* gdb uses break 4,8 */
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ static void oops_end(unsigned long flags, struct pt_regs *regs,
panic("Fatal exception in interrupt");
if (panic_on_oops)
panic("Fatal exception");
do_exit(signr);
make_task_dead(signr);
}
NOKPROBE_SYMBOL(oops_end);

Expand Down
2 changes: 1 addition & 1 deletion arch/s390/kernel/dumpstack.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,5 +186,5 @@ void die(struct pt_regs *regs, const char *str)
if (panic_on_oops)
panic("Fatal exception: panic_on_oops");
oops_exit();
do_exit(SIGSEGV);
make_task_dead(SIGSEGV);
}
2 changes: 1 addition & 1 deletion arch/s390/kernel/nmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void s390_handle_mcck(void)
"malfunction (code 0x%016lx).\n", mcck.mcck_code);
printk(KERN_EMERG "mcck: task: %s, pid: %d.\n",
current->comm, current->pid);
do_exit(SIGSEGV);
make_task_dead(SIGSEGV);
}
}
EXPORT_SYMBOL_GPL(s390_handle_mcck);
Expand Down
2 changes: 1 addition & 1 deletion arch/sh/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void die(const char *str, struct pt_regs *regs, long err)
if (panic_on_oops)
panic("Fatal exception");

do_exit(SIGSEGV);
make_task_dead(SIGSEGV);
}

void die_if_kernel(const char *str, struct pt_regs *regs, long err)
Expand Down
4 changes: 1 addition & 3 deletions arch/sparc/kernel/traps_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ void __noreturn die_if_kernel(char *str, struct pt_regs *regs)
}
printk("Instruction DUMP:");
instruction_dump ((unsigned long *) regs->pc);
if(regs->psr & PSR_PS)
do_exit(SIGKILL);
do_exit(SIGSEGV);
make_task_dead((regs->psr & PSR_PS) ? SIGKILL : SIGSEGV);
}

void do_hw_interrupt(struct pt_regs *regs, unsigned long type)
Expand Down
4 changes: 1 addition & 3 deletions arch/sparc/kernel/traps_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -2547,9 +2547,7 @@ void __noreturn die_if_kernel(char *str, struct pt_regs *regs)
}
if (panic_on_oops)
panic("Fatal exception");
if (regs->tstate & TSTATE_PRIV)
do_exit(SIGKILL);
do_exit(SIGSEGV);
make_task_dead((regs->tstate & TSTATE_PRIV)? SIGKILL : SIGSEGV);
}
EXPORT_SYMBOL(die_if_kernel);

Expand Down
6 changes: 3 additions & 3 deletions arch/x86/entry/entry_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -1068,13 +1068,13 @@ ENTRY(async_page_fault)
END(async_page_fault)
#endif

ENTRY(rewind_stack_do_exit)
ENTRY(rewind_stack_and_make_dead)
/* Prevent any naive code from trying to unwind to our caller. */
xorl %ebp, %ebp

movl PER_CPU_VAR(cpu_current_top_of_stack), %esi
leal -TOP_OF_KERNEL_STACK_PADDING-PTREGS_SIZE(%esi), %esp

call do_exit
call make_task_dead
1: jmp 1b
END(rewind_stack_do_exit)
END(rewind_stack_and_make_dead)
Loading

0 comments on commit 19cbf1c

Please sign in to comment.