Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7385236imu; Tue, 22 Jan 2019 05:17:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN7c1BsM4mOLEeN28MfVFUSG+nz4nNgQ/Be9NH1+jIT9ikMSU4ly1mysVDJMqPp7hHjaoNR1 X-Received: by 2002:a17:902:6909:: with SMTP id j9mr33303825plk.196.1548163051699; Tue, 22 Jan 2019 05:17:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548163051; cv=none; d=google.com; s=arc-20160816; b=Zjd2OkEVquUDkOAorb3ci9ReSYfxCWIqPe5A27dGUeo4VbWtVIWYYL5vhQk6CSx3rX d0MKMayI2tKxpeHP1QcFiLXTcuIVEMAw+PEnd8+zm45ujaRWoTYSY25yTbiXP0gmud2D N6WtKzUIrwa9HZlisnMY8EThCWbDGu37Rb7FGqEamKwuu5A2NLIlDa3LP0SAfsrZSuIH 6UsW3MXGDlFAtYm5Qzi3LiaE3PHUeItgvas5irvh/s0wxyY4Hgoa+05I1PDHi5mLQym/ klXfWE8yYBR2w0hC79MUT6cF9//nWq/XfoiXsaLZCY/z2quEzjqahulP8f+4w2/xnj+a ea5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=D8Cypj3l/6giPgV33UOTFXiRL4jOdGnc7ZWPadx1qsU=; b=HIJadgXMXJiN4417pyLHpuWcBTuodTYLCfda5YyBpWQKtNztZD2I6m7lsMZTcz16ht 9Qyyoq7wP3g+d5ORYTMZ3JRU3YmjUS+p3JcyMQ4LSTHi2EQy6OvGRpMuyA0gJ1o2+QMA t4mEZFQZKbSTLuEXMvNHuojtfoVt3C6eSQzy1vfpCfamWDyxjTNZ3wOx76el5UHu6U8j xLD5FVze6HqhUx9wRUavTI2u4nBRcaBWHFXv04eBenYXM3cgcdQ/c4FnUX+3inVkNjpy /tABvQiY0CizUI/2TT6wXWdwSMz1BhCBNd/8NVnXt8ahOObkbdtfpFNEiuH4RikZAGDe 25VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VgH457gC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si15529102pgc.354.2019.01.22.05.17.15; Tue, 22 Jan 2019 05:17:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VgH457gC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728563AbfAVNOi (ORCPT + 99 others); Tue, 22 Jan 2019 08:14:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:49028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728497AbfAVNOh (ORCPT ); Tue, 22 Jan 2019 08:14:37 -0500 Received: from devbox (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2DFC720870; Tue, 22 Jan 2019 13:14:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548162877; bh=wpHWv2lBjNuRU9K6Mk5iFFQNy7G/c5VNAaGQMGFgIRU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VgH457gCrpGftArMLenkq8xaCM4t58C9uHBjViCaxIEtdL5TL71xmDH6SdPcy8cn5 FvICiNZO7oU2yxP4Ix5EZe0qRwMTKUTRnQfFxRgePw5DOtn8UswvcuBG0jIvftg94v 7JcC8+BpcOjtc3LUJGQdyNxKQUGJAz2GFKxobcuA= Date: Tue, 22 Jan 2019 22:14:34 +0900 From: Masami Hiramatsu To: Andreas Ziegler Cc: Steven Rostedt , Ingo Molnar , Masami Hiramatsu , linux-kernel@vger.kernel.org Subject: Re: [PATCH] tracing: probeevent: Correctly update remaining space in dynamic area Message-Id: <20190122221434.419e956dd91da0516ff4cc04@kernel.org> In-Reply-To: <20190122124848.17774-1-andreas.ziegler@fau.de> References: <20190122124848.17774-1-andreas.ziegler@fau.de> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 22 Jan 2019 13:48:48 +0100 Andreas Ziegler wrote: > Commit 9178412ddf5a ("tracing: probeevent: Return consumed > bytes of dynamic area") improved the string fetching > mechanism by returning the number of required bytes after > copying the argument to the dynamic area. However, this > return value is now only used to increment the pointer > inside the dynamic area but misses updating the 'maxlen' > variable which indicates the remaining space in the dynamic > area. Oops! Good catch! :) > > This means that fetch_store_string() always reads the *total* > size of the dynamic area from the data_loc pointer instead of > the *remaining* size (and passes it along to > strncpy_from_{user,unsafe}) even if we're already about to > copy data into the middle of the dynamic area. > This looks good to me. Acked-by: Masami Hiramatsu Thank you!! > Fixes: 9178412ddf5a ("tracing: probeevent: Return consumed bytes of dynamic area") > Signed-off-by: Andreas Ziegler > --- > kernel/trace/trace_probe_tmpl.h | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/kernel/trace/trace_probe_tmpl.h b/kernel/trace/trace_probe_tmpl.h > index 5c56afc17cf8..0cf953e47584 100644 > --- a/kernel/trace/trace_probe_tmpl.h > +++ b/kernel/trace/trace_probe_tmpl.h > @@ -182,8 +182,10 @@ store_trace_args(void *data, struct trace_probe *tp, struct pt_regs *regs, > ret = process_fetch_insn(arg->code, regs, dl, base); > if (unlikely(ret < 0 && arg->dynamic)) > *dl = make_data_loc(0, dyndata - base); > - else > + else { > dyndata += ret; > + maxlen -= ret; > + } > } > } > > -- > 2.17.1 > -- Masami Hiramatsu