lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aWZpSBMnz43t1Mss@tycho.pizza>
Date: Tue, 13 Jan 2026 08:48:24 -0700
From: Tycho Andersen <tycho@...nel.org>
To: K Prateek Nayak <kprateek.nayak@....com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
	Namhyung Kim <namhyung@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>, Mark Rutland <mark.rutland@....com>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
	Adrian Hunter <adrian.hunter@...el.com>,
	James Clark <james.clark@...aro.org>,
	Chun-Tse Shao <ctshao@...gle.com>, linux-perf-users@...r.kernel.org,
	linux-kernel@...r.kernel.org, Ravi Bangoria <ravi.bangoria@....com>
Subject: Re: [PATCH] perf: fix segfault in `lock contention -b`

On Tue, Jan 13, 2026 at 08:41:24AM +0530, K Prateek Nayak wrote:
> Hello Tycho,
> 
> On 1/9/2026 10:14 PM, Tycho Andersen wrote:
> > @@ -43,19 +43,20 @@ static void check_slab_cache_iter(struct lock_contention *con)
> >  	con->btf = btf__load_vmlinux_btf();
> >  	if (con->btf == NULL) {
> >  		pr_debug("BTF loading failed: %s\n", strerror(errno));
> > -		return;
> > +		return -errno;
> >  	}
> >  
> >  	ret = btf__find_by_name_kind(con->btf, "bpf_iter__kmem_cache", BTF_KIND_STRUCT);
> >  	if (ret < 0) {
> >  		bpf_program__set_autoload(skel->progs.slab_cache_iter, false);
> >  		pr_debug("slab cache iterator is not available: %d\n", ret);
> > -		return;
> > +		return ret;
> >  	}
> >  
> >  	has_slab_iter = true;
> >  
> >  	bpf_map__set_max_entries(skel->maps.slab_caches, con->map_nr_entries);
> > +	return 0;
> >  }
> >  
> >  static void run_slab_cache_iter(void)
> > @@ -301,7 +302,8 @@ int lock_contention_prepare(struct lock_contention *con)
> >  			skel->rodata->use_cgroup_v2 = 1;
> >  	}
> >  
> > -	check_slab_cache_iter(con);
> > +	if (check_slab_cache_iter(con) < 0)
> > +		return -1;
> >  
> >  	if (con->filters->nr_slabs && has_slab_iter) {
> 
> nit.
> 
> Now that lock_contention_prepare() bails out when
> check_slab_cache_iter() fails, we no longer need the "has_slab_iter"
> global indicator.
> 
> Both this, and run_slab_cache_iter() that depend on "has_slab_iter"
> will only run if check_slab_cache_iter() succeeded and the global
> indicator will be true in both those cases.
> 
> Can be separate follow-up cleanup.

I guess this depends on whether it should work without BTF. Presumably
we'd want to keep this check if the goal is to make it work without
BTF.

I'm can send an addition cleanup patch if we decide not to go that
route.

Tycho

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ