Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3977487pxb; Tue, 25 Jan 2022 00:28:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwqnV+2KS5TwkEsq4i3ceBL+4zYlV3wXpvNSceQKEKu4z1x99WCXcFCCedW809Il0wUEMxt X-Received: by 2002:aa7:dc15:: with SMTP id b21mr19020398edu.237.1643099323008; Tue, 25 Jan 2022 00:28:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643099323; cv=none; d=google.com; s=arc-20160816; b=Uw84Ccy3H+zD5AXyNUcEfBBmFB5tW1y7zRAofcYS3F6c4RaUiUmbC28Ov/G4Asv+cO Qb/+JKhqHRbUA9QW5m7/kBIeckv5mNqHpBqKDAS3GqA8XgtTh5shWX5PS92Q/+vqYHGk QlqNuMJy3ImBsxsFfa9PDxUt2n6Ul0+sBl2kGmdtlM48MZ5J9vlMO04pBkwO7VC5S/a/ e/UqcwT4ghrv53qOouTzTuYOdS50RcehfzEdonW1IjV1CcTVj88Oqx6Q9lnnxxhTm5Ea 7JlWqfeEq3yVIf3QLNfvalbBxcpkuxHqV5ePHef8WPEU8/whF1uYjHjqGnERKnr9pbDY VvJg== 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=pQoGnAH/TxgPZmrrePQaWDBt8wUSqTrqm7Hkl9QJEU0=; b=N/BNMriN6BSRA0hojSrqJZ8g9Q1GrKQki7jrAKj8ptLh2/zXixffkDY53mkAuqDXTc UOhTmdTgLPqdMUDu8P19QBu/lnV3dgxIAUW4FQFrp77D1hCUsW7Yq+YyiZeYF6r9D1zC iES9vDNr4hiNQh69MiKfBXSC+5yrvWhwBfsILb01J6SY1rSkvvlUU1vkgl2U/BF+B9Wz dECsKIbtaB5m+xQYtXyWyJdCcxLFz+WYkNEW8rxsI3/Llp3qWVnQri2qcdW4YBu9V0vd RXSynKNmWNFSXme8O0qllKj3DZ0VCiqf71Qv/YCVTKQ7LCIyMUnZbQ0ZL3m/SE8tKiNJ C2QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PojPSSQs; 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 o11si1788403ejy.636.2022.01.25.00.28.18; Tue, 25 Jan 2022 00:28:42 -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=PojPSSQs; 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 S3422031AbiAYCaA (ORCPT + 99 others); Mon, 24 Jan 2022 21:30:00 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:36582 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378794AbiAXUJv (ORCPT ); Mon, 24 Jan 2022 15:09:51 -0500 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 5621F6136F; Mon, 24 Jan 2022 20:09:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F58DC340E5; Mon, 24 Jan 2022 20:09:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054990; bh=ZJUZG0M+EAzk8WRfF9nqPauGl/R5HVk9Iof7QH3bIac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PojPSSQsFl4wv6+XNElg9rV2IwILkaFEXSl6JSlCNdImVuofUutU4pr0w8YFL74mh mpU3ej8ZXfixaMbbwqo3IW+oSlttm8nw1DgrhkcgGdHO2Znq5FPTbq+YECduohEp5u vRgEErbtbmI5N+u1V33Jf/1U1mw8fAyINh6qq9HU= 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.10 539/563] perf script: Fix hex dump character output Date: Mon, 24 Jan 2022 19:45:04 +0100 Message-Id: <20220124184043.078437690@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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 @@ -145,7 +145,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, " ");