Skip to content

Commit

Permalink
Merge tag 'mips_fixes_5.11.1' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/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
  • Loading branch information
torvalds committed Jan 15, 2021
2 parents f4e087c + 7b490a8 commit f288c89
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
3 changes: 2 additions & 1 deletion arch/mips/boot/compressed/decompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/libfdt.h>

#include <asm/addrspace.h>
#include <asm/unaligned.h>

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

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

/* copy dtb to where the booted kernel will expect it */
memcpy((void *)VMLINUX_LOAD_ADDRESS_ULL + image_size,
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/cavium-octeon/octeon-irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ static void octeon_irq_setup_secondary_ciu2(void)
static int __init octeon_irq_init_ciu(
struct device_node *ciu_node, struct device_node *parent)
{
unsigned int i, r;
int i, r;
struct irq_chip *chip;
struct irq_chip *chip_edge;
struct irq_chip *chip_mbox;
Expand Down
7 changes: 7 additions & 0 deletions arch/mips/kernel/binfmt_elfn32.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,11 @@ jiffies_to_old_timeval32(unsigned long jiffies, struct old_timeval32 *value)
#undef ns_to_kernel_old_timeval
#define ns_to_kernel_old_timeval ns_to_old_timeval32

/*
* Some data types as stored in coredump.
*/
#define user_long_t compat_long_t
#define user_siginfo_t compat_siginfo_t
#define copy_siginfo_to_external copy_siginfo_to_external32

#include "../../../fs/binfmt_elf.c"
7 changes: 7 additions & 0 deletions arch/mips/kernel/binfmt_elfo32.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,11 @@ jiffies_to_old_timeval32(unsigned long jiffies, struct old_timeval32 *value)
#undef ns_to_kernel_old_timeval
#define ns_to_kernel_old_timeval ns_to_old_timeval32

/*
* Some data types as stored in coredump.
*/
#define user_long_t compat_long_t
#define user_siginfo_t compat_siginfo_t
#define copy_siginfo_to_external copy_siginfo_to_external32

#include "../../../fs/binfmt_elf.c"
10 changes: 8 additions & 2 deletions arch/mips/kernel/relocate.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,14 @@ static int __init relocate_exception_table(long offset)
static inline __init unsigned long rotate_xor(unsigned long hash,
const void *area, size_t size)
{
size_t i;
unsigned long *ptr = (unsigned long *)area;
const typeof(hash) *ptr = PTR_ALIGN(area, sizeof(hash));
size_t diff, i;

diff = (void *)ptr - area;
if (unlikely(size < diff + sizeof(hash)))
return hash;

size = ALIGN_DOWN(size - diff, sizeof(hash));

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

0 comments on commit f288c89

Please sign in to comment.