linux-mainline/arch/x86/xen
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
..
apic.c x86/xen/apic: Mark apic __ro_after_init 2023-08-09 12:00:46 -07:00
debugfs.c
debugfs.h
efi.c xen/efi: refactor deprecated strncpy 2023-09-19 07:04:49 +02:00
enlighten_hvm.c xen: simplify evtchn_do_upcall() call maze 2023-09-19 07:04:49 +02:00
enlighten_pv.c x86/xen: allow nesting of same lazy mode 2023-09-19 07:04:49 +02:00
enlighten_pvh.c
enlighten.c xen: simplify evtchn_do_upcall() call maze 2023-09-19 07:04:49 +02:00
grant-table.c
irq.c
Kconfig
Makefile
mmu_hvm.c
mmu_pv.c x86/xen: move paravirt lazy code 2023-09-19 07:04:49 +02:00
mmu.c
mmu.h
multicalls.c
multicalls.h x86/xen: move paravirt lazy code 2023-09-19 07:04:49 +02:00
p2m.c
platform-pci-unplug.c
pmu.c
pmu.h
setup.c dma-maping updates for Linux 6.6 2023-08-29 20:32:10 -07:00
smp_hvm.c x86/smpboot: Switch to hotplug core state synchronization 2023-05-15 13:44:56 +02:00
smp_pv.c x86/xen/pv: Pretend that it found SMP configuration 2023-08-09 11:58:21 -07:00
smp.c
smp.h x86: xen: add missing prototypes 2023-06-26 07:47:11 +02:00
spinlock.c
suspend_hvm.c
suspend_pv.c
suspend.c
time.c x86/tsc: Provide sched_clock_noinstr() 2023-06-05 21:11:08 +02:00
trace.c
vga.c
xen-asm.S x86/shstk: Add user control-protection fault handler 2023-08-02 15:01:50 -07:00
xen-head.S x86/Xen: tidy xen-head.S 2023-07-04 06:57:38 +02:00
xen-ops.h x86: xen: add missing prototypes 2023-06-26 07:47:11 +02:00