From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754072AbcDYIkA (ORCPT ); Mon, 25 Apr 2016 04:40:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:50048 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753894AbcDYIj7 (ORCPT ); Mon, 25 Apr 2016 04:39:59 -0400 Date: Mon, 25 Apr 2016 10:39:56 +0200 From: Petr Mladek To: Andrew Morton Cc: Huang Shijie , steve.capper@arm.com, linux-kernel@vger.kernel.org, masami.hiramatsu.pt@hitachi.com, nd@arm.com Subject: Re: [PATCH] kprobes: add the "tls" argument for j_do_fork Message-ID: <20160425083956.GF2749@pathway.suse.cz> References: <1460625400-22319-1-git-send-email-shijie.huang@arm.com> <20160422135812.657b9c02f65a94ac1c34cc45@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160422135812.657b9c02f65a94ac1c34cc45@linux-foundation.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 2016-04-22 13:58:12, Andrew Morton wrote: > On Thu, 14 Apr 2016 17:16:40 +0800 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(). > > > > ... > > > > --- 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