Skip to content

Commit 4bf4bd7

Browse files
committed
Merge branch 'for-next/kspp' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git
2 parents 95bef89 + 9cca73d commit 4bf4bd7

File tree

60 files changed

+280
-90
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+280
-90
lines changed

MAINTAINERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8750,6 +8750,8 @@ L: linux-hardening@vger.kernel.org
87508750
S: Maintained
87518751
T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
87528752
F: Documentation/kbuild/gcc-plugins.rst
8753+
F: include/linux/stackleak.h
8754+
F: kernel/stackleak.c
87538755
F: scripts/Makefile.gcc-plugins
87548756
F: scripts/gcc-plugins/
87558757

@@ -11518,16 +11520,20 @@ F: usr/
1151811520

1151911521
KERNEL HARDENING (not covered by other areas)
1152011522
M: Kees Cook <keescook@chromium.org>
11523+
R: Gustavo A. R. Silva <gustavoars@kernel.org>
1152111524
L: linux-hardening@vger.kernel.org
1152211525
S: Supported
1152311526
T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
1152411527
F: Documentation/ABI/testing/sysfs-kernel-oops_count
1152511528
F: Documentation/ABI/testing/sysfs-kernel-warn_count
11529+
F: arch/*/configs/hardening.config
1152611530
F: include/linux/overflow.h
1152711531
F: include/linux/randomize_kstack.h
11532+
F: kernel/configs/hardening.config
1152811533
F: mm/usercopy.c
1152911534
K: \b(add|choose)_random_kstack_offset\b
1153011535
K: \b__check_(object_size|heap_object)\b
11536+
K: \b__counted_by\b
1153111537

1153211538
KERNEL JANITORS
1153311539
L: kernel-janitors@vger.kernel.org

arch/arm/configs/hardening.config

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Basic kernel hardening options (specific to arm)
2+
3+
# Make sure PXN/PAN emulation is enabled.
4+
CONFIG_CPU_SW_DOMAIN_PAN=y
5+
6+
# Dangerous; old interfaces and needless additional attack surface.
7+
# CONFIG_OABI_COMPAT is not set

arch/arm64/configs/hardening.config

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Basic kernel hardening options (specific to arm64)
2+
3+
# Make sure PAN emulation is enabled.
4+
CONFIG_ARM64_SW_TTBR0_PAN=y
5+
6+
# Software Shadow Stack or PAC
7+
CONFIG_SHADOW_CALL_STACK=y
8+
9+
# Pointer authentication (ARMv8.3 and later). If hardware actually supports
10+
# it, one can turn off CONFIG_STACKPROTECTOR_STRONG with this enabled.
11+
CONFIG_ARM64_PTR_AUTH=y
12+
CONFIG_ARM64_PTR_AUTH_KERNEL=y
13+
14+
# Available in ARMv8.5 and later.
15+
CONFIG_ARM64_BTI=y
16+
CONFIG_ARM64_BTI_KERNEL=y
17+
CONFIG_ARM64_MTE=y
18+
CONFIG_KASAN_HW_TAGS=y
19+
CONFIG_ARM64_E0PD=y
20+
21+
# Available in ARMv8.7 and later.
22+
CONFIG_ARM64_EPAN=y

arch/powerpc/configs/hardening.config

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# PowerPC specific hardening options
2+
3+
# Block kernel from unexpectedly reading userspace memory.
4+
CONFIG_PPC_KUAP=y
5+
6+
# Attack surface reduction.
7+
# CONFIG_SCOM_DEBUGFS is not set
8+
9+
# Disable internal kernel debugger.
10+
# CONFIG_XMON is not set

arch/sparc/kernel/cpumap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct cpuinfo_tree {
5050

5151
/* Offsets into nodes[] for each level of the tree */
5252
struct cpuinfo_level level[CPUINFO_LVL_MAX];
53-
struct cpuinfo_node nodes[];
53+
struct cpuinfo_node nodes[] __counted_by(total_nodes);
5454
};
5555

5656

arch/um/os-Linux/drivers/ethertap_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static int etap_tramp(char *dev, char *gate, int control_me,
105105
sprintf(data_fd_buf, "%d", data_remote);
106106
sprintf(version_buf, "%d", UML_NET_VERSION);
107107
if (gate != NULL) {
108-
strncpy(gate_buf, gate, 15);
108+
strscpy(gate_buf, gate, sizeof(gate_buf));
109109
args = setup_args;
110110
}
111111
else args = nosetup_args;

arch/x86/configs/hardening.config

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Basic kernel hardening options (specific to x86)
2+
3+
# Modern libc no longer needs a fixed-position mapping in userspace, remove
4+
# it as a possible target.
5+
CONFIG_LEGACY_VSYSCALL_NONE=y
6+
7+
# Enable chip-specific IOMMU support.
8+
CONFIG_INTEL_IOMMU=y
9+
CONFIG_INTEL_IOMMU_DEFAULT_ON=y
10+
CONFIG_INTEL_IOMMU_SVM=y
11+
CONFIG_AMD_IOMMU=y
12+
13+
# Enable CET Shadow Stack for userspace.
14+
CONFIG_X86_USER_SHADOW_STACK=y

drivers/accel/ivpu/ivpu_job.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct ivpu_job {
5151
u32 job_id;
5252
u32 engine_idx;
5353
size_t bo_count;
54-
struct ivpu_bo *bos[];
54+
struct ivpu_bo *bos[] __counted_by(bo_count);
5555
};
5656

5757
int ivpu_submit_ioctl(struct drm_device *dev, void *data, struct drm_file *file);

drivers/auxdisplay/panel.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,10 +1449,9 @@ static struct logical_input *panel_bind_key(const char *name, const char *press,
14491449
key->rise_time = 1;
14501450
key->fall_time = 1;
14511451

1452-
strncpy(key->u.kbd.press_str, press, sizeof(key->u.kbd.press_str));
1453-
strncpy(key->u.kbd.repeat_str, repeat, sizeof(key->u.kbd.repeat_str));
1454-
strncpy(key->u.kbd.release_str, release,
1455-
sizeof(key->u.kbd.release_str));
1452+
strtomem_pad(key->u.kbd.press_str, press, '\0');
1453+
strtomem_pad(key->u.kbd.repeat_str, repeat, '\0');
1454+
strtomem_pad(key->u.kbd.release_str, release, '\0');
14561455
list_add(&key->list, &logical_inputs);
14571456
return key;
14581457
}

drivers/block/drbd/drbd_int.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ struct fifo_buffer {
555555
unsigned int head_index;
556556
unsigned int size;
557557
int total; /* sum of all values */
558-
int values[];
558+
int values[] __counted_by(size);
559559
};
560560
extern struct fifo_buffer *fifo_alloc(unsigned int fifo_size);
561561

0 commit comments

Comments
 (0)