On Mon, 2006-06-12 at 09:15 -0400, Mike Grundy wrote:
> +int __kprobes arch_prepare_kprobe(struct kprobe *p)
> +{
> + int ret = 0;
> +
> + /* Make sure the probe isn't going on a difficult instruction */
> + if (is_prohibited_opcode((kprobe_opcode_t *) p->addr))
> + ret = -EINVAL;
> +
> + /* Use the get_insn_slot() facility for correctness */
> + if (!ret) {
> + p->ainsn.insn = get_insn_slot();
> + if (!p->ainsn.insn) {
> + ret = -ENOMEM;
> + } else {
> + /* this should only happen if you got the slot */
> + memcpy(p->ainsn.insn, p->addr,
> + MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
> + p->ainsn.inst_type =
> + get_instruction_type(p->ainsn.insn);
> + }
> + }
> + p->opcode = *p->addr;
> + return ret;
I think we should also check for correct instruction alignment in this
function (2 bytes on s390), like:
if ((unsigned long)p->addr & 0x01) {
printk("Attempt to register kprobe at an unaligned address\n");
return -EINVAL;
}
Jan
---
Jan Glauber
IBM Linux Technology Center
Linux on zSeries Development, Boeblingen
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]