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]
Date:   Thu, 12 Oct 2023 20:21:28 +0200
From:   Ingo Molnar <mingo@...nel.org>
To:     Oleg Nesterov <oleg@...hat.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Alexey Gladkov <legion@...nel.org>,
        Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
        Waiman Long <longman@...hat.com>,
        Boqun Feng <boqun.feng@...il.com>,
        linux-kernel@...r.kernel.org,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH v2 2/2] seqlock: change __seqprop() to return the
 function pointer


* Oleg Nesterov <oleg@...hat.com> wrote:

> This simplifies the macro and makes it easy to add the new seqprop's
> with 2 or more args.
> 
> Plus this way we do not lose the type info, the (void*) type cast is
> no longer needed.
> 
> And the latter reveals the problem: a lot of seqcount_t helpers pass
> the "const seqcount_t *s" argument to __seqprop_ptr(seqcount_t *s)
> but (before this patch) "(void *)(s)" masked the problem.
> 
> So this patch changes __seqprop_ptr() and __seqprop_##lockname##_ptr()
> to accept the "const LOCKNAME *s" argument. This is not nice either,
> they need to drop the constness on return because these helpers are used
> by both the readers and writers, but at least it is clear what's going on.

> +__seqprop_##lockname##_ptr(const seqcount_##lockname##_t *s)		\
>  {									\
> +	return (void *)&s->seqcount; /* drop const */			\
>  }									\

> +static inline seqcount_t *__seqprop_ptr(const seqcount_t *s)
>  {
> +	return (void *)s; /* drop const */
>  }

Okay, so dropping 'const' makes sense in terms of staying bug-compatible
with the  previous API and not build-breaking the world - but could we
perhaps follow this up with fixups of the type misuse and then a removal
of the forced type casts from these APIs?

Meanwhile I'm applying your patches to tip:locking/core, unless someone objects.

Thanks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ