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

Commit 26156397 authored by Jie Zhang's avatar Jie Zhang Committed by Bryan Wu
Browse files

Blackfin arch: Allow ptrace access the fixed code.



Signed-off-by: default avatarJie Zhang <jie.zhang@analog.com>
Signed-off-by: default avatarBryan Wu <bryan.wu@analog.com>
parent 8a26ac70
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
#include <asm/processor.h>
#include <asm/asm-offsets.h>
#include <asm/dma.h>
#include <asm/fixed_code.h>

#define MAX_SHARED_LIBS 3
#define TEXT_OFFSET 0
@@ -169,6 +170,9 @@ static inline int is_user_addr_valid(struct task_struct *child,
		    && start + len <= (unsigned long)sraml->addr + sraml->length)
			return 0;

	if (start >= FIXED_CODE_START && start + len <= FIXED_CODE_END)
		return 0;

	return -EIO;
}

@@ -215,8 +219,12 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
				copied = sizeof(tmp);
			} else
#endif
			copied =
			    access_process_vm(child, addr + add, &tmp,
			if (addr + add >= FIXED_CODE_START
			    && addr + add + sizeof(tmp) <= FIXED_CODE_END) {
				memcpy(&tmp, (const void *)(addr + add), sizeof(tmp));
				copied = sizeof(tmp);
			} else
				copied = access_process_vm(child, addr + add, &tmp,
							   sizeof(tmp), 0);
			pr_debug("ptrace: copied size %d [0x%08lx]\n", copied, tmp);
			if (copied != sizeof(tmp))
@@ -281,8 +289,12 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
				copied = sizeof(data);
			} else
#endif
			copied =
			    access_process_vm(child, addr + add, &data,
			if (addr + add >= FIXED_CODE_START
			    && addr + add + sizeof(data) <= FIXED_CODE_END) {
				memcpy((void *)(addr + add), &data, sizeof(data));
				copied = sizeof(data);
			} else
				copied = access_process_vm(child, addr + add, &data,
							   sizeof(data), 1);
			pr_debug("ptrace: copied size %d\n", copied);
			if (copied != sizeof(data))