tmp_suning_uos_patched/arch/x86
Jason A. Donenfeld 25d4fdf1f0 x86/tsc: Use fallback for random_get_entropy() instead of zero
commit 3bd4abc07a267e6a8b33d7f8717136e18f921c53 upstream.

In the event that random_get_entropy() can't access a cycle counter or
similar, falling back to returning 0 is suboptimal. Instead, fallback
to calling random_get_entropy_fallback(), which isn't extremely high
precision or guaranteed to be entropic, but is certainly better than
returning zero all the time.

If CONFIG_X86_TSC=n, then it's possible for the kernel to run on systems
without RDTSC, such as 486 and certain 586, so the fallback code is only
required for that case.

As well, fix up both the new function and the get_cycles() function from
which it was derived to use cpu_feature_enabled() rather than
boot_cpu_has(), and use !IS_ENABLED() instead of #ifndef.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: x86@kernel.org
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-30 09:33:42 +02:00
..
boot x86/boot/compressed: Move CLANG_FLAGS to beginning of KBUILD_CFLAGS 2022-01-27 10:54:00 +01:00
configs x86/kbuild: Enable CONFIG_KALLSYMS_ALL=y in the defconfigs 2022-01-27 10:54:21 +01:00
crypto lib/crypto: blake2s: avoid indirect calls to compression function for Clang CFI 2022-05-30 09:33:26 +02:00
entry x86/entry: Add a fence for kernel entry SWAPGS in paranoid_entry() 2021-12-08 09:03:27 +01:00
events perf/x86/intel/pt: Fix address filter config for 32-bit kernel 2022-04-08 14:40:04 +02:00
hyperv x86/hyperv: Fix NULL deref in set_hv_tscchange_cb() if Hyper-V setup fails 2021-11-26 10:39:19 +01:00
ia32
include x86/tsc: Use fallback for random_get_entropy() instead of zero 2022-05-30 09:33:42 +02:00
kernel random: remove unused irq_flags argument from add_interrupt_randomness() 2022-05-30 09:33:27 +02:00
kvm KVM: x86/mmu: fix NULL pointer dereference on guest INVPCID 2022-05-30 09:33:22 +02:00
lib x86: __memcpy_flushcache: fix wrong alignment if size > 2^32 2022-05-09 09:05:06 +02:00
math-emu
mm x86/boot: Add setup_indirect support in early_memremap_is_setup_data() 2022-03-16 14:16:02 +01:00
net bpf: Handle return value of BPF_PROG_TYPE_STRUCT_OPS prog 2021-10-06 15:55:50 +02:00
oprofile
pci x86/pci/xen: Disable PCI/MSI[-X] masking for XEN_HVM guests 2022-05-09 09:05:00 +02:00
platform x86/sme: Explicitly map new EFI memmap table as encrypted 2021-12-14 11:32:35 +01:00
power x86/cpu: Load microcode during restore_processor_state() 2022-05-09 09:05:07 +02:00
purgatory
ras
realmode x86/mm: Flush global TLB when switching to trampoline page-table 2022-01-27 10:54:14 +01:00
tools x86/tools: Fix objdump version check again 2021-08-18 08:59:15 +02:00
um um: Cleanup syscall_handler_t definition/cast, fix warning 2022-05-25 09:17:52 +02:00
video
xen xen: delay xen_hvm_init_time_ops() if kdump is boot on vcpu>=32 2022-04-13 21:01:01 +02:00
.gitignore
Kbuild
Kconfig x86/Kconfig: Do not allow CONFIG_X86_X32_ABI=y with llvm-objcopy 2022-04-13 21:01:02 +02:00
Kconfig.assembler
Kconfig.cpu
Kconfig.debug
Makefile x86/build: Propagate $(CLANG_FLAGS) to $(REALMODE_FLAGS) 2021-05-11 14:47:18 +02:00
Makefile_32.cpu
Makefile.um