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: <48A8FC21.9060908@zytor.com>
Date:	Sun, 17 Aug 2008 21:35:45 -0700
From:	"H. Peter Anvin" <hpa@...or.com>
To:	"Maciej W. Rozycki" <macro@...ux-mips.org>
CC:	David Fries <david@...es.net>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Fix i486 suspend to disk CR4 oops

Maciej W. Rozycki wrote:
> On Sun, 17 Aug 2008, David Fries wrote:
> 
>> arch/x86/power/cpu_32.c __save_processor_state calls read_cr4()
>> only a i486 CPU doesn't have the CR4 register.  Trying to read it
>> produces an invalid opcode oops during suspend to disk.
> [...]
>> diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
>> index 81e5ab6..bd0f2a3 100644
>> --- a/arch/x86/kernel/acpi/sleep.c
>> +++ b/arch/x86/kernel/acpi/sleep.c
>> @@ -86,7 +86,9 @@ int acpi_save_state_mem(void)
>>  #endif /* !CONFIG_64BIT */
>>  
>>  	header->pmode_cr0 = read_cr0();
>> -	header->pmode_cr4 = read_cr4();
>> +	/* cr4 was introduced in the Pentium CPU */
>> +	if (boot_cpu_data.x86 >= 5)
>> +		header->pmode_cr4 = read_cr4();
>>  	header->realmode_flags = acpi_realmode_flags;
>>  	header->real_magic = 0x12345678;
>>  
> 
>  NACK.  Later i486 chips do have CR4 -- for PSE, VME, etc. (the set of
> features varies across the line).  Use a fixup as elsewhere or something.
> 

The other alternative is to probe for the CPUID instruction (via 
EFLAGS.ID) -- CR4 is present if and only if CPUID exists.

	-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ