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: <1be708d5-638c-40ff-bd52-b6b88c93d132@app.fastmail.com>
Date:   Tue, 20 Jun 2023 18:27:04 -0700
From:   "Andy Lutomirski" <luto@...nel.org>
To:     "Nadav Amit" <nadav.amit@...il.com>
Cc:     "Dave Hansen" <dave.hansen@...el.com>,
        "Kent Overstreet" <kent.overstreet@...ux.dev>,
        "Mark Rutland" <mark.rutland@....com>,
        "Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
        linux-fsdevel@...r.kernel.org,
        "linux-bcachefs@...r.kernel.org" <linux-bcachefs@...r.kernel.org>,
        "Kent Overstreet" <kent.overstreet@...il.com>,
        "Andrew Morton" <akpm@...ux-foundation.org>,
        "Uladzislau Rezki" <urezki@...il.com>,
        "hch@...radead.org" <hch@...radead.org>,
        linux-mm <linux-mm@...ck.org>,
        "Kees Cook" <keescook@...omium.org>,
        "the arch/x86 maintainers" <x86@...nel.org>
Subject: Re: [PATCH 07/32] mm: Bring back vmalloc_exec



On Tue, Jun 20, 2023, at 3:43 PM, Nadav Amit wrote:
>> On Jun 20, 2023, at 3:32 PM, Andy Lutomirski <luto@...nel.org> wrote:
>> 
>>> // out needs to be zeroed first
>>> void unpack(struct uncompressed *out, const u64 *in, const struct 
>>> bitblock *blocks, int nblocks)
>>> {
>>>    u64 *out_as_words = (u64*)out;
>>>    for (int i = 0; i < nblocks; i++) {
>>>        const struct bitblock *b;
>>>        out_as_words[b->target] |= (in[b->source] & b->mask) << 
>>> b->shift;
>>>    }
>>> }
>>> 
>>> void apply_offsets(struct uncompressed *out, const struct uncompressed *offsets)
>>> {
>>>    out->a += offsets->a;
>>>    out->b += offsets->b;
>>>    out->c += offsets->c;
>>>    out->d += offsets->d;
>>>    out->e += offsets->e;
>>>    out->f += offsets->f;
>>> }
>>> 
>>> Which generates nice code: https://godbolt.org/z/3fEq37hf5
>> 
>> Thinking about this a bit more, I think the only real performance issue with my code is that it does 12 read-xor-write operations in memory, which all depend on each other in horrible ways.
>
> If you compare the generated code, just notice that you forgot to 
> initialize b in unpack() in this version.
>
> I presume you wanted it to say "b = &blocks[i]”.

Indeed.  I also didn't notice that -Wall wasn't set.  Oops.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ