[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241226133738.36561a6b556550a3f50fc5b3@linux-foundation.org>
Date: Thu, 26 Dec 2024 13:37:38 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Kuan-Wei Chiu <visitorckw@...il.com>
Cc: peterz@...radead.org, shile.zhang@...ux.alibaba.com, mingo@...nel.org,
rostedt@...dmis.org, jpoimboe@...nel.org, jserv@...s.ncku.edu.tw,
chuang@...nycu.edu.tw, linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] scripts/sorttable: Fix orc_sort_cmp() to maintain
symmetry and transitivity
On Thu, 26 Dec 2024 22:03:32 +0800 Kuan-Wei Chiu <visitorckw@...il.com> wrote:
> The orc_sort_cmp() function, used with qsort(), previously violated the
> symmetry and transitivity rules required by the C standard.
> Specifically, when both entries are ORC_TYPE_UNDEFINED, it could result
> in both a < b and b < a, which breaks the required symmetry and
> transitivity. This can lead to undefined behavior and incorrect sorting
> results, potentially causing memory corruption in glibc
> implementations [1].
>
> Symmetry: If x < y, then y > x.
> Transitivity: If x < y and y < z, then x < z.
>
> Fix the comparison logic to return 0 when both entries are
> ORC_TYPE_UNDEFINED, ensuring compliance with qsort() requirements.
>
> Link: https://www.qualys.com/2024/01/30/qsort.txt [1]
> Fixes: 57fa18994285 ("scripts/sorttable: Implement build-time ORC unwind table sorting")
> Fixes: fb799447ae29 ("x86,objtool: Split UNWIND_HINT_EMPTY in two")
Two Fixes:, years apart. This is problematic for stable tree
maintainers - what do they do if their kernel has one of the above
commits but not the other?
Can we please clarify this? Which kernel version(s) need the fix?
Or perhaps this should have been presented as two separate patches.
Powered by blists - more mailing lists