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-next>] [day] [month] [year] [list]
Date:   Mon, 26 Jun 2023 22:49:44 +0200
From:   Sebastian Sumpf <Sebastian.Sumpf@...ode-labs.com>
To:     tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
        dave.hansen@...ux.intel.com, x86@...nel.org
Cc:     linux-kernel@...r.kernel.org
Subject: [Bug report] __arch_hweight32/64 x86

Hello kernel developers,

I recently stumbled over a bug in the inline assembly of '__arch_hweight32' and 
'__arch_hweight64'  in 'arch/x86/include/asm/arch_hweight.h' (present in 6.4 as 
well):

! asm (ALTERNATIVE("call __sw_hweight64", "popcntq %1, %0",
! X86_FEATURE_POPCNT)
! 			 : "="REG_OUT (res)
! 			 : REG_IN (w));

The 'ALTERNATIVE' macro checks for the popcnt feature. In case this fails the 
'__sw_hweight' C-function is called from inline assembly with rax and rdi as 
intput/output operands. However, the code does not contain a clobber list of any 
callee safe registers that might be touched by the '__sw_height64' C-function. 
Therefore, these registers will not be restored upon function return by the 
compiler. This leads to varying exceptions/bad behavior caused by the thus 
corrupted registers later on.

Kind regards,

Sebastian


-- 
Sebastian Sumpf
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ