From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752541AbdBJHxO (ORCPT ); Fri, 10 Feb 2017 02:53:14 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:34281 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751369AbdBJHxL (ORCPT ); Fri, 10 Feb 2017 02:53:11 -0500 Date: Fri, 10 Feb 2017 08:53:02 +0100 From: Ingo Molnar To: Masami Hiramatsu Cc: Steven Rostedt , LKML , Srikar Dronamraju , Namhyung Kim , Andrew Morton Subject: Re: [RFC][PATCH] tracing: Have traceprobe_probes_write() not access userspace unnecessarily Message-ID: <20170210075302.GB24405@gmail.com> References: <20170209180458.5c829ab2@gandalf.local.home> <20170210145006.b387236e4b6813a09d55162b@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170210145006.b387236e4b6813a09d55162b@kernel.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Masami Hiramatsu wrote: > On Thu, 9 Feb 2017 18:04:58 -0500 > Steven Rostedt wrote: > > > > > The code in traceprobe_probes_write() reads up to 4096 bytes from userpace > > for each line. If userspace passes in several lines to execute, the code > > will do a large read for each line, even though, it is highly likely that > > the first read from userspace received all of the lines at one. > > > > I changed the logic to do a single read from userspace, and to only read > > from userspace again if not all of the read from userspace made it in. > > > > I tested this by adding printk()s and writing files that would test -1, ==, > > and +1 the buffer size, to make sure that there's no overflows and that if a > > single line is written with +1 the buffer size, that it fails properly. > > > > Thanks Steve! > > Acked-by: Masami Hiramatsu > > BTW, this can conflict with my previous patch. > > https://lkml.org/lkml/2017/2/6/1048 > https://lkml.org/lkml/2017/2/7/203 > > I'll update this. Ingo, Can I send these patch to Steve? Sure, I've not applied your patch yet - mind sending it to Steve on top of Steve's patch? Thanks, Ingo