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: <20230615082949.GA1683497@hirez.programming.kicks-ass.net>
Date:   Thu, 15 Jun 2023 10:29:49 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Dan Williams <dan.j.williams@...el.com>
Cc:     "Wilczynski, Michal" <michal.wilczynski@...el.com>,
        alison.schofield@...el.com,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Len Brown <lenb@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        Andy Lutomirski <luto@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Jonathan Cameron <Jonathan.Cameron@...wei.com>,
        Dave Jiang <dave.jiang@...el.com>,
        Mike Rapoport <rppt@...nel.org>, x86@...nel.org,
        linux-cxl@...r.kernel.org, linux-acpi@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Derick Marks <derick.w.marks@...el.com>
Subject: Re: [PATCH v2 1/2] x86/numa: Introduce numa_fill_memblks()

On Wed, Jun 14, 2023 at 05:27:39AM -0700, Dan Williams wrote:
> Wilczynski, Michal wrote:
> > On 6/14/2023 6:35 AM, alison.schofield@...el.com wrote:

> > > +static int __init cmp_memblk(const void *a, const void *b)
> > > +{
> > > +	const struct numa_memblk *ma = *(const struct numa_memblk **)a;
> > > +	const struct numa_memblk *mb = *(const struct numa_memblk **)b;
> > 
> > Is this casting necessary  ?
> 
> This is idiomatic for sort() comparison handlers.

Aside of that, it *is* actually required, since sort() does indirect
calls to it's cmp_func_t argument the Control Flow Integrity (CFI, not
to be confused with Call-Frame-Information) stuff has a hard requirement
that function signatures match.

At the very least clang builds should warn if you do indirect calls with
non-matching signatures these days. And kCFI enabled builds will get you
a runtime error if you manage to ignore that warning.

> > > +
> > > +	if (ma->start != mb->start)
> > > +		return (ma->start < mb->start) ? -1 : 1;
> > > +
> > > +	/* Caller handles duplicate start addresses */
> > > +	return 0;
> > > +}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ