Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5e616cd authored by Ashwini Muduganti's avatar Ashwini Muduganti
Browse files

Merge commit 'refs/changes/11/2481211/2' of ssh://git.quicinc.com:29418/kernel/msm-4.14 into HEAD



Change-Id: I89b338bd6bc6dda62114f6688de5fb6e63f9a70f
Signed-off-by: default avatarAshwini Muduganti <amudug@codeaurora.org>
parents 0980b7c2 107b1944
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
VERSION = 4
PATCHLEVEL = 14
SUBLEVEL = 75
SUBLEVEL = 76
EXTRAVERSION =
NAME = Petit Gorille

+20 −0
Original line number Diff line number Diff line
@@ -241,6 +241,26 @@ int copy_thread(unsigned long clone_flags,
		task_thread_info(current)->thr_ptr;
	}


	/*
	 * setup usermode thread pointer #1:
	 * when child is picked by scheduler, __switch_to() uses @c_callee to
	 * populate usermode callee regs: this works (despite being in a kernel
	 * function) since special return path for child @ret_from_fork()
	 * ensures those regs are not clobbered all the way to RTIE to usermode
	 */
	c_callee->r25 = task_thread_info(p)->thr_ptr;

#ifdef CONFIG_ARC_CURR_IN_REG
	/*
	 * setup usermode thread pointer #2:
	 * however for this special use of r25 in kernel, __switch_to() sets
	 * r25 for kernel needs and only in the final return path is usermode
	 * r25 setup, from pt_regs->user_r25. So set that up as well
	 */
	c_regs->user_r25 = c_callee->r25;
#endif

	return 0;
}

+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ extern void ppc_printk_progress(char *s, unsigned short hex);

extern unsigned int rtas_data;
extern unsigned long long memory_limit;
extern bool init_mem_is_free;
extern unsigned long klimit;
extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);

+28 −17
Original line number Diff line number Diff line
@@ -22,20 +22,28 @@
#include <asm/page.h>
#include <asm/code-patching.h>
#include <asm/setup.h>
#include <asm/sections.h>

static int __patch_instruction(unsigned int *addr, unsigned int instr)
static int __patch_instruction(unsigned int *exec_addr, unsigned int instr,
			       unsigned int *patch_addr)
{
	int err;

	__put_user_size(instr, addr, 4, err);
	__put_user_size(instr, patch_addr, 4, err);
	if (err)
		return err;

	asm ("dcbst 0, %0; sync; icbi 0,%0; sync; isync" :: "r" (addr));
	asm ("dcbst 0, %0; sync; icbi 0,%1; sync; isync" :: "r" (patch_addr),
							    "r" (exec_addr));

	return 0;
}

static int raw_patch_instruction(unsigned int *addr, unsigned int instr)
{
	return __patch_instruction(addr, instr, addr);
}

#ifdef CONFIG_STRICT_KERNEL_RWX
static DEFINE_PER_CPU(struct vm_struct *, text_poke_area);

@@ -135,10 +143,10 @@ static inline int unmap_patch_area(unsigned long addr)
	return 0;
}

int patch_instruction(unsigned int *addr, unsigned int instr)
static int do_patch_instruction(unsigned int *addr, unsigned int instr)
{
	int err;
	unsigned int *dest = NULL;
	unsigned int *patch_addr = NULL;
	unsigned long flags;
	unsigned long text_poke_addr;
	unsigned long kaddr = (unsigned long)addr;
@@ -149,7 +157,7 @@ int patch_instruction(unsigned int *addr, unsigned int instr)
	 * to allow patching. We just do the plain old patching
	 */
	if (!this_cpu_read(*PTRRELOC(&text_poke_area)))
		return __patch_instruction(addr, instr);
		return raw_patch_instruction(addr, instr);

	local_irq_save(flags);

@@ -159,17 +167,10 @@ int patch_instruction(unsigned int *addr, unsigned int instr)
		goto out;
	}

	dest = (unsigned int *)(text_poke_addr) +
	patch_addr = (unsigned int *)(text_poke_addr) +
			((kaddr & ~PAGE_MASK) / sizeof(unsigned int));

	/*
	 * We use __put_user_size so that we can handle faults while
	 * writing to dest and return err to handle faults gracefully
	 */
	__put_user_size(instr, dest, 4, err);
	if (!err)
		asm ("dcbst 0, %0; sync; icbi 0,%0; icbi 0,%1; sync; isync"
			::"r" (dest), "r"(addr));
	__patch_instruction(addr, instr, patch_addr);

	err = unmap_patch_area(text_poke_addr);
	if (err)
@@ -182,12 +183,22 @@ int patch_instruction(unsigned int *addr, unsigned int instr)
}
#else /* !CONFIG_STRICT_KERNEL_RWX */

int patch_instruction(unsigned int *addr, unsigned int instr)
static int do_patch_instruction(unsigned int *addr, unsigned int instr)
{
	return __patch_instruction(addr, instr);
	return raw_patch_instruction(addr, instr);
}

#endif /* CONFIG_STRICT_KERNEL_RWX */

int patch_instruction(unsigned int *addr, unsigned int instr)
{
	/* Make sure we aren't patching a freed init section */
	if (init_mem_is_free && init_section_contains(addr, 4)) {
		pr_debug("Skipping init section patching addr: 0x%px\n", addr);
		return 0;
	}
	return do_patch_instruction(addr, instr);
}
NOKPROBE_SYMBOL(patch_instruction);

int patch_branch(unsigned int *addr, unsigned long target, int flags)
+2 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@
#endif

unsigned long long memory_limit;
bool init_mem_is_free;

#ifdef CONFIG_HIGHMEM
pte_t *kmap_pte;
@@ -405,6 +406,7 @@ void free_initmem(void)
{
	ppc_md.progress = ppc_printk_progress;
	mark_initmem_nx();
	init_mem_is_free = true;
	free_initmem_default(POISON_FREE_INITMEM);
}

Loading