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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z1dSimfbQ5FO7sjU@x1>
Date: Mon, 9 Dec 2024 17:26:50 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Kuan-Wei Chiu <visitorckw@...il.com>, peterz@...radead.org,
	mingo@...hat.com, mark.rutland@....com,
	alexander.shishkin@...ux.intel.com, jolsa@...nel.org,
	irogers@...gle.com, kan.liang@...ux.intel.com,
	adrian.hunter@...el.com, jserv@...s.ncku.edu.tw,
	chuang@...nycu.edu.tw, linux-perf-users@...r.kernel.org,
	linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] perf ftrace: Fix undefined behavior in cmp_profile_data()

On Mon, Dec 09, 2024 at 09:02:24AM -0800, Namhyung Kim wrote:
> Hello,
> 
> On Mon, Dec 9, 2024 at 5:42 AM Kuan-Wei Chiu <visitorckw@...il.com> wrote:
> >
> > The comparison function cmp_profile_data() violates the C standard's
> > requirements for qsort() comparison functions, which mandate symmetry
> > and transitivity:
> >
> > * Symmetry: If x < y, then y > x.
> > * Transitivity: If x < y and y < z, then x < z.
> >
> > When v1 and v2 are equal, the function incorrectly returns 1, breaking
> > symmetry and transitivity. This causes undefined behavior, which can
> > lead to memory corruption in certain versions of glibc [1].
> >
> > Fix the issue by returning 0 when v1 and v2 are equal, ensuring
> > compliance with the C standard and preventing undefined behavior.
> >
> > Link: https://www.qualys.com/2024/01/30/qsort.txt [1]
> > Fixes: 0f223813edd0 ("perf ftrace: Add 'profile' command")
> > Fixes: 74ae366c37b7 ("perf ftrace profile: Add -s/--sort option")
> > Cc: stable@...r.kernel.org
> > Signed-off-by: Kuan-Wei Chiu <visitorckw@...il.com>
> 
> Reviewed-by: Namhyung Kim <namhyung@...nel.org>

I'm assuming you'll pick this for perf-tools, ok?

Reviewed-by: Arnaldo Carvalho de Melo <acme@...hat.com>

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ