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: <CAHk-=wjn1=Gyi3Jxw4V0A=fXpOu5e1StPoyu52A6DHmbT+auzA@mail.gmail.com>
Date:   Tue, 23 Aug 2022 11:09:22 -0700
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     "Sudip Mukherjee (Codethink)" <sudipm.mukherjee@...il.com>
Cc:     Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Tom Rix <trix@...hat.com>, Huacai Chen <chenhuacai@...nel.org>,
        WANG Xuerui <kernel@...0n.name>, linux-kernel@...r.kernel.org,
        llvm@...ts.linux.dev, loongarch@...ts.linux.dev
Subject: Re: mainline build failure for loongarch allmodconfig with gcc-12

On Tue, Aug 23, 2022 at 1:34 AM Sudip Mukherjee (Codethink)
<sudipm.mukherjee@...il.com> wrote:
>
> I have been trying to build loongarch as part of my nightly builds, and
> I can build loongson3_defconfig without any error. But allmodconfig fails
> with the error:
>
> In function '__cmpxchg',
>     inlined from 'ssh_seq_next' at drivers/platform/surface/aggregator/controller.c:61:9,

Looks like ssh_seq_next() wants to do an atomic cmpxchg() on a single
byte value, and the Loongarch implementation only does 4- and 8-byte
versions.

It looks like loongarch - from its MIPS heritage - inherited the "we
can't do atomics on byte variables", so that it needs the same strange
"do bytes as word accesses with mask-and-shifts".

For MIPS, the code is in __xchg_small() in arch/mips/kernel/cmpxchg.c.

Alpha has something similar, except it's all done in inline asm in
arch/alpha/include/asm/xchg.h (look for "____cmpxchg(_u8," in there.

Of course, we could just add a Kconfig variable like
"ARCH_LACKS_BYTE_ATOMICS" and make that driver depend on it not being
true, and just have Loongarch set it.

But I think loongarch should just implement the byte masking stuff.
Particularly since I suspect it can just copy the MIPS code as-is.

                  Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ