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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJD7tkZk=Febdoa-fXVw2n21KtEH=y8n6LD6akxc_cHvfEZ=3g@mail.gmail.com>
Date: Fri, 22 Mar 2024 11:58:12 -0700
From: Yosry Ahmed <yosryahmed@...gle.com>
To: Johannes Weiner <hannes@...xchg.org>
Cc: Chris Li <chrisl@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>, 
	linux-kernel@...r.kernel.org, linux-mm@...ck.org, 
	Nhat Pham <nphamcs@...il.com>, Chengming Zhou <zhouchengming@...edance.com>
Subject: Re: [PATCH] zswap: initialize entry->pool on same filled entry

[..]
> > > What would actually be safer is to make the two subtypes explicit, and
> > > not have unused/ambiguous/overloaded members at all:
> > >
> > > struct zswap_entry {
> > >         unsigned int length;
> > >         struct obj_cgroup *objcg;
> > > };
> > >
> > > struct zswap_compressed_entry {
> > >         struct zswap_entry entry;
> > >         struct zswap_pool *pool;
> > >         unsigned long handle;
> > >         struct list_head lru;
> > >         swp_entry_t swpentry;
> > > };
> > >
> > > struct zswap_samefilled_entry {
> > >         struct zswap_entry entry;
> > >         unsigned long value;
> > > };
> >
> > I think the 3 struct with embedded and container of is a bit complex,
> > because the state breaks into different struct members
>
> That's kind of the point. They're different types that have their own
> rules and code paths. The code as it is right now makes it seem like
> they're almost the same. From the above you can see that they have
> actually almost nothing in common (the bits in struct zswap_entry).
>
> This would force the code to show the difference as well.
>
> Depending on how Yosry's patches work out, this may or may not be
> worth doing. It's just an idea that could help make it easier.

I initially wanted to do something similar to splitting the structs
before not allocating an entry at all for same-filled pages, but I
ended up dropping it as the direct conversion was simple enough.

Anyway, I will post the patches some time next week (or today if I can
get around to test them). The discussion should be easier with code.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ