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: <20181214025917.GF24409@localhost.localdomain>
Date:   Fri, 14 Dec 2018 10:59:17 +0800
From:   Chao Fan <fanc.fnst@...fujitsu.com>
To:     Borislav Petkov <bp@...en8.de>
CC:     <linux-kernel@...r.kernel.org>, <x86@...nel.org>,
        <tglx@...utronix.de>, <mingo@...hat.com>, <hpa@...or.com>,
        <keescook@...omium.org>, <bhe@...hat.com>, <msys.mizuma@...il.com>,
        <indou.takao@...fujitsu.com>, <caoj.fnst@...fujitsu.com>
Subject: Re: [PATCH v13 1/6] x86/boot: Introduce kstrtoull() to boot
 directory instead of simple_strtoull()

>> +static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
>> +{
>> +	union {
>> +		u64 v64;
>> +		u32 v32[2];
>> +	} d = { dividend };
>> +	u32 upper;
>> +
>> +	upper = d.v32[1];
>> +	d.v32[1] = 0;
>> +	if (upper >= divisor) {
>> +		d.v32[1] = upper / divisor;
>> +		upper %= divisor;
>> +	}
>> +	asm ("divl %2" : "=a" (d.v32[0]), "=d" (*remainder) :
>> +		"rm" (divisor), "0" (d.v32[0]), "1" (upper));
>> +	return d.v64;
>> +}
>
>Why aren't you using the simple one from include/linux/math64.h ?

Cant't use div_u64() in math64.h directly, because  that will cause ld error.

Even in 64-bit environment, arch/x86/boot/*.o will be built as 32-bit
binary. In 64-bit binary, the dividend is handled as 64-bit value,
that's OK, but in 32-bit binary, that's wrong. So it's necessary
to separate the dividend to upper and lower in 32-bit binary.
That's why copy the needed div_u64() here.

So, when copying kstrtoull(), we should copy div_u64().
When trying to include lib/kstrtox.c, even if other error in make period
are solved, we will also meet this error. We should also copy div_u64
also. And then cover the math64.h in boot/string.c, and hanlde the other
error and warining who comes together.

So just like Baoquan said, it's a good choice to use simple_strtoull()
for now.

Thanks,
Chao Fan

>
>Rest looks ok.
>
>-- 
>Regards/Gruss,
>    Boris.
>
>Good mailing practices for 400: avoid top-posting and trim the reply.
>
>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ