Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2244806rdb; Thu, 21 Sep 2023 12:40:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwS72zDS7J5RGz6nO05jlF6/Fzu9z2Yhk4uLrL9eia0RYLSqVwS+p1ewqYBa4JMhhn4cCG X-Received: by 2002:a05:6e02:1208:b0:34c:ecc8:98e7 with SMTP id a8-20020a056e02120800b0034cecc898e7mr5608796ilq.9.1695325247205; Thu, 21 Sep 2023 12:40:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695325247; cv=none; d=google.com; s=arc-20160816; b=hA0xv/Sz79civAD8FSS3rB8LqJTxkd91zSpYGuO5U2CQqQHiVXT/zakwg+5EUwx/7P Yk0Xvq9gSxXuUcqXe1f0GExxzr7J9bK4CTZ8CiRx3XyYjjZ7GRe1YN5PnB+hbTffqtXT E3/ofgcHcbhU7ZWQEOBSGIolekMsQU4LbITa0xiTfJpiKL8rm7+zKQRXaNZ7yDZEhU7G 5B974APtNP6/MrNIANjPJ92k3gy0b4pZdvIa4Lc6QGcS1Vk+Mxugz4wQTVA9rXnY0XwX V2TTRvpX/T62Sbi++aLcPANmMbRgjHbPp4U/iItGUtcdMG8NgXbpGuhf/ViZSlDUUpY/ j3IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=R7KvAMf8JWkxzt/xnnP2cRHkU5MfYAbf2yiTq7O71vk=; fh=xCUUPHUezntxH2joCRzwD4rOTN4xf+XDFZp1O0GwG40=; b=0T+ZxQ4tVv8VFSS6l+Ns1aFZ+1BvcDBIiT5hE++nyyZ1O4rhhguEioNy1Hape3s6z2 AB3X+GwBM873fg+ZmetI8LVky/miwUFNcdS4S5wJcuuPS24tpvlfG/wQlLbFK/fQ1VzG +/5m5gSH8D9BIQEIAYLyWOxehgfF9RLq64GZBjyGorZlQFjkKpAbhEUlYDxHi9ZTZmyI +aH3DhynfdQ6XNo6XkfxUaYzAcZ2MuxXJINIe1z8wVkdTEjcOD25CWWybypRSHtBCS2C L522KBBY3KfXK74KkLzdoGrv95ZjqgI6Sl5d8CsYHMHgWjqVfyBidIBmb3Q0SPKRkkx0 JNsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id b26-20020a6567da000000b00577616e3ad9si1985641pgs.871.2023.09.21.12.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:40:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id AC0C1807FC2B; Thu, 21 Sep 2023 12:30:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230111AbjIUTaX convert rfc822-to-8bit (ORCPT + 99 others); Thu, 21 Sep 2023 15:30:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230266AbjIUT3q (ORCPT ); Thu, 21 Sep 2023 15:29:46 -0400 Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D53090A5C; Thu, 21 Sep 2023 11:51:13 -0700 (PDT) Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-7927f24140eso50866239f.2; Thu, 21 Sep 2023 11:51:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695322272; x=1695927072; 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=927YGkKs9cOI0OBx9K68ikts5Bj4cqpKV/mGal0pmf4=; b=hR0zUi1pNquD4AVwOfoUVjQ+SyXNPmDCMazVz1sWHXHskNJYOZf3F3g4L203DSlnN8 R72fDPZdffWQx8ulPRzVZP4oHP1n3HDyyJIIdPi23U4L+V8abapzDwId9Kkgeeacezgq RvX1flR0EA0LgvLtNCwh9urvZ80YLTwyjCjtYG0UdZmON5Tu2VuZjPb4z6e0Nv6rBdrc AnRqv11IEkWbUBtDVaQq8V22nK0UFoDdxGO6gUQPg42PPuJ36oatnYlA9PAM2HfuM3kA S1HXr8LCpT6T4+Jes+S0KnLuhAPc7w+jG4cBTutzxJdpaKag0hPy19R9oIb47WMSrUq1 m7RA== X-Gm-Message-State: AOJu0Yz28kcmXHxK4+BBS1MmVWKsvuawVZorAnwI5TFsIHYrw26UbS9o QuRbPVryYWL6A66kcrcZQdWnNGzt5sgRxGc+8T8= X-Received: by 2002:a5d:8b93:0:b0:786:fff8:13c2 with SMTP id p19-20020a5d8b93000000b00786fff813c2mr7163981iol.11.1695322272169; Thu, 21 Sep 2023 11:51:12 -0700 (PDT) MIME-Version: 1.0 References: <20230914164028.363220-1-irogers@google.com> In-Reply-To: <20230914164028.363220-1-irogers@google.com> From: Namhyung Kim Date: Thu, 21 Sep 2023 11:51:01 -0700 Message-ID: Subject: Re: [PATCH v1] perf parse-events: Fix tracepoint name memory leak To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , He Kuang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 21 Sep 2023 12:30:29 -0700 (PDT) On Thu, Sep 14, 2023 at 9:40 AM Ian Rogers wrote: > > Fuzzing found that an invalid tracepoint name would create a memory > leak with an address sanitizer build: > ``` > $ perf stat -e '*:o/' true > event syntax error: '*:o/' > \___ parser error > Run 'perf list' for a list of valid events > > Usage: perf stat [] [] > > -e, --event event selector. use 'perf list' to list available events > > ================================================================= > ==59380==ERROR: LeakSanitizer: detected memory leaks > > Direct leak of 4 byte(s) in 2 object(s) allocated from: > #0 0x7f38ac07077b in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:439 > #1 0x55f2f41be73b in str util/parse-events.l:49 > #2 0x55f2f41d08e8 in parse_events_lex util/parse-events.l:338 > #3 0x55f2f41dc3b1 in parse_events_parse util/parse-events-bison.c:1464 > #4 0x55f2f410b8b3 in parse_events__scanner util/parse-events.c:1822 > #5 0x55f2f410d1b9 in __parse_events util/parse-events.c:2094 > #6 0x55f2f410e57f in parse_events_option util/parse-events.c:2279 > #7 0x55f2f4427b56 in get_value tools/lib/subcmd/parse-options.c:251 > #8 0x55f2f4428d98 in parse_short_opt tools/lib/subcmd/parse-options.c:351 > #9 0x55f2f4429d80 in parse_options_step tools/lib/subcmd/parse-options.c:539 > #10 0x55f2f442acb9 in parse_options_subcommand tools/lib/subcmd/parse-options.c:654 > #11 0x55f2f3ec99fc in cmd_stat tools/perf/builtin-stat.c:2501 > #12 0x55f2f4093289 in run_builtin tools/perf/perf.c:322 > #13 0x55f2f40937f5 in handle_internal_command tools/perf/perf.c:375 > #14 0x55f2f4093bbd in run_argv tools/perf/perf.c:419 > #15 0x55f2f409412b in main tools/perf/perf.c:535 > > SUMMARY: AddressSanitizer: 4 byte(s) leaked in 2 allocation(s). > ``` > Fix by adding the missing destructor. > > Fixes: 865582c3f48e ("perf tools: Adds the tracepoint name parsing support") > Signed-off-by: Ian Rogers Applied to perf-tools-next, thanks!