linux/arch/x86
Justin Stitt 0fc6ff5a0f xen/efi: refactor deprecated strncpy
`strncpy` is deprecated for use on NUL-terminated destination strings [1].

`efi_loader_signature` has space for 4 bytes. We are copying "Xen" (3 bytes)
plus a NUL-byte which makes 4 total bytes. With that being said, there is
currently not a bug with the current `strncpy()` implementation in terms of
buffer overreads but we should favor a more robust string interface
either way.

A suitable replacement is `strscpy` [2] due to the fact that it guarantees
NUL-termination on the destination buffer while being functionally the
same in this case.

Link: www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings[1]
Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2]
Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230911-strncpy-arch-x86-xen-efi-c-v1-1-96ab2bba2feb@google.com
Signed-off-by: Juergen Gross <jgross@suse.com>
2023-09-19 07:04:49 +02:00
..
boot x86/boot/compressed: Reserve more memory for page tables 2023-09-17 09:48:57 +02:00
coco - Some SEV and CC platform helpers cleanup and simplifications now that 2023-06-27 13:26:30 -07:00
configs - The first, cleanup part of the microcode loader reorg tglx has been 2023-08-28 15:55:20 -07:00
crypto crypto: x86/aesni - remove unused parameter to aes_set_key_common() 2023-07-22 13:59:39 +12:00
entry xen: simplify evtchn_do_upcall() call maze 2023-09-19 07:04:49 +02:00
events perf/x86/uncore: Correct the number of CHAs on EMR 2023-09-05 21:50:21 +02:00
hyperv hyperv-next for v6.6 2023-09-04 11:26:29 -07:00
ia32
include x86/xen: allow nesting of same lazy mode 2023-09-19 07:04:49 +02:00
kernel x86/xen: move paravirt lazy code 2023-09-19 07:04:49 +02:00
kvm ARM: 2023-09-07 13:52:20 -07:00
lib x86/ibt: Avoid duplicate ENDBR in __put_user_nocheck*() 2023-09-12 17:51:24 +02:00
math-emu x86/fpu: Include asm/fpu/regset.h 2023-05-18 11:56:18 -07:00
mm Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
net bpf: Support new 32bit offset jmp instruction 2023-07-27 18:52:33 -07:00
pci pci-v6.6-changes 2023-08-30 20:23:07 -07:00
platform efi/x86: Move EFI runtime call setup/teardown helpers out of line 2023-09-11 06:37:50 +00:00
power x86/topology: Remove CPU0 hotplug option 2023-05-15 13:44:49 +02:00
purgatory x86/purgatory: Remove LTO flags 2023-09-17 09:49:03 +02:00
ras
realmode x86/realmode: Make stack lock work in trampoline_compat() 2023-05-30 14:11:47 +02:00
tools ELF: fix all "Elf" typos 2023-04-08 13:45:37 -07:00
um um: Hard-code the result of 'uname -s' 2023-08-26 22:40:37 +02:00
video Merge drm/drm-next into drm-misc-next 2023-07-24 15:44:47 +02:00
virt/vmx/tdx
xen xen/efi: refactor deprecated strncpy 2023-09-19 07:04:49 +02:00
.gitignore
Kbuild
Kconfig efi/x86: Ensure that EFI_RUNTIME_MAP is enabled for kexec 2023-09-11 06:37:50 +00:00
Kconfig.assembler x86/shstk: Add Kconfig option for shadow stack 2023-07-11 14:12:18 -07:00
Kconfig.cpu x86/cpu: Remove X86_FEATURE_NAMES 2023-05-15 20:03:08 +02:00
Kconfig.debug docs: move x86 documentation into Documentation/arch/ 2023-03-30 12:58:51 -06:00
Makefile Kbuild updates for v6.6 2023-09-05 11:01:47 -07:00
Makefile.postlink x86/build: Avoid relocation information in final vmlinux 2023-06-14 19:54:40 +02:00
Makefile.um um: Only disable SSE on clang to work around old GCC bugs 2023-04-04 09:57:05 +02:00
Makefile_32.cpu