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: <20180104234732.GM9671@linux.vnet.ibm.com>
Date:   Thu, 4 Jan 2018 15:47:32 -0800
From:   "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     Rao Shoaib <rao.shoaib@...cle.com>,
        Boqun Feng <boqun.feng@...il.com>,
        linux-kernel@...r.kernel.org, brouer@...hat.com, linux-mm@...ck.org
Subject: Re: [PATCH 1/2] Move kfree_call_rcu() to slab_common.c

On Thu, Jan 04, 2018 at 03:13:07PM -0800, Matthew Wilcox wrote:
> On Thu, Jan 04, 2018 at 02:18:50PM -0800, Rao Shoaib wrote:
> > > > > > +#define kfree_rcu(ptr, rcu_head_name) \
> > > > > > +    do { \
> > > > > > +        typeof(ptr) __ptr = ptr;    \
> > > > > > +        unsigned long __off = offsetof(typeof(*(__ptr)), \
> > > > > > +                              rcu_head_name); \
> > > > > > +        struct rcu_head *__rptr = (void *)__ptr + __off; \
> > > > > > +        __kfree_rcu(__rptr, __off); \
> > > > > > +    } while (0)
> > > > > why do you want to open code this?
> > > But why are you changing this macro at all?  If it was to avoid the
> > > double-mention of "ptr", then you haven't done that.
> > I have -- I do not get the error because ptr is being assigned only one. If
> > you have a better way than let me know and I will be happy to make the
> > change.
> 
> But look at the original:
> 
> #define kfree_rcu(ptr, rcu_head)                                        \
>         __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
>                        ^^^                                ^^^
> 
> versus your version:
> 
> +#define kfree_rcu(ptr, rcu_head_name) \
> +    do { \
> +        typeof(ptr) __ptr = ptr;    \
>                 ^^^          ^^^
> +        unsigned long __off = offsetof(typeof(*(__ptr)), \
> +                              rcu_head_name); \
> +        struct rcu_head *__rptr = (void *)__ptr + __off; \
> +        __kfree_rcu(__rptr, __off); \
> +    } while (0)
> 
> I don't see the difference.

I was under the impression that typeof did not actually evaluate its
argument, but rather only returned its type.  And there are a few macros
with this pattern in mainline.

Or am I confused about what typeof does?

							Thanx, Paul

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ