Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2666329ybv; Sat, 15 Feb 2020 00:43:16 -0800 (PST) X-Google-Smtp-Source: APXvYqx9yR0UxTBt2AuxhzEwV+hxDMjd2NZB/He9LbDnZxxoQcqdps61AnqO2MiKonj3NU9qnb4B X-Received: by 2002:a9d:7a56:: with SMTP id z22mr4990594otm.201.1581756196311; Sat, 15 Feb 2020 00:43:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581756196; cv=none; d=google.com; s=arc-20160816; b=d2PNtF16fE4dbqXYjvRsDWWl/BhMNSwLy55O4eIz/FxyKzckootBfnO69RwTw9BP/U 6wWrJnxxfHJZ7aQMzTBRnGk9HwLfdg6s2pwN+WIEb8qWfiYCG58UyBe0oPWsxHzbOxgQ 63+qJR9OyPFaSIr6Krxm4BxbaENSdkgNkxT2XVVINxuXODlFztDH2ET7SMHCwc94WojZ zfiqXy/oxtMMXK7ahts/KCAYYxlxOEx6ETtn8Hc5IlRyQyx6b791nYU/kwf8XpuAZPYD x9jxGQt7F3xqwapGwM6dgX59fQCh1KxzgSRH3QcXsyaHbdPt2PGVetPgCnUQRM2TBh0k VxrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=/JfpNAMRSXdiSqaDYnlT3lGiyrKY6QUZZSuHPnA49WY=; b=JLcE8TjxPcvA0fwxRi+pihORN6YWC5cz8/SZmepp7ck1cXWq2zV7Cq35C/+n7riQ4F +fX5Tvo0kKpGk7Q3WgBbA6Dg1NWj35iGbEboQdIqfuLMO/oaz0rToeMCYqXJ7FFtcVsr ZTarUq/b2ZsIrKzJfNGZSoZq8U6x7p0SI1k1fLofsMah9AUm4uIK/A+Z3OSPt6xQlept 8H6mYD0KVqOroVYOFuOZmxxnVTxjO/c3voPY0jb2w+UEO9k+8ehUVjugkIZB2mdGDeSp PCc1gueS6rIrNGNtCwDVisk5+iOTCB16QGDMjqYo5HmAy36mV6tH5X0CgFcow0lU2pXP GsvQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w18si4382338otl.54.2020.02.15.00.43.04; Sat, 15 Feb 2020 00:43:16 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726638AbgBOImJ (ORCPT + 99 others); Sat, 15 Feb 2020 03:42:09 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:56807 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726512AbgBOImE (ORCPT ); Sat, 15 Feb 2020 03:42:04 -0500 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1j2t1N-0005I0-0B; Sat, 15 Feb 2020 09:41:53 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id A2C801C2019; Sat, 15 Feb 2020 09:41:52 +0100 (CET) Date: Sat, 15 Feb 2020 08:41:52 -0000 From: "tip-bot2 for Jiri Olsa" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf maps: Fix map__clone() for struct kmap Cc: Ravi Bangoria , Jiri Olsa , Kim Phillips , Alexander Shishkin , Michael Petlan , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , x86 , LKML In-Reply-To: <20200210143218.24948-4-jolsa@kernel.org> References: <20200210143218.24948-4-jolsa@kernel.org> MIME-Version: 1.0 Message-ID: <158175611237.13786.17686234515843613570.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/urgent branch of tip: Commit-ID: 7ce66139a99ce57caaf47b64afed5cb6ed02c5ed Gitweb: https://git.kernel.org/tip/7ce66139a99ce57caaf47b64afed5cb6ed02c5ed Author: Jiri Olsa AuthorDate: Mon, 10 Feb 2020 15:32:17 +01:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Tue, 11 Feb 2020 16:41:49 -03:00 perf maps: Fix map__clone() for struct kmap The map__clone() function can be called on kernel maps as well, so it needs to duplicate the whole kmap data. Reported-by: Ravi Bangoria Signed-off-by: Jiri Olsa Tested-by: Ravi Bangoria Tested-by: Kim Phillips Cc: Alexander Shishkin Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/20200210143218.24948-4-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/map.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index f67960b..cea05fc 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -375,8 +375,13 @@ struct symbol *map__find_symbol_by_name(struct map *map, const char *name) struct map *map__clone(struct map *from) { - struct map *map = memdup(from, sizeof(*map)); + size_t size = sizeof(struct map); + struct map *map; + + if (from->dso && from->dso->kernel) + size += sizeof(struct kmap); + map = memdup(from, size); if (map != NULL) { refcount_set(&map->refcnt, 1); RB_CLEAR_NODE(&map->rb_node);