linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kprobes: add the "tls" argument for j_do_fork
@ 2016-04-14  9:16 Huang Shijie
  2016-04-18 13:45 ` Petr Mladek
  2016-04-22 20:58 ` Andrew Morton
  0 siblings, 2 replies; 5+ messages in thread
From: Huang Shijie @ 2016-04-14  9:16 UTC (permalink / raw)
  To: akpm
  Cc: pmladek, steve.capper, linux-kernel, masami.hiramatsu.pt, nd,
	Huang Shijie

The patch "3033f14a clone: support passing tls argument via C rather ..."
added the tls argument for _do_fork(). The patch adds the "tls" argument
for j_do_fork to make it match  _do_fork().

Acked-by: Steve Capper <steve.capper@arm.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Huang Shijie <shijie.huang@arm.com>
---
 samples/kprobes/jprobe_example.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/kprobes/jprobe_example.c b/samples/kprobes/jprobe_example.c
index c285a3b..c3108bb 100644
--- a/samples/kprobes/jprobe_example.c
+++ b/samples/kprobes/jprobe_example.c
@@ -25,7 +25,7 @@
 /* Proxy routine having the same arguments as actual _do_fork() routine */
 static long j_do_fork(unsigned long clone_flags, unsigned long stack_start,
 	      unsigned long stack_size, int __user *parent_tidptr,
-	      int __user *child_tidptr)
+	      int __user *child_tidptr, unsigned long tls)
 {
 	pr_info("jprobe: clone_flags = 0x%lx, stack_start = 0x%lx "
 		"stack_size = 0x%lx\n", clone_flags, stack_start, stack_size);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] kprobes: add the "tls" argument for j_do_fork
  2016-04-14  9:16 [PATCH] kprobes: add the "tls" argument for j_do_fork Huang Shijie
@ 2016-04-18 13:45 ` Petr Mladek
  2016-04-22 20:58 ` Andrew Morton
  1 sibling, 0 replies; 5+ messages in thread
From: Petr Mladek @ 2016-04-18 13:45 UTC (permalink / raw)
  To: Huang Shijie; +Cc: akpm, steve.capper, linux-kernel, masami.hiramatsu.pt, nd

On Thu 2016-04-14 17:16:40, Huang Shijie wrote:
> The patch "3033f14a clone: support passing tls argument via C rather ..."
> added the tls argument for _do_fork(). The patch adds the "tls" argument
> for j_do_fork to make it match  _do_fork().
> 
> Acked-by: Steve Capper <steve.capper@arm.com>
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Signed-off-by: Huang Shijie <shijie.huang@arm.com>

It makes perfect sense.

Reviewed-by: Petr Mladek <pmladek@suse.com>

Thanks,
Petr

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kprobes: add the "tls" argument for j_do_fork
  2016-04-14  9:16 [PATCH] kprobes: add the "tls" argument for j_do_fork Huang Shijie
  2016-04-18 13:45 ` Petr Mladek
@ 2016-04-22 20:58 ` Andrew Morton
  2016-04-25  8:39   ` Petr Mladek
  2016-04-25  9:18   ` Huang Shijie
  1 sibling, 2 replies; 5+ messages in thread
From: Andrew Morton @ 2016-04-22 20:58 UTC (permalink / raw)
  To: Huang Shijie; +Cc: pmladek, steve.capper, linux-kernel, masami.hiramatsu.pt, nd

On Thu, 14 Apr 2016 17:16:40 +0800 Huang Shijie <shijie.huang@arm.com> wrote:

> The patch "3033f14a clone: support passing tls argument via C rather ..."
> added the tls argument for _do_fork(). The patch adds the "tls" argument
> for j_do_fork to make it match  _do_fork().
> 
> ...
>
> --- a/samples/kprobes/jprobe_example.c
> +++ b/samples/kprobes/jprobe_example.c
> @@ -25,7 +25,7 @@
>  /* Proxy routine having the same arguments as actual _do_fork() routine */
>  static long j_do_fork(unsigned long clone_flags, unsigned long stack_start,
>  	      unsigned long stack_size, int __user *parent_tidptr,
> -	      int __user *child_tidptr)
> +	      int __user *child_tidptr, unsigned long tls)
>  {
>  	pr_info("jprobe: clone_flags = 0x%lx, stack_start = 0x%lx "
>  		"stack_size = 0x%lx\n", clone_flags, stack_start, stack_size);

The changelog failed to tell us what are the runtime effects of this
bug.  Please always include this info so that others can decide
which kernel version(s) need fixing.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kprobes: add the "tls" argument for j_do_fork
  2016-04-22 20:58 ` Andrew Morton
@ 2016-04-25  8:39   ` Petr Mladek
  2016-04-25  9:18   ` Huang Shijie
  1 sibling, 0 replies; 5+ messages in thread
From: Petr Mladek @ 2016-04-25  8:39 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Huang Shijie, steve.capper, linux-kernel, masami.hiramatsu.pt, nd

On Fri 2016-04-22 13:58:12, Andrew Morton wrote:
> On Thu, 14 Apr 2016 17:16:40 +0800 Huang Shijie <shijie.huang@arm.com> wrote:
> 
> > The patch "3033f14a clone: support passing tls argument via C rather ..."
> > added the tls argument for _do_fork(). The patch adds the "tls" argument
> > for j_do_fork to make it match  _do_fork().
> > 
> > ...
> >
> > --- a/samples/kprobes/jprobe_example.c
> > +++ b/samples/kprobes/jprobe_example.c
> > @@ -25,7 +25,7 @@
> >  /* Proxy routine having the same arguments as actual _do_fork() routine */
> >  static long j_do_fork(unsigned long clone_flags, unsigned long stack_start,
> >  	      unsigned long stack_size, int __user *parent_tidptr,
> > -	      int __user *child_tidptr)
> > +	      int __user *child_tidptr, unsigned long tls)
> >  {
> >  	pr_info("jprobe: clone_flags = 0x%lx, stack_start = 0x%lx "
> >  		"stack_size = 0x%lx\n", clone_flags, stack_start, stack_size);
> 
> The changelog failed to tell us what are the runtime effects of this
> bug.  Please always include this info so that others can decide
> which kernel version(s) need fixing.

It does not have any visible effects on x86_64. I am not 100% sure
but I think that in the worst case it would print a garbage
but it should not break anything on any other architecture.

The point is that the probe prints only the first 3 arguments.
Therefore as long as these three argumetns are passed the same way
in a function with 5 or 6 argumetns, it should print the right
values.

It prints direct values (not via a pointer), so it should _not_
cause any out of memory access.

Finally, AFAIK, jprobes restore the original stack and registers
when they go back to the original code. So, this "broken" probe
should not cause any harm.

But it is worth fixing, definitely.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kprobes: add the "tls" argument for j_do_fork
  2016-04-22 20:58 ` Andrew Morton
  2016-04-25  8:39   ` Petr Mladek
@ 2016-04-25  9:18   ` Huang Shijie
  1 sibling, 0 replies; 5+ messages in thread
From: Huang Shijie @ 2016-04-25  9:18 UTC (permalink / raw)
  To: Andrew Morton
  Cc: pmladek, steve.capper, linux-kernel, masami.hiramatsu.pt, nd

On Fri, Apr 22, 2016 at 01:58:12PM -0700, Andrew Morton wrote:
> On Thu, 14 Apr 2016 17:16:40 +0800 Huang Shijie <shijie.huang@arm.com> wrote:
> 
> > The patch "3033f14a clone: support passing tls argument via C rather ..."
> > added the tls argument for _do_fork(). The patch adds the "tls" argument
> > for j_do_fork to make it match  _do_fork().
> > 
> > ...
> >
> > --- a/samples/kprobes/jprobe_example.c
> > +++ b/samples/kprobes/jprobe_example.c
> > @@ -25,7 +25,7 @@
> >  /* Proxy routine having the same arguments as actual _do_fork() routine */
> >  static long j_do_fork(unsigned long clone_flags, unsigned long stack_start,
> >  	      unsigned long stack_size, int __user *parent_tidptr,
> > -	      int __user *child_tidptr)
> > +	      int __user *child_tidptr, unsigned long tls)
> >  {
> >  	pr_info("jprobe: clone_flags = 0x%lx, stack_start = 0x%lx "
> >  		"stack_size = 0x%lx\n", clone_flags, stack_start, stack_size);
> 
> The changelog failed to tell us what are the runtime effects of this
> bug.  Please always include this info so that others can decide
> which kernel version(s) need fixing.
I really does not meet any issue with this bug, I just find it when i
read the code.

thanks
Huang Shijie

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-04-25  9:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-14  9:16 [PATCH] kprobes: add the "tls" argument for j_do_fork Huang Shijie
2016-04-18 13:45 ` Petr Mladek
2016-04-22 20:58 ` Andrew Morton
2016-04-25  8:39   ` Petr Mladek
2016-04-25  9:18   ` Huang Shijie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).