mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Kuan-Wei Chiu <visitorckw@gmail.com>
Cc: peterz@infradead.org, shile.zhang@linux.alibaba.com,
	mingo@kernel.org, rostedt@goodmis.org, jpoimboe@kernel.org,
	jserv@ccns.ncku.edu.tw, chuang@cs.nycu.edu.tw,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] scripts/sorttable: Fix orc_sort_cmp() to maintain symmetry and transitivity
Date: Thu, 26 Dec 2024 13:37:38 -0800	[thread overview]
Message-ID: <20241226133738.36561a6b556550a3f50fc5b3@linux-foundation.org> (raw)
In-Reply-To: <20241226140332.2670689-1-visitorckw@gmail.com>

On Thu, 26 Dec 2024 22:03:32 +0800 Kuan-Wei Chiu <visitorckw@gmail.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.


  reply	other threads:[~2024-12-26 21:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-26 14:03 Kuan-Wei Chiu
2024-12-26 21:37 ` Andrew Morton [this message]
2024-12-26 23:31   ` Kuan-Wei Chiu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241226133738.36561a6b556550a3f50fc5b3@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=chuang@cs.nycu.edu.tw \
    --cc=jpoimboe@kernel.org \
    --cc=jserv@ccns.ncku.edu.tw \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=shile.zhang@linux.alibaba.com \
    --cc=stable@vger.kernel.org \
    --cc=visitorckw@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®