From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f202.google.com (mail-dy1-f202.google.com [74.125.82.202]) (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 377D1395AC1 for ; Thu, 21 May 2026 07:24:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779348282; cv=none; b=JxE7b6cBXBkpTiWdMMgrPC6oz90sd4zIsJgcvEpyYeDnZQqcXmaj1A4YqS34afiki1buO+qw2xXQJBXucmIQBDj2jNTRWo4Cbc4rEfuu9Sdu4idaOjs8IC55zQkD1y/F+jSanMIucTvOJakDNHTCzROkuQ0wl9PXVspHwjloRvg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779348282; c=relaxed/simple; bh=JK2FsdWqIpbhnUUJbc5gzblW88l4umGonHORdmDOtks=; h=Date:Mime-Version:Message-ID:Subject:From:To:Content-Type; b=ebO5wpHBwr4WysvHfJ7v7wRGpgC1bMfGjSVhUfgHaZI5tkZ/Pg1iPNkhnh4TcTeBzgDI/3wgabF3UoyCjoEwW7F2moD//vO5IlXfSLUse8O4E5JY6Dpe4YJJf25rHdgsQnp4U0eyG4Hj26jGlC1slQon/4rqVugHKtYc2grOx48= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=pDMqgbjb; arc=none smtp.client-ip=74.125.82.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pDMqgbjb" Received: by mail-dy1-f202.google.com with SMTP id 5a478bee46e88-3041c65a30bso1395077eec.1 for ; Thu, 21 May 2026 00:24:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1779348280; x=1779953080; darn=vger.kernel.org; h=to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=+hKqzR/snvn9EXJnft+YCqVPmN3stCDgEVe3UpCIIg0=; b=pDMqgbjbMkjUDPSzps2ZVDuf+oGWic03zoS96AvHb9rXEpdQXJdO7vh5BJUfhkmT/r szw4eFFo0z0VWUTcNe6l/Ofdk3FDq6tus1m6eVp5GX01bhZ81I5x+EkC8UfZDfkRgeIc dojC+zABLEld1U7JX6GaU+5uj7UsFbEPfOGNMgZKcjP1FiIjXXr7futzeVTGKu7jdkc7 CGnGkGNTBRehHDOIEmFl838z+3LGamribIbWBRwwI1z6+TXLaveXqL2ZKJwWCAsfDYi2 iDw+K4BJC5F+YrhH1O/4JL/m8cq3DX8pVT4FTIeUdDmoRpwZ3eVODbKsqdc8ajyz7Os2 fetw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779348280; x=1779953080; h=to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+hKqzR/snvn9EXJnft+YCqVPmN3stCDgEVe3UpCIIg0=; b=VrlZNXYoJEe4v3tB4HbKcd1yQ0C5cxh76iAei7142ZhlJRKVDCZBCXLjSdhPy0xl6x tncX7iR5EJ70HDXI9ASF1S3xrP2s1j+F3xqW7UOJjf6UFGR1cgjxwzpbJZ7w50ldUgzm +oW5GAvB4aw4OGoUPX2AKs2FlWxy+iel4KCh14ZyaZ6039S1+yuife8kFr9yfu5idK7E EtW/ggc94z/aXUS8i6WqE/rXituGjqvIZftp7Z0IpkHOJrRSeP6MSWBPZO6wWZWbSqe1 jnsJ2SRAUjStxeVZiTjXqNdFAQc3zXOZ9OwVnWcfRspJP9KTPuULFKqYQH47cxSq4Etm 4Q8g== X-Forwarded-Encrypted: i=1; AFNElJ9aN801xjh9OiFXR0XLWfjnqjIQvk4qbg/HW8HWvWderUAQg2W+x6vsjpwGAuWfmVrmjUeQk+YEf+MAkxw=@vger.kernel.org X-Gm-Message-State: AOJu0YzldK2mT67yQzorQC1cHtXTqaqjlSEI1ejJndj3RGufU/do3bAd KZP/iE/fHz+MyFM2A1KlzvUCnPJFnVXlDTcRN29iqEXF/x+OT/c9nYLuHtV60HbVKCBlajgwqz9 hZaFGa0x6tw== X-Received: from dlbts4-n1.prod.google.com ([2002:a05:7022:b044:10b0:135:5a9c:4291]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:220:b0:135:ce5a:98b5 with SMTP id a92af1059eb24-136328f2112mr872643c88.13.1779348279909; Thu, 21 May 2026 00:24:39 -0700 (PDT) Date: Thu, 21 May 2026 00:24:26 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.54.0.746.g67dd491aae-goog Message-ID: <20260521072429.1283423-1-irogers@google.com> Subject: [PATCH v1 0/3] perf: Fix kwork memory sanitization and libunwind test builds From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" The combination of the libunwind refactoring and build system changes exposed a build-test regression for the libunwind build using a cached feature dump. Re-send kwork fixes [1] moving a definition to kwork.h to avoid breaking no libbpf builds. 1. Build Fix for libunwind: "make feature-dump" runs without LIBUNWIND=1, skipping the setup of libunwind LDFLAGS. When Makefile.feature is included to generate the cached FEATURE-DUMP, the local test-libunwind.bin compiles without arch-specific link flags (-lunwind-x86_64) and fails, caching a false negative ("feature-libunwind=0"). Later builds (such as make_libunwind_O reusing the dump) compile the unwinder based on CONFIG_LIBUNWIND (remote) but disable HAVE_LIBUNWIND_SUPPORT (local), breaking compilation due to missing maps__e_machine declarations in maps.h. Fixed by unconditionally setting up libunwind feature build flags in Makefile.config. 2. kwork ASAN Double-Free & Leaks: - Solves double-free in the record command argument array due to parse_options mutation, by preserving original pointers in a calloc'ed to_free buffer. - Ensures kwork_usage string is freed on all exit paths. 3. kwork Unified Memory Lifecycle: - Establishes a unified memory ownership model for kwork_work by ensuring work names are dynamically duplicated via strdup() and consistently freed using work_exit() and a central perf_kwork__exit() teardown path. [1] https://lore.kernel.org/linux-perf-users/20260520190538.142018-32-irogers@google.com/ Ian Rogers (3): perf build: Unconditionally set up libunwind feature build flags perf kwork: Fix address sanitizer issues perf kwork: Fix memory management of kwork_work tools/perf/Makefile.config | 103 ++++++++++++------------ tools/perf/builtin-kwork.c | 151 ++++++++++++++++++++++++++++-------- tools/perf/util/bpf_kwork.c | 14 +++- tools/perf/util/kwork.h | 9 +++ 4 files changed, 188 insertions(+), 89 deletions(-) -- 2.54.0.746.g67dd491aae-goog