Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp280833rdb; Thu, 25 Jan 2024 15:31:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQH+DZROxkH5/FAkWDAo6nvH/1dOBLI2eTTCpCeZAxjehBln0ojIXVD0eSu0HyHlDyZbfZ X-Received: by 2002:a2e:8709:0:b0:2cc:7b1e:15e4 with SMTP id m9-20020a2e8709000000b002cc7b1e15e4mr218677lji.30.1706225508640; Thu, 25 Jan 2024 15:31:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706225508; cv=pass; d=google.com; s=arc-20160816; b=hMP/gVCJXq4Y4f5KVJbK2de36ulEFcJQ/eq8PZplF0b6TRjfHLVjoGMo8UQmsvh9c8 KZo3E9PYEUlibLqJHA76BAW9YEoED0OvbXphMzexet9CjcQgWn7DX1TspfALwtl4cmhb rUdGKnxd6eJSlnkfB7/X0g8SOmX9Y1gdJJL0LO/3Ia1eGP4sUH7MT+pilQO2Rfn7j3tK Am5jb5D6NCVoOS9dd9Ar7C5O6C4IUoOVYhG1i6IwZQ8Ae8uzX5UyPqjfLC1D4AMHqAyH JPQrO7xmLSSnYZp+09hx4hXRINUupLILqZwDuGATNogKwOW85aiGz/iu8rEJmUdc0yLH nkjg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=rHqjgs8+QxlFIbOEf1XBMDmlvl/t8IMshvxEVcI3NVY=; fh=UnmpdUQNNuD51dRbNwZd7vxR4FpEcIq9JTaav0N5tgE=; b=EPqBhqpLgRwxwpGLtlEhN+kSIi3PYPBRoFEo8JJFgulhEYrCpoblNJprXkhrKidKJb MBlQ3vQpnDb3NrNCLCgxQqcR5X+sLhjODYfZiphf7dkHivAI6Ms075zEe9Vs26ssNVJp isgvXOaioQJj8UNNEIfVRJqfzJwLAQYES5PKPp7vcuh1jymH1OV7A9VN4Kqz9qxPtOKD /4ZRghl+BPg5PNdkYVrgEKU+T/NVJpQEV2SNGJlisl6wXnRQGbWH+wHNNV6I4NPr/Spm ulaA+d25xvsgdJNj5OUwAQA1h4eWe6KA/+Dv0CsltSbf5cuoFUgfFyIbIEx+yzM/9cCn +Oqg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-39413-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id j21-20020aa7c415000000b0055a8e749076si6344533edq.573.2024.01.25.15.31.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 15:31:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39413-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-39413-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 459AA1F24C6A for ; Thu, 25 Jan 2024 23:31:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E5CF9134B4; Thu, 25 Jan 2024 23:31:38 +0000 (UTC) Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD73A111A2; Thu, 25 Jan 2024 23:31:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706225498; cv=none; b=jiN0iDTVIsZRawicV1xmQoaFlgGsUD38g5buNoSg8zyx4l9lSwbnMfSrhOosAyjQ4duX5bTtSe9WsH0eKJwobkobrJNL88z9PCPhPseNPRhoSebY5orBNpBOGdhM7ZaSReYnHsoOVN4+eXv+BNR7tnRuqnoX4v+TXcKhUwYrels= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706225498; c=relaxed/simple; bh=KE/JvQmrHi3uMpYoT3NT/4yez4cQsaGTuCqRRiyYl80=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ha6RbIH9TsDslFkSeKJDUchlYEJafmm8LcvJ1SfXGM39HhFL8ZifnIyTMpLnGcWb3yZQkJyES90Y+SWitoXQxSRWU/xRsP54o6xbjSIGyQBNd8A/z4myLAiGgIm565lL9YQ9hQy5BEc3p2uycuqhRicc7d/ymcqyf0AWfmrwNIo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.216.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-2907a17fa34so60021a91.1; Thu, 25 Jan 2024 15:31:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706225496; x=1706830296; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rHqjgs8+QxlFIbOEf1XBMDmlvl/t8IMshvxEVcI3NVY=; b=jf5emuR6FdMfEESup6AvQ9lzdRSmi+z4DAyFC4gIzrDi97kwUkbf/lfQbAAnw7Rqqo m7X3u6ZzazalL+pbQyB/0IImFJ91p2y44J1WO+37pdVSdhvYCZFJL86klTpqW1BuxWTr jxRWDKNulj2Twr9G22xFxAI0WWwxsA+OMu8J7PNI+f/puxh8FiP6scNNOjMGy+czD/iM eonJG17CtnWTdBY4l90VBbLSCcjbBhj+ILklTDsVjcARvvoBAqe4h+pjOqB9ogASfeMp 2M6+dtMM+eiul1SoNokbLs1xTIPTmbvqo1jhcud5MnLYhAhrn/eJUcuftm5J6+6CjUWf gNDQ== X-Gm-Message-State: AOJu0YyEw9zdqLkihMnJTVjRcMVE8Vi058F0lmuKtCicIzvpJbmKPf3l vc97TVsUXXG0ilmFkdfDMBXkILb2qxnpoJkDAJL8IPSmjqKc47ULZ9Kx+LaS9xYhL0YbevSDS/m 0+15U5jiqu89Ca1eJOB3fD2dbCjk= X-Received: by 2002:a17:90a:a002:b0:290:f5db:c4ad with SMTP id q2-20020a17090aa00200b00290f5dbc4admr327728pjp.46.1706225495906; Thu, 25 Jan 2024 15:31:35 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240125184411.30757-1-kotborealis@awooo.ru> In-Reply-To: From: Namhyung Kim Date: Thu, 25 Jan 2024 15:31:24 -0800 Message-ID: Subject: Re: [PATCH] perf data convert: Output empty string for null pointer To: Ian Rogers Cc: kotborealis@awooo.ru, Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, On Thu, Jan 25, 2024 at 12:59=E2=80=AFPM Ian Rogers wr= ote: > > On Thu, Jan 25, 2024 at 10:44=E2=80=AFAM wrote: > > > > From: Evgeny Pistun > > > > Providing ill-formed input to `perf data conver --to-json` > > causes it to crash with segmentaton fault. There's a bug in > > `output_json_string` functon: input string is not validated. > > This could be reproduced by crafting input that does not specify > > hostname/os-release/etc, which are written to 'headers' section of > > outputted json. > > > > This patch adds a null pointer check. If `output_json_string` is > > called with a null pointer, it should output empty string (`""`). > > > > Signed-off-by: Evgeny Pistun > > Reviewed-by: Ian Rogers I think this is related to this one: https://lore.kernel.org/linux-perf-users/20240117215101.77713-1-ilkka@os.= amperecomputing.com/ I'm ok with making it robust, but also afraid it might end up with a broken JSON if something is missing in { key: value } format. IOW we may need to handle it in a higher layer. Thanks, Namhyung