瀏覽代碼

sparc: Validate that kprobe address is 4-byte aligned.

Otherwise it isn't a valid instruction address.

This is the sparc equivalent of commit
b46b3d70c9c017d7c4ec49f7f3ffd0af5a622277 (kprobes: Checks probe
address is instruction boudary on x86)

Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller 15 年之前
父節點
當前提交
936cf25178
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      arch/sparc/kernel/kprobes.c

+ 3 - 0
arch/sparc/kernel/kprobes.c

@@ -46,6 +46,9 @@ struct kretprobe_blackpoint kretprobe_blacklist[] = {{NULL, NULL}};
 
 int __kprobes arch_prepare_kprobe(struct kprobe *p)
 {
+	if ((unsigned long) p->addr & 0x3UL)
+		return -EILSEQ;
+
 	p->ainsn.insn[0] = *p->addr;
 	flushi(&p->ainsn.insn[0]);