Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2333702ybl; Thu, 9 Jan 2020 10:54:21 -0800 (PST) X-Google-Smtp-Source: APXvYqwn89rsaTz13iyny9YjNTHGQbb0rTFbF96YRzqMLgLUAyk5ph2JcjqO2clNf/mbnxe/+Ojo X-Received: by 2002:aca:1913:: with SMTP id l19mr4067035oii.47.1578596061550; Thu, 09 Jan 2020 10:54:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578596061; cv=none; d=google.com; s=arc-20160816; b=kRgQ42cFFIDsew2uA3UDACkP3j+GTEwQBVulpF8ncd6Ua3baPiA0sR3q2o3FJFHNYJ cTUh9LDy1PdZ/s2MauR0vWcWPGjSvo21srzL93nzwJyyE4EH53KLDuccv2t3vXvacW0i CHm1MlelDJgmP1Fc07XUA3mkHqnodgVDHDxWFETEIGBs22MOyiRykVRXXizTOfiMTC9O mtpqr3Y8cT3Wzdkkx+D5qYaO7UfQYAvrlGiAjmyJTzyN6I91YnlnzQ6FVBmSYHaXnOmd dZkQVylLevhh+wJ7neLPJ976z48NpqsahHJPOKRpT4gCAhOtzn9JslVq9pqmhKIk5c2g m3bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=vbqpZrIDLpDQLH9KUn0l1vMdgrmF9gTvIFjb1L/duXc=; b=etIWlfuqomkJcZhJGmZ5TbXBiNJJwzGvrWK7+jqKk1MxeVPWyGg9kz4ei6eHzAMa31 36u3SnScyg2x7MT6rirg7qWwvZN/Z16PWdv4HCeEkmbm4OnA+jRtfAz3aGB3b3oLXP73 vOVeG1muWHz3GZZq/VYtT9NqubsMlhfbB/kuSTHWnjPpwlVL03w3QnclHKs48WX71Zi2 BW6nRMfy25x+GfKe67OaEaOim2y0CcIhVqVRNOP9cnLoAJzXPw63xmi+Xztv6QggQwjZ qtNl9nm2bAf8qLlIdUUR6s2AfFQmvUA4Ss2qqR0kcyK15w8t9yFubaKfv+0w4PYRFZSR tNqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FumRKMU0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h18si4284533otr.265.2020.01.09.10.54.09; Thu, 09 Jan 2020 10:54:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FumRKMU0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730894AbgAIPM7 (ORCPT + 99 others); Thu, 9 Jan 2020 10:12:59 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:45926 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730812AbgAIPM7 (ORCPT ); Thu, 9 Jan 2020 10:12:59 -0500 Received: by mail-oi1-f194.google.com with SMTP id n16so6078018oie.12 for ; Thu, 09 Jan 2020 07:12:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vbqpZrIDLpDQLH9KUn0l1vMdgrmF9gTvIFjb1L/duXc=; b=FumRKMU0RlSPUHrew9kPUV4LHUhfpAsw8FDUVYsyRhgXL8EFZJGgko3coO8RLYG9nZ NDmaf3z+oLebNfRrWyafrPH3vZn7lAj0cdTMW4anTa3/DAXSwktL+zxA8ITABoOlQ858 QfNAeWgiyuoahLzgWFK7EK72hxK44bBOW8fhlk6rJWnzh3SUZN0q+9pP+m8zrPXGYq/U iBzzSSxVIDQgthrPQgZ/+dm8r/77aPcGsupZwYcyLfNkOb17KxRhsEg6upleFpRafcGD 8aEEaHwUKfxl3D0qiE7d6Kc+51Jv87amj2UFGfa7cm0o4gM5uH8Bv/XSOBi331aEvy/s fmfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vbqpZrIDLpDQLH9KUn0l1vMdgrmF9gTvIFjb1L/duXc=; b=G8Nn3h3/MWAcD7TZ/jyP4DA2g9ZmPhpzVNepMIXfbTOHieuGFYGj5BcFIG7bA4UekJ BVEZNjjwuTZJn4JhEL2b+5CNbcoJcLu7+9Xw61Iv2bzh168pvA8NHuqYWQ23bszcSRnZ HWfv5Idz1vnxy9SBCUmIFvEb9pZRNY8z40AkcD/59itvkbOxuQw5jnHUQ76ax5VKvgeR PrLLQ9vDe5uVzfsikicB7VokqZE9gOL0tUrsxXkRBYme3XuGrURSLF7cbzMcLWddTd7K UMIRbzVwT5/eIAahHXhDXcXS6D481QMlvEbf8oLwa2nPK7Ou3q2KGvqklG4Z1BMWfUd4 3lnw== X-Gm-Message-State: APjAAAUEhWPDnjLau7GVm95pMX/D9XZxgX0BW1T8Wc4ziJBh6veV5lU+ vvnIl4+Adv7dltebHyEjwY+cdq+D/JsOr3Ky6td7fA== X-Received: by 2002:aca:4a08:: with SMTP id x8mr3559134oia.39.1578582778388; Thu, 09 Jan 2020 07:12:58 -0800 (PST) MIME-Version: 1.0 References: <20200109151059.GB8602@kernel.org> In-Reply-To: <20200109151059.GB8602@kernel.org> From: Jann Horn Date: Thu, 9 Jan 2020 16:12:30 +0100 Message-ID: Subject: Re: "perf ftrace" segfault because ->cpus!=NULL but ->all_cpus==NULL To: Arnaldo Carvalho de Melo Cc: Andi Kleen , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , kernel list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 9, 2020 at 4:11 PM Arnaldo Carvalho de Melo wrote: > Em Thu, Jan 09, 2020 at 12:37:14PM +0100, Jann Horn escreveu: > > I was clumsily trying to use "perf ftrace" from git master (I might > > very well be using it wrong), and it's falling over with a NULL deref. > > I don't really understand the perf code, but it looks to me like it > > might be related to Andi Kleen's refactoring that introduced > > evlist->all_cpus? > > > I think the problem is that evlist_close() assumes that ->cpus!=NULL > > implies ->all_cpus!=NULL, but perf_evlist__propagate_maps() doesn't > > set ->all_cpus if the evlist is empty. > > > Here's the crash I encountered: > > I've reproduced it and Jiri provided a patch, I'll test it, meanwhile > you could alternatively drop an 'f' and try 'perf trace' + 'perf probe' > instead, perhaps that could be enough, some examples: > > [root@quaco ~]# perf probe kmem_cache_alloc > Added new event: > probe:kmem_cache_alloc (on kmem_cache_alloc) > > You can now use it in all perf tools, such as: > > perf record -e probe:kmem_cache_alloc -aR sleep 1 Ah, thanks for the help. :)