lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A086CA4.4030302@redhat.com>
Date:	Mon, 11 May 2009 14:21:24 -0400
From:	Masami Hiramatsu <mhiramat@...hat.com>
To:	Steven Rostedt <rostedt@...dmis.org>
CC:	Ingo Molnar <mingo@...e.hu>, lkml <linux-kernel@...r.kernel.org>,
	systemtap <systemtap@...rces.redhat.com>,
	kvm <kvm@...r.kernel.org>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Jim Keniston <jkenisto@...ibm.com>
Subject: Re: [PATCH -tip v5 2/7] kprobes: checks probe address is instruction
 boudary on x86

Steven Rostedt wrote:
> On Mon, 11 May 2009, Masami Hiramatsu wrote:
>>>> +	 * by fix_riprel().
>>>> +	 */
>>>> +	memcpy(buf, kp->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
>>>> +	buf[0] = kp->opcode;
>>> Why is it OK to copy addr to "buf" and then rewrite the first character of 
>>> buf?  Does it have something to do with the above "p"?
>> Yes, each kprobe copied probed instruction to kp->ainsn.insn,
>> which is an executable buffer for single stepping.
>> So, basically, kp->ainsn.insn has an original instruction.
>> However, RIP-relative instruction can not do single-stepping
>> at different place, fix_riprel() tweaks the displacement of
>> that instruction. In that case, we can't recover the instruction
>> from the kp->ainsn.insn.
>>
>> On the other hand, kp->opcode has a copy of the first byte of
>> the probed instruction, which is overwritten by int3. And
>> the instruction at kp->addr is not modified by kprobes except
>> for the first byte, we can recover the original instruction
>> from it and kp->opcode.
> 
> For code that is awkward, complex or non-trivial, don't be afraid to put 
> in a paragraph explaining the code. The above explanation should be a 
> comment in the code. Otherwise people like me would just look at it and 
> say "huh?".
> 
> Note, I'm a bit cranky this morning, so I hope I don't offend anyone.

No, that's very helpful review for me. Thanks :-)


-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@...hat.com

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ