Skip to content

Commit f288c89

Browse files
committed
Merge tag 'mips_fixes_5.11.1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
Pull MIPS fixes from Thomas Bogendoerfer: - fix coredumps on 64bit kernels - fix for alignment bugs preventing booting - fix checking for failed irq_alloc_desc calls * tag 'mips_fixes_5.11.1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: MIPS: OCTEON: fix unreachable code in octeon_irq_init_ciu MIPS: relocatable: fix possible boot hangup with KASLR enabled MIPS: Fix malformed NT_FILE and NT_SIGINFO in 32bit coredumps MIPS: boot: Fix unaligned access with CONFIG_MIPS_RAW_APPENDED_DTB
2 parents f4e087c + 7b490a8 commit f288c89

5 files changed

Lines changed: 25 additions & 4 deletions

File tree

arch/mips/boot/compressed/decompress.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/libfdt.h>
1414

1515
#include <asm/addrspace.h>
16+
#include <asm/unaligned.h>
1617

1718
/*
1819
* These two variables specify the free mem region
@@ -117,7 +118,7 @@ void decompress_kernel(unsigned long boot_heap_start)
117118
dtb_size = fdt_totalsize((void *)&__appended_dtb);
118119

119120
/* last four bytes is always image size in little endian */
120-
image_size = le32_to_cpup((void *)&__image_end - 4);
121+
image_size = get_unaligned_le32((void *)&__image_end - 4);
121122

122123
/* copy dtb to where the booted kernel will expect it */
123124
memcpy((void *)VMLINUX_LOAD_ADDRESS_ULL + image_size,

arch/mips/cavium-octeon/octeon-irq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,7 @@ static void octeon_irq_setup_secondary_ciu2(void)
14441444
static int __init octeon_irq_init_ciu(
14451445
struct device_node *ciu_node, struct device_node *parent)
14461446
{
1447-
unsigned int i, r;
1447+
int i, r;
14481448
struct irq_chip *chip;
14491449
struct irq_chip *chip_edge;
14501450
struct irq_chip *chip_mbox;

arch/mips/kernel/binfmt_elfn32.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,11 @@ jiffies_to_old_timeval32(unsigned long jiffies, struct old_timeval32 *value)
103103
#undef ns_to_kernel_old_timeval
104104
#define ns_to_kernel_old_timeval ns_to_old_timeval32
105105

106+
/*
107+
* Some data types as stored in coredump.
108+
*/
109+
#define user_long_t compat_long_t
110+
#define user_siginfo_t compat_siginfo_t
111+
#define copy_siginfo_to_external copy_siginfo_to_external32
112+
106113
#include "../../../fs/binfmt_elf.c"

arch/mips/kernel/binfmt_elfo32.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,11 @@ jiffies_to_old_timeval32(unsigned long jiffies, struct old_timeval32 *value)
106106
#undef ns_to_kernel_old_timeval
107107
#define ns_to_kernel_old_timeval ns_to_old_timeval32
108108

109+
/*
110+
* Some data types as stored in coredump.
111+
*/
112+
#define user_long_t compat_long_t
113+
#define user_siginfo_t compat_siginfo_t
114+
#define copy_siginfo_to_external copy_siginfo_to_external32
115+
109116
#include "../../../fs/binfmt_elf.c"

arch/mips/kernel/relocate.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,14 @@ static int __init relocate_exception_table(long offset)
187187
static inline __init unsigned long rotate_xor(unsigned long hash,
188188
const void *area, size_t size)
189189
{
190-
size_t i;
191-
unsigned long *ptr = (unsigned long *)area;
190+
const typeof(hash) *ptr = PTR_ALIGN(area, sizeof(hash));
191+
size_t diff, i;
192+
193+
diff = (void *)ptr - area;
194+
if (unlikely(size < diff + sizeof(hash)))
195+
return hash;
196+
197+
size = ALIGN_DOWN(size - diff, sizeof(hash));
192198

193199
for (i = 0; i < size / sizeof(hash); i++) {
194200
/* Rotate by odd number of bits and XOR. */

0 commit comments

Comments
 (0)