Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3667408pxb; Mon, 24 Jan 2022 14:53:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4pSMcqOj6rsFOh1b/2nkeCKah6Xn3wakIHaJC8Rp3mv1X4yjUAP4H6ESw2AtSHBT5RUo6 X-Received: by 2002:a17:902:ea11:b0:14b:59b9:cda2 with SMTP id s17-20020a170902ea1100b0014b59b9cda2mr5000298plg.157.1643064831117; Mon, 24 Jan 2022 14:53:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643064831; cv=none; d=google.com; s=arc-20160816; b=FN8n+aOTChzef6oXmSxKiIL4GzDU59Pz8eDXxT7skF4p80tdQ+FdZ9Qqp0M0h6zPvp 17TYECUu8of4X2RkqOkg+WKGm3m01VWaZFDmXpDsYOdCBVWaPhXXPzA0LzLnxJP8QV9p ZwqXXW2u1Ns+/wwFNAWuate29H0YS5XvKEoO89o0n9QmvrufAe+SGSAMPHJ29e9NZHRd 3Bn76o6t1uYsEemc2/Cu0HVxPug4+7K6y1+ajr6skVfq/LhNxVGj8On3FRva+02eE50v j6Cu9xL7LL1E75uwP+6+0F7gKiixI6zvCHIybOG7gfP5pLcvtoaKoPiAGsWH6VL+UsAS gc0w== 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=MdR6YgKx52rC8IQ+g5czaAFnWOAHH2W1+j+T+EPi3Qej2ZNwdg12cLECTrGUtfKa1a 2lVZ4DHdyk/oePf4PaJk7UTGMh2fM+PmivmomFolrQGEJCbWsFwLZgO9M2BnyxwLAMQ4 7dk5YdhmVq/qqalRTfdayElfmjAubWErwZeyRwmUJYX2B4rEGzbQQIG5YqfdrZ4N3HsR +aN9RnCt/h/fDa2hXqqK6VuDecGtlDHOVwANylMnTiu+aKCqYTCBgcSOECw0r7P7rzt5 kUv97jG1xmx/jjljfqpLsc7S6iXwZ3qR2X3wDqowaj0QN7qJ41vCsb9hoxqM+AdfgJQH b5cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zyHutr7z; 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 p10si13638914pls.262.2022.01.24.14.53.39; Mon, 24 Jan 2022 14:53:51 -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=zyHutr7z; 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 S1383921AbiAXWs1 (ORCPT + 99 others); Mon, 24 Jan 2022 17:48:27 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52676 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573040AbiAXVm5 (ORCPT ); Mon, 24 Jan 2022 16:42:57 -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 ams.source.kernel.org (Postfix) with ESMTPS id C9146B80CCF; Mon, 24 Jan 2022 21:42:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F051DC340E4; Mon, 24 Jan 2022 21:42:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060574; bh=X24xw2mD4tZTlOt+v1NYqsBi5NtBEk4lzJIRzF3aMqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zyHutr7z8UURwPEUTlHN4ZGqgCXErOqj5WjYbuSVXbVZA9bmFVf/BIUVCUYnwmMru U94o4KXb2adYhVyYzr9k/eT3bjWLiLUrLGvWbRY2jgMI/tMCMh6sdizG0896Ew9nmY 1rQFqZYZIfu1NlVhdOlKuaVZJejI6Iq8LNdvzh0g= 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.16 0993/1039] perf script: Fix hex dump character output Date: Mon, 24 Jan 2022 19:46:22 +0100 Message-Id: <20220124184158.668119314@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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, " ");