Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3455842pxu; Tue, 8 Dec 2020 12:31:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyt+2NZrYotftexyvkBAkOZklhOW1kzTE2KTIT/QmLFnGK3hq/nDUkbAPq/TPAfgNYcun+K X-Received: by 2002:a17:906:52c4:: with SMTP id w4mr24892652ejn.165.1607459491178; Tue, 08 Dec 2020 12:31:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607459491; cv=none; d=google.com; s=arc-20160816; b=s+0gzqcCJTJgU6Gsl1Jja1u9Y35jpllq1w/C9dtUIWgXAPvnB5bw9NjoxQfCL4c3mX ClgEpIOwOIMnCFzymJKCczpAvEgnv1ZnXraPgLZwOKT+L6UVEOaXQv+kiJeABFQSb9U2 JWJJluxLRRWcodabfmlJVKNOlqCa8zcNhrRMEH1dnRSpnASZqy/yM8dJYwBqsi7lyjiE UOeZUFKlYN9qwgnPizn6hgftwxxoMhbpqKC6IlCsSTGfE/XSZ8QCXBm8wBSKjxNsUJYj oIHvOxziU9uRAW1kxb3werC0keRHS/Y86ZOoYvmHNZJZ25+5r6Q4/vFxr/HJyehsRou7 tKLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:dkim-signature :message-id; bh=/PqDFVwkWMdbw1G/6951u+BRw2rEnoDrWEjEARCHw/M=; b=NJU83GV4Z0yziS0DvrB3omPOX8zcRcZL4mfnzZhbVp+JzPJjjuuxUirf2KOgzI+Pmc ZWXtP6jxADZQuAThNzou2KxQoBvlNkKjUC5y7x0N+huuz5GN5uslU/Yt+Ny9LOuAODyu jUJpwb6yvS7bmoNi1PJC8DpJ0X0pk76/DCp6sCiqY9efn4/iR3HhjL6A1s2ZD+JYH/aM WHx6yhvoc/oVwNXg8iIhDm8k6r0ockozz1GCJG21M756jZ/7L1Ddcv/kYlko2CeijZba wrh0snlkG8wA53Cers6l5w9twEqmXCltyP3VxJhp0yL7EGGFSgj6KhRX5r6ANy0OP1Qa H0qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="BU/L4KzC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id u21si10931308edx.350.2020.12.08.12.31.07; Tue, 08 Dec 2020 12:31:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="BU/L4KzC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1731050AbgLHScx (ORCPT + 99 others); Tue, 8 Dec 2020 13:32:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:54978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728633AbgLHScu (ORCPT ); Tue, 8 Dec 2020 13:32:50 -0500 Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607452330; bh=1jrzgTIJpW1sSBE3ZIOppEbfh6AvSKZMoSp0P40Y68Y=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=BU/L4KzCjzCyvQ/rLg2QtY/05SEsveztssPsOTsWEDvqljd1hcvPYiglLC59NDEs7 mDE+2ZtdDkkDSoaYsZGwjWxKqiWbMM9nnrQ4/1MBEf/4rIh83TiTFK/ouerzFtZl8+ mlwsB5jikzLisC5W61TDZAxB7AvVUjlVCzrfXohE0X55dG1DDc6FTRmy1uopzEhYeu pGwA4aRcPww2qYIMY3unhif/YGZ1Udd/WH+0nCEgcm+bOTQ0+eSluhi8UUVXe2lkHt IdcHdzAGAV3K1Mre8MQUox/5tsAN3XdSPu2EanwV5BgWUxdfSteeGOENQjU/d5vfAU tj4CKZP9UlH2A== Subject: Re: [PATCH v3 3/5] tracing: Update synth command errors From: Tom Zanussi To: Steven Rostedt Cc: axelrasmussen@google.com, mhiramat@kernel.org, linux-kernel@vger.kernel.org Date: Tue, 08 Dec 2020 12:32:08 -0600 In-Reply-To: <20201208125340.407150f2@gandalf.local.home> References: <8671adc7ce95ff1d5c7b037d371467e96f7f2914.1603723933.git.zanussi@kernel.org> <20201207201304.627bfe48@oasis.local.home> <44b9e471f0d3b77ab0a2bf11024e2e72c1f1a80d.camel@kernel.org> <20201208125340.407150f2@gandalf.local.home> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Steve, On Tue, 2020-12-08 at 12:53 -0500, Steven Rostedt wrote: > On Tue, 08 Dec 2020 11:34:41 -0600 > Tom Zanussi wrote: > > > Unfortunately, you're correct, if you have a script that creates a > > synthetic event without semicolons, this patchset will break it, as > > I > > myself found out and fixed in patch 4 ([PATCH v3 4/5] > > selftests/ftrace: > > Add synthetic event field separators) [4]. > > > > So whereas before this would work, even though it shouldn't have in > > the > > first place: > > > > # echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > > > synthetic_events > > > > it now has to be: > > > > # echo 'wakeup_latency u64 lat; pid_t pid; char comm[16]' > > > synthetic_events > > > > So yeah, this patchset fixes a set of parsing bugs for things that > > shouldn't have been accepted as valid, but shouldn't break things > > that > > are obviously valid. > > > > If it's too late to fix them, though, I guess we'll just have to > > live > > with them, or some other option? > > > I would suggest allowing the old interface work (with no new > features, for > backward compatibility), but new things like "char comm[16]" we > require > semicolons. > > One method to do this is to add to the start of reading the string, > and > checking if it has semicolons. If it does not, we create a new string > with > them, but make sure that the string does not include new changes. > > strncpy_from_user(buffer, user_buff, sizeof(buffer)); > > if (!strstr(buffer, ";")) { > if (!audit_old_buffer(buffer)) > goto error; > insert_colons(buffer); > } > > > That is, if the buffer does not have semicolons, then check if it is > a > valid "old format", and if not, we error out. Otherwise, we insert > the > colons into the buffer, and process that as if the user put in > colons: > > That is: > > echo 'wakeup_latency u64 lat pid_t pid' > synthetic_events > > would change the buffer to: > > "wakeup_latency u64 lat; pid_t pid;" > > And then put it through the normal processing. I think its OK that if > the > user were to cat out the synthetic events, it would see the > semicolons even > if it did not add them. As I don't think that will break userspace. > > Does that make sense? > Yeah, that should work, I'll try adding that. Thanks, Tom > -- Steve