Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6511323rwb; Wed, 18 Jan 2023 06:10:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXugxdPpZo+lfPC12k8kBT2Ipj0gWSdbsfLHN+rkLF84T231bOQlyaX0hepdEqDGIsSQTqMf X-Received: by 2002:a05:6a20:139b:b0:b8:2e75:e456 with SMTP id w27-20020a056a20139b00b000b82e75e456mr9291870pzh.1.1674051057663; Wed, 18 Jan 2023 06:10:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674051057; cv=none; d=google.com; s=arc-20160816; b=jblNn3yXTTMw3paed1TTWts3u4wkCNYJm84GIxKZyFQU04KkciPTAm7jIItE4RKJ5V 8/azytUq8gIHDPWgX2/DXO2yVz6R5vhbL26Qo3lrLO+UbtRXB6kV/VYN/WQkZcFIjek3 shqC1H+x4SQ6J5fuNBEhOBjt3a/rQsjy2I5t7yAS6j6B1nhGhGdg36f5ud96QxA0cSxt d46lT3Mu5BbYOJabRw30e22KFlFmZzKjYYlTo0PUJyVnL05RJJGDVf8Kt6t23NGKv2Gm vO7/kPrHtHiiNaAxSoN956lSy6ryzkg5JJppb9NjwN+GG6athnObmwJv9N2/msIQVmnn G98A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lgpBFeaFQunQ4z8vzxyb8samgJW4xC8SPbAKAJLCtCA=; b=h9vVSG26OAGvRzQJ4WsalU3qbNoX0zAi6E/lwYJ1OcDkOi77uKdmWZtilVMWKrLRh+ ikjz6jsF9umHdisOF2mnv6QOTWCrKAoV0i8scMmcoYurQnJc5hXuK4R3YvZyfYgR6qQB HXxoMZkJ9Zk9sucnOm5r6laXewVATpifJTpwB6xJM64yf9jnz8JTi1/CPGL7x9k7020/ TUEqw4xfNd0ToVBU5w/ERu3TNWlzVO9NFvXaVD2OpRtNDIDwe/FoZJy/frV6JU6lQxwf f0C6TITWVgRD/AxLVQnQICv81LA+r9HxdMg7FM3GpqW1VGxSamKsjBc8emC62mOzrOqS smrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JJE4rrtp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk13-20020a056a02028d00b004787df29e4fsi30791175pgb.515.2023.01.18.06.10.52; Wed, 18 Jan 2023 06:10:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JJE4rrtp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230289AbjARODS (ORCPT + 45 others); Wed, 18 Jan 2023 09:03:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229872AbjAROC4 (ORCPT ); Wed, 18 Jan 2023 09:02:56 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8332953F9A; Wed, 18 Jan 2023 05:37:16 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0FDCC617D4; Wed, 18 Jan 2023 13:37:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A6C1C433D2; Wed, 18 Jan 2023 13:37:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674049035; bh=0xJGKj3eRqUoWBwB+TjH6T+WceRDQEQkTnoUc5UVybU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JJE4rrtphL6e9IS0xXRTIi59Nl06Yzx++7lIR0xkpflGRDTvhL5qpX1KhZaufA6/e PWP2ddV4Otbx3auIz1juBpjuGyN4Lfjq4dU23T0R3rgLIvDidvpQviKjxQQJiLm7RH 1W6m4T22I/hRnJA95HUDZWXHfH/nSi0WmZXbBK0Ib5Z5mp4bnh/qGAy7SAfW1rievj ZflxyWBYcH+PAfay5lwQPcWpSE+aMWiIbnDVz9NrJaej1Kasp21ElOz0tTOQv5+rZ2 mNvdxWF13kzf+54tGC1KfaJG0NNafipHU3isqHfeWtZJXuizeN/y6ndWVgTNPuGgCg OS0haJ8FVyzUg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id BBAB7405BE; Wed, 18 Jan 2023 10:37:12 -0300 (-03) Date: Wed, 18 Jan 2023 10:37:12 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Jiri Olsa , Sohom Datta , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Namhyung Kim , Sohom Datta , linux-perf-users , LKML Subject: Re: [PATCH] Prevent normalize() from reading into undefined memory Message-ID: References: <20221204105836.1012885-1-sohomdatta1+git@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Sun, Jan 08, 2023 at 04:55:59PM -0800, Ian Rogers escreveu: > On Sun, Jan 8, 2023, 6:13 AM Jiri Olsa wrote: > > > On Sun, Dec 04, 2022 at 04:28:35PM +0530, Sohom Datta wrote: > > > The current implementation does not account for a > > > trailing backslash followed by a null-byte. If a > > > null-byte is encountered following a backslash, > > > normalize() will continue reading (and potentially > > > writing) into garbage memory ignoring the EOS > > > null-byte. > > > > > > Signed-off-by: Sohom Datta > > > > Acked-by: Jiri Olsa > > > > thanks, > > jirka > > > > Acked-by: Ian Rogers Thanks, applied. Sorry for the delay, probably I didn't saw the "perf tools: ' prefix in the subject and this fell thru the cracks :-\ Thanks to Ingo for pinging me about this, appreciated. - Arnaldo > Thanks, > Ian > > > --- > > > tools/perf/util/expr.l | 5 ++++- > > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > > > diff --git a/tools/perf/util/expr.l b/tools/perf/util/expr.l > > > index 0168a9637330..d47de5f270a8 100644 > > > --- a/tools/perf/util/expr.l > > > +++ b/tools/perf/util/expr.l > > > @@ -42,8 +42,11 @@ static char *normalize(char *str, int runtime) > > > char *dst = str; > > > > > > while (*str) { > > > - if (*str == '\\') > > > + if (*str == '\\') { > > > *dst++ = *++str; > > > + if (!*str) > > > + break; > > > + } > > > else if (*str == '?') { > > > char *paramval; > > > int i = 0; > > > -- > > > 2.38.1 > > > > >