History

Merge tag 'mm-nonmm-stable-2022-08-06-2' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull misc updates from Andrew Morton: "Updates to various subsystems which I help look after. lib, ocfs2, fatfs, autofs, squashfs, procfs, etc. A relatively small amount of material this time" * tag 'mm-nonmm-stable-2022-08-06-2' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (72 commits) scripts/gdb: ensure the absolute path is generated on initial source MAINTAINERS: kunit: add David Gow as a maintainer of KUnit mailmap: add linux.dev alias for Brendan Higgins mailmap: update Kirill's email profile: setup_profiling_timer() is moslty not implemented ocfs2: fix a typo in a comment ocfs2: use the bitmap API to simplify code ocfs2: remove some useless functions lib/mpi: fix typo 'the the' in comment proc: add some (hopefully) insightful comments bdi: remove enum wb_congested_state kernel/hung_task: fix address space of proc_dohung_task_timeout_secs lib/lzo/lzo1x_compress.c: replace ternary operator with min() and min_t() squashfs: support reading fragments in readahead call squashfs: implement readahead squashfs: always build "file direct" version of page actor Revert "squashfs: provide backing_dev_info in order to disable read-ahead" fs/ocfs2: Fix spelling typo in comment ia64: old_rr4 added under CONFIG_HUGETLB_PAGE proc: fix test for "vsyscall=xonly" boot option ...

Linus Torvalds committed 4 years ago

Commit eb5699b2 parents b5a8466 b996955102 files · +1313 −724Browse files

Showing the changes to kernel (6 of 102 files). Show all

Unified · Split

6 files
  1. kernel/crash_core.c +26 −2
  2. kernel/hung_task.c +1 −1
  3. kernel/kallsyms.c +1 −22
  4. kernel/kallsyms_internal.h +30 −0
  5. kernel/kexec_file.c +7 −3
  6. kernel/profile.c +13 −2
kernel/crash_core.c+26−2
@@ -9,12 +9,15 @@ · 8 unmodified lines
99 #include <linux/init.h>
1010 #include <linux/utsname.h>
1111 #include <linux/vmalloc.h>
12+#include <linux/sizes.h>
1213
1314 #include <asm/page.h>
1415 #include <asm/sections.h>
1516
1617 #include <crypto/sha1.h>
1718
19+#include "kallsyms_internal.h"
20+
1821 /* vmcoreinfo stuff */
1922 unsigned char *vmcoreinfo_data;
2023 size_t vmcoreinfo_size;
@@ -43,6 +46,15 @@ static int __init parse_crashkernel_mem(char *cmdline, · 22 unmodified lines
4346 unsigned long long *crash_base)
4447 {
4548 char *cur = cmdline, *tmp;
49+ unsigned long long total_mem = system_ram;
50+
51+ /*
52+ * Firmware sometimes reserves some memory regions for its own use,
53+ * so the system memory size is less than the actual physical memory
54+ * size. Work around this by rounding up the total size to 128M,
55+ * which is enough for most test cases.
56+ */
57+ total_mem = roundup(total_mem, SZ_128M);
4658
4759 /* for each entry of the comma-separated list */
4860 do {
@@ -87,13 +99,13 @@ static int __init parse_crashkernel_mem(char *cmdline, · 38 unmodified lines
8799 return -EINVAL;
88100 }
89101 cur = tmp;
90− if (size >= system_ram) {
102+ if (size >= total_mem) {
91103 pr_warn("crashkernel: invalid size\n");
92104 return -EINVAL;
93105 }
94106
95107 /* match ? */
96− if (system_ram >= start && system_ram < end) {
108+ if (total_mem >= start && total_mem < end) {
97109 *crash_size = size;
98110 break;
99111 }
@@ -480,6 +492,18 @@ static int __init crash_save_vmcoreinfo_init(void) · 380 unmodified lines
480492 VMCOREINFO_NUMBER(PAGE_OFFLINE_MAPCOUNT_VALUE);
481493 #endif
482494
495+#ifdef CONFIG_KALLSYMS
496+ VMCOREINFO_SYMBOL(kallsyms_names);
497+ VMCOREINFO_SYMBOL(kallsyms_token_table);
498+ VMCOREINFO_SYMBOL(kallsyms_token_index);
499+#ifdef CONFIG_KALLSYMS_BASE_RELATIVE
500+ VMCOREINFO_SYMBOL(kallsyms_offsets);
501+ VMCOREINFO_SYMBOL(kallsyms_relative_base);
502+#else
503+ VMCOREINFO_SYMBOL(kallsyms_addresses);
504+#endif /* CONFIG_KALLSYMS_BASE_RELATIVE */
505+#endif /* CONFIG_KALLSYMS */
506+
483507 arch_crash_save_vmcoreinfo();
484508 update_vmcoreinfo_note();
485509
kernel/hung_task.c+1−1
@@ -229,7 +229,7 @@ static long hung_timeout_jiffies(unsigned long last_checked, · 228 unmodified lines
229229 * Process updating of timeout sysctl
230230 */
231231 static int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
232− void __user *buffer,
232+ void *buffer,
233233 size_t *lenp, loff_t *ppos)
234234 {
235235 int ret;
kernel/kallsyms.c+1−22
@@ -32,28 +32,7 @@ · 31 unmodified lines
3232 #include <linux/bsearch.h>
3333 #include <linux/btf_ids.h>
3434
35−/*
36− * These will be re-linked against their real values
37− * during the second link stage.
38− */
39−extern const unsigned long kallsyms_addresses[] __weak;
40−extern const int kallsyms_offsets[] __weak;
41−extern const u8 kallsyms_names[] __weak;
42−
43−/*
44− * Tell the compiler that the count isn't in the small data section if the arch
45− * has one (eg: FRV).
46− */
47−extern const unsigned int kallsyms_num_syms
48−__section(".rodata") __attribute__((weak));
49−
50−extern const unsigned long kallsyms_relative_base
51−__section(".rodata") __attribute__((weak));
52−
53−extern const char kallsyms_token_table[] __weak;
54−extern const u16 kallsyms_token_index[] __weak;
55−
56−extern const unsigned int kallsyms_markers[] __weak;
35+#include "kallsyms_internal.h"
5736
5837 /*
5938 * Expand a compressed symbol data into the resulting uncompressed string,
kernel/kallsyms_internal.h+30−0
@@ -0,0 +1,30 @@
1+/* SPDX-License-Identifier: GPL-2.0-only */
2+#ifndef LINUX_KALLSYMS_INTERNAL_H_
3+#define LINUX_KALLSYMS_INTERNAL_H_
4+
5+#include <linux/types.h>
6+
7+/*
8+ * These will be re-linked against their real values
9+ * during the second link stage.
10+ */
11+extern const unsigned long kallsyms_addresses[] __weak;
12+extern const int kallsyms_offsets[] __weak;
13+extern const u8 kallsyms_names[] __weak;
14+
15+/*
16+ * Tell the compiler that the count isn't in the small data section if the arch
17+ * has one (eg: FRV).
18+ */
19+extern const unsigned int kallsyms_num_syms
20+__section(".rodata") __attribute__((weak));
21+
22+extern const unsigned long kallsyms_relative_base
23+__section(".rodata") __attribute__((weak));
24+
25+extern const char kallsyms_token_table[] __weak;
26+extern const u16 kallsyms_token_index[] __weak;
27+
28+extern const unsigned int kallsyms_markers[] __weak;
29+
30+#endif // LINUX_KALLSYMS_INTERNAL_H_
kernel/kexec_file.c+7−3
@@ -40,6 +40,9 @@ void set_kexec_sig_enforced(void) · 39 unmodified lines
4040
4141 static int kexec_calculate_store_digests(struct kimage *image);
4242
43+/* Maximum size in bytes for kernel/initrd files. */
44+#define KEXEC_FILE_SIZE_MAX min_t(s64, 4LL << 30, SSIZE_MAX)
45+
4346 /*
4447 * Currently this is the only default function that is exported as some
4548 * architectures need it to do additional handlings.
@@ -190,11 +193,12 @@ kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd, · 144 unmodified lines
190193 const char __user *cmdline_ptr,
191194 unsigned long cmdline_len, unsigned flags)
192195 {
193− int ret;
196+ ssize_t ret;
194197 void *ldata;
195198
196199 ret = kernel_read_file_from_fd(kernel_fd, 0, &image->kernel_buf,
197− INT_MAX, NULL, READING_KEXEC_IMAGE);
200+ KEXEC_FILE_SIZE_MAX, NULL,
201+ READING_KEXEC_IMAGE);
198202 if (ret < 0)
199203 return ret;
200204 image->kernel_buf_len = ret;
@@ -214,7 +218,7 @@ kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd, · 13 unmodified lines
214218 /* It is possible that there no initramfs is being loaded */
215219 if (!(flags & KEXEC_FILE_NO_INITRAMFS)) {
216220 ret = kernel_read_file_from_fd(initrd_fd, 0, &image->initrd_buf,
217− INT_MAX, NULL,
221+ KEXEC_FILE_SIZE_MAX, NULL,
218222 READING_KEXEC_INITRAMFS);
219223 if (ret < 0)
220224 goto out;
kernel/profile.c+13−2
@@ -109,6 +109,13 @@ int __ref profile_init(void) · 108 unmodified lines
109109
110110 /* only text is profiled */
111111 prof_len = (_etext - _stext) >> prof_shift;
112+
113+ if (!prof_len) {
114+ pr_warn("profiling shift: %u too large\n", prof_shift);
115+ prof_on = 0;
116+ return -EINVAL;
117+ }
118+
112119 buffer_bytes = prof_len*sizeof(atomic_t);
113120
114121 if (!alloc_cpumask_var(&prof_cpu_mask, GFP_KERNEL))
@@ -418,6 +425,12 @@ read_profile(struct file *file, char __user *buf, size_t count, loff_t *ppos) · 303 unmodified lines
418425 return read;
419426 }
420427
428+/* default is to not implement this call */
429+int __weak setup_profiling_timer(unsigned mult)
430+{
431+ return -EINVAL;
432+}
433+
421434 /*
422435 * Writing to /proc/profile resets the counters
423436 *
@@ -428,8 +441,6 @@ static ssize_t write_profile(struct file *file, const char __user *buf, · 4 unmodified lines
428441 size_t count, loff_t *ppos)
429442 {
430443 #ifdef CONFIG_SMP
431− extern int setup_profiling_timer(unsigned int multiplier);
432−
433444 if (count == sizeof(int)) {
434445 unsigned int multiplier;
435446