Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3685231pxb; Mon, 24 Jan 2022 15:18:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJx14brISV80w9H8FePLoF1gceyPsqIM+84uSqwkVX31eOsHTbtwebflcER+lV2XTFrHHsBB X-Received: by 2002:a17:902:b10d:b0:14b:4e8c:4859 with SMTP id q13-20020a170902b10d00b0014b4e8c4859mr6612467plr.95.1643066327965; Mon, 24 Jan 2022 15:18:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643066327; cv=none; d=google.com; s=arc-20160816; b=Ojs5nTkMAwjVkbuwGHGsFbvtpAlreTLv0sEEqTkSoJbRqn6LRVn7LUcYVGfgoO9Sz1 MA2JE1weCfhtiTErMjkgXDY+6pt2cWJwO3F4HNS0fFqa8s88WTJ34tkLRWCqiAVjQeCw yVebexiuzlfMnasI3SY5yGgVCPYpdk04cwxCJNSZ3hgc3CIO+FrpxAiTU0vkfiORfSI2 4l10KqviVXZmeq544aHhEBYisw+q5wGzTqlJ1fTAxOhwGr3UZuHaiEZhYHpPZDyGg/SJ SMZqpiuMfQggO9DMS6Rw0DO8AjSOpZKhDl/WXZDJ+pAib1q43jwt2JryfMRsGYPtqh3v 4K/g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Im7l0YKYrjF2IGQkXrO7pKYBjdxaMefxYDKN9ki+mso=; b=0Teq9QR6kLwOYOxCytDSV3c4DQHRoMsIZOkD3AQufYLleeVeRHMfA+sB6sDzxdgoSF u4UCupnJGHYG/MNLYiAw3l5ZzPXaeDikeY/2sa0i7Uw9G4L90CGIskzjX6ZGe2wmIqL1 Gg1whhu5CUreM+rtDWQTUJy43hc+pDoY2bnFfWg+jKILmh7zxMhrvtwdWd8OeVocl0ia GdyDLGJQd3/Zud0BuDMts/u40rxtTPn9Qenhr1QDsnl4zhW7ddRfjA5fBFlAnyOSLMHG HAnZP7hpdkxlt8BxQvm8wX5xTOXUF0wkoExORU7CppQjG/P0c9xIS2PncCG3Vr/s/oVP Ojkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pQyq2A88; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b19si14430461plz.574.2022.01.24.15.18.36; Mon, 24 Jan 2022 15:18:47 -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=@linuxfoundation.org header.s=korg header.b=pQyq2A88; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1845435AbiAXXMU (ORCPT + 99 others); Mon, 24 Jan 2022 18:12:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1584556AbiAXWVY (ORCPT ); Mon, 24 Jan 2022 17:21:24 -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 7C4C1C0424D7; Mon, 24 Jan 2022 12:50:44 -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 1DC7560C60; Mon, 24 Jan 2022 20:50:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF037C340E5; Mon, 24 Jan 2022 20:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057443; bh=X24xw2mD4tZTlOt+v1NYqsBi5NtBEk4lzJIRzF3aMqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pQyq2A88YfdB9S1mkH3paiM5sp9F9130st8jeZllRwy8bK1VRNc8ElqcD3RkzFHXj ZXAHuq0kWtKxN1OBMn+B2Pam35CjYYqpuxeHvIKnrssgQGm/XMCdkTZiP9WefrdcOC 1y8Pce9rsG4lsPgpZbJnK606hWyZWl2UklAeanPQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Jiri Olsa , Arnaldo Carvalho de Melo Subject: [PATCH 5.15 814/846] perf script: Fix hex dump character output Date: Mon, 24 Jan 2022 19:45:31 +0100 Message-Id: <20220124184128.991857209@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Adrian Hunter commit 62942e9fda9fd1def10ffcbd5e1c025b3c9eec17 upstream. Using grep -C with perf script -D can give erroneous results as grep loses lines due to non-printable characters, for example, below the 0020, 0060 and 0070 lines are missing: $ perf script -D | grep -C10 AUX | head . 0010: 08 00 00 00 00 00 00 00 1f 00 00 00 00 00 00 00 ................ . 0030: 01 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 ................ . 0040: 00 08 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ . 0050: 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................ . 0080: 02 00 00 00 00 00 00 00 1b 00 00 00 00 00 00 00 ................ . 0090: 00 00 00 00 00 00 00 00 ........ 0 0 0x450 [0x98]: PERF_RECORD_AUXTRACE_INFO type: 1 PMU Type 8 Time Shift 31 perf's isprint() is a custom implementation from the kernel, but the kernel's _ctype appears to include characters from Latin-1 Supplement which is not compatible with, for example, UTF-8. Fix by checking also isascii(). After: $ tools/perf/perf script -D | grep -C10 AUX | head . 0010: 08 00 00 00 00 00 00 00 1f 00 00 00 00 00 00 00 ................ . 0020: 03 84 32 2f 00 00 00 00 63 7c 4f d2 fa ff ff ff ..2/....c|O..... . 0030: 01 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 ................ . 0040: 00 08 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ . 0050: 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................ . 0060: 00 02 00 00 00 00 00 00 00 c0 03 00 00 00 00 00 ................ . 0070: e2 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ . 0080: 02 00 00 00 00 00 00 00 1b 00 00 00 00 00 00 00 ................ . 0090: 00 00 00 00 00 00 00 00 ........ Fixes: 3052ba56bcb58904 ("tools perf: Move from sane_ctype.h obtained from git to the Linux's original") Signed-off-by: Adrian Hunter Cc: Jiri Olsa Link: http://lore.kernel.org/lkml/20220112085057.277205-1-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c @@ -179,7 +179,7 @@ static int trace_event_printer(enum bina break; case BINARY_PRINT_CHAR_DATA: printed += color_fprintf(fp, color, "%c", - isprint(ch) ? ch : '.'); + isprint(ch) && isascii(ch) ? ch : '.'); break; case BINARY_PRINT_CHAR_PAD: printed += color_fprintf(fp, color, " ");