forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'akpm' (patches from Andrew)
Merge yet more updates from Andrew Morton: - lots of little subsystems - a few post-linux-next MM material. Most of the rest awaits more merging of other trees. Subsystems affected by this series: alpha, procfs, misc, core-kernel, bitmap, lib, lz4, checkpatch, nilfs, kdump, rapidio, gcov, bfs, relay, resource, ubsan, reboot, fault-injection, lzo, apparmor, and mm (swap, memory-hotplug, pagemap, cleanups, and gup). * emailed patches from Andrew Morton <[email protected]>: (86 commits) mm: fix some spelling mistakes in comments mm: simplify follow_pte{,pmd} mm: unexport follow_pte_pmd apparmor: remove duplicate macro list_entry_is_head() lib/lzo/lzo1x_compress.c: make lzogeneric1x_1_compress() static fault-injection: handle EI_ETYPE_TRUE reboot: hide from sysfs not applicable settings reboot: allow to override reboot type if quirks are found reboot: remove cf9_safe from allowed types and rename cf9_force reboot: allow to specify reboot mode via sysfs reboot: refactor and comment the cpu selection code lib/ubsan.c: mark type_check_kinds with static keyword kcov: don't instrument with UBSAN ubsan: expand tests and reporting ubsan: remove UBSAN_MISC in favor of individual options ubsan: enable for all*config builds ubsan: disable UBSAN_TRAP for all*config ubsan: disable object-size sanitizer under GCC ubsan: move cc-option tests into Kconfig ubsan: remove redundant -Wno-maybe-uninitialized ...
- Loading branch information
Showing
87 changed files
with
1,568 additions
and
724 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
What: /sys/kernel/reboot | ||
Date: November 2020 | ||
KernelVersion: 5.11 | ||
Contact: Matteo Croce <[email protected]> | ||
Description: Interface to set the kernel reboot behavior, similarly to | ||
what can be done via the reboot= cmdline option. | ||
(see Documentation/admin-guide/kernel-parameters.txt) | ||
|
||
What: /sys/kernel/reboot/mode | ||
Date: November 2020 | ||
KernelVersion: 5.11 | ||
Contact: Matteo Croce <[email protected]> | ||
Description: Reboot mode. Valid values are: cold warm hard soft gpio | ||
|
||
What: /sys/kernel/reboot/type | ||
Date: November 2020 | ||
KernelVersion: 5.11 | ||
Contact: Matteo Croce <[email protected]> | ||
Description: Reboot type. Valid values are: bios acpi kbd triple efi pci | ||
|
||
What: /sys/kernel/reboot/cpu | ||
Date: November 2020 | ||
KernelVersion: 5.11 | ||
Contact: Matteo Croce <[email protected]> | ||
Description: CPU number to use to reboot. | ||
|
||
What: /sys/kernel/reboot/force | ||
Date: November 2020 | ||
KernelVersion: 5.11 | ||
Contact: Matteo Croce <[email protected]> | ||
Description: Don't wait for any other CPUs on reboot and | ||
avoid anything that could hang. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* | ||
* Copyright (c) 2020 Francis Laniel <[email protected]> | ||
* | ||
* Add tests related to fortified functions in this file. | ||
*/ | ||
#include "lkdtm.h" | ||
#include <linux/string.h> | ||
#include <linux/slab.h> | ||
|
||
|
||
/* | ||
* Calls fortified strscpy to test that it returns the same result as vanilla | ||
* strscpy and generate a panic because there is a write overflow (i.e. src | ||
* length is greater than dst length). | ||
*/ | ||
void lkdtm_FORTIFIED_STRSCPY(void) | ||
{ | ||
char *src; | ||
char dst[5]; | ||
|
||
struct { | ||
union { | ||
char big[10]; | ||
char src[5]; | ||
}; | ||
} weird = { .big = "hello!" }; | ||
char weird_dst[sizeof(weird.src) + 1]; | ||
|
||
src = kstrdup("foobar", GFP_KERNEL); | ||
|
||
if (src == NULL) | ||
return; | ||
|
||
/* Vanilla strscpy returns -E2BIG if size is 0. */ | ||
if (strscpy(dst, src, 0) != -E2BIG) | ||
pr_warn("FAIL: strscpy() of 0 length did not return -E2BIG\n"); | ||
|
||
/* Vanilla strscpy returns -E2BIG if src is truncated. */ | ||
if (strscpy(dst, src, sizeof(dst)) != -E2BIG) | ||
pr_warn("FAIL: strscpy() did not return -E2BIG while src is truncated\n"); | ||
|
||
/* After above call, dst must contain "foob" because src was truncated. */ | ||
if (strncmp(dst, "foob", sizeof(dst)) != 0) | ||
pr_warn("FAIL: after strscpy() dst does not contain \"foob\" but \"%s\"\n", | ||
dst); | ||
|
||
/* Shrink src so the strscpy() below succeeds. */ | ||
src[3] = '\0'; | ||
|
||
/* | ||
* Vanilla strscpy returns number of character copied if everything goes | ||
* well. | ||
*/ | ||
if (strscpy(dst, src, sizeof(dst)) != 3) | ||
pr_warn("FAIL: strscpy() did not return 3 while src was copied entirely truncated\n"); | ||
|
||
/* After above call, dst must contain "foo" because src was copied. */ | ||
if (strncmp(dst, "foo", sizeof(dst)) != 0) | ||
pr_warn("FAIL: after strscpy() dst does not contain \"foo\" but \"%s\"\n", | ||
dst); | ||
|
||
/* Test when src is embedded inside a union. */ | ||
strscpy(weird_dst, weird.src, sizeof(weird_dst)); | ||
|
||
if (strcmp(weird_dst, "hello") != 0) | ||
pr_warn("FAIL: after strscpy() weird_dst does not contain \"hello\" but \"%s\"\n", | ||
weird_dst); | ||
|
||
/* Restore src to its initial value. */ | ||
src[3] = 'b'; | ||
|
||
/* | ||
* Use strlen here so size cannot be known at compile time and there is | ||
* a runtime write overflow. | ||
*/ | ||
strscpy(dst, src, strlen(src)); | ||
|
||
pr_warn("FAIL: No overflow in above strscpy()\n"); | ||
|
||
kfree(src); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.