Skip to contentSkip to conversation

Multiple kprobes per address

DISCUSSION Rusty Lynch 2 participants 4 messages Nov 8, 2002 – Nov 12, 2002

lore
Share & tools
lore
#0 lore raw

I noticed that kprobes is designed around the idea of only allowing a single probe point per probe address. Why not allow multiple probe points for a given probe address? Is it a way of limiting complexity?

It looks like it would be fairly straight forward to change get_kprobe(addr) to be get_kprobes(addr) where it returns a list of probe points associated with the address, and then tweak do_int3 to work through the entire list. Would such a change be acceptable?

-rustyl

#1 lore raw

Hi,

Quoted 4 lines · Rusty Lynch

I noticed that kprobes is designed around the idea of only allowing a single probe point per probe address. Why not allow multiple probe points for a given probe address? Is it a way of limiting complexity?

We didn't think it would be useful and conceptually, it is simpler to think of one probe at an address.

Quoted 5 lines

It looks like it would be fairly straight forward to change get_kprobe(addr) to be get_kprobes(addr) where it returns a list of probe points associated with the address, and then tweak do_int3 to work through the entire list. Would such a change be acceptable?

It will be trivial to add this, but why? Is there a good reason for wanting to do this (multiple kprobes at same address) as opposed to doing all you want done on a probe hit in a single handler?

Regards,
Vamsi.

Signature · 5 lines
Vamsi Krishna S.
Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: +91 80 5044959
Internet: [email protected]
#2 lore raw

I was really only concerned with multiple consumers of kprobes. So if I were to create some tool that used kpobes to hook into the kernel, and someone else were to create another tool that solved a different problem but also used kprobes then the two tools wouldn't play nice with each other.

-rustyl

----- Original Message -----
From: "Vamsi Krishna S ." <[email protected]>
To: "Rusty Lynch" <[email protected]>
Cc: <[email protected]>
Sent: Monday, November 11, 2002 12:05 AM
Subject: Re: Multiple kprobes per address

Quoted 11 lines

Hi,

Quoted 4 lines · Rusty Lynch

I noticed that kprobes is designed around the idea of only allowing a single probe point per probe address. Why not allow multiple probe points for a given probe address? Is it a way of limiting complexity?

We didn't think it would be useful and conceptually, it is simpler to think of one probe at an address.

Quoted 1 line

It looks like it would be fairly straight forward to change

get_kprobe(addr)

Quoted 1 line
Quoted 1 line

to be get_kprobes(addr) where it returns a list of probe points

associated

Quoted 1 line
Quoted 1 line

with the address, and then tweak do_int3 to work through the entire

list.

Quoted 14 lines
Quoted 2 lines

Would such a change be acceptable?

It will be trivial to add this, but why? Is there a good reason for wanting to do this (multiple kprobes at same address) as opposed to doing all you want done on a probe hit in a single handler?

Regards,
Vamsi.
--
Vamsi Krishna S.
Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: +91 80 5044959
Internet: [email protected]

#3 lore raw
Quoted 4 lines · Rusty Lynch

I was really only concerned with multiple consumers of kprobes. So if I were to create some tool that used kpobes to hook into the kernel, and someone else were to create another tool that solved a different problem but also used kprobes then the two tools wouldn't play nice with each other.

There will be a problem when both the tools (built on top of kprobes) try to place probes at the same address: only the first probe actually succeds, the second one gets -EEXIST from register_kprobe.

This could be made to work, but at the moment, it seems unnecessary complication to me. Lets reconsider it when it really becomes a problem.

Thanks,
Vamsi.

Signature · 5 lines
Vamsi Krishna S.
Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: +91 80 5044959
Internet: [email protected]