Patch "x86/entry: Work around Clang __bdos() bug" has been added to the 6.0-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    x86/entry: Work around Clang __bdos() bug

to the 6.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     x86-entry-work-around-clang-__bdos-bug.patch
and it can be found in the queue-6.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 6a2d2a27856a84f318e3b1aeead82ef1bc1c4f03
Author: Kees Cook <keescook@xxxxxxxxxxxx>
Date:   Mon Sep 19 19:45:14 2022 -0700

    x86/entry: Work around Clang __bdos() bug
    
    [ Upstream commit 3e1730842f142add55dc658929221521a9ea62b6 ]
    
    Clang produces a false positive when building with CONFIG_FORTIFY_SOURCE=y
    and CONFIG_UBSAN_BOUNDS=y when operating on an array with a dynamic
    offset. Work around this by using a direct assignment of an empty
    instance. Avoids this warning:
    
    ../include/linux/fortify-string.h:309:4: warning: call to __write_overflow_field declared with 'warn
    ing' attribute: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wat
    tribute-warning]
                            __write_overflow_field(p_size_field, size);
                            ^
    
    which was isolated to the memset() call in xen_load_idt().
    
    Note that this looks very much like another bug that was worked around:
    https://github.com/ClangBuiltLinux/linux/issues/1592
    
    Cc: Juergen Gross <jgross@xxxxxxxx>
    Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
    Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
    Cc: Ingo Molnar <mingo@xxxxxxxxxx>
    Cc: Borislav Petkov <bp@xxxxxxxxx>
    Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
    Cc: x86@xxxxxxxxxx
    Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
    Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
    Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
    Link: https://lore.kernel.org/lkml/41527d69-e8ab-3f86-ff37-6b298c01d5bc@xxxxxxxxxx
    Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index 0ed2e487a693..9b1a58dda935 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -765,6 +765,7 @@ static void xen_load_idt(const struct desc_ptr *desc)
 {
 	static DEFINE_SPINLOCK(lock);
 	static struct trap_info traps[257];
+	static const struct trap_info zero = { };
 	unsigned out;
 
 	trace_xen_cpu_load_idt(desc);
@@ -774,7 +775,7 @@ static void xen_load_idt(const struct desc_ptr *desc)
 	memcpy(this_cpu_ptr(&idt_desc), desc, sizeof(idt_desc));
 
 	out = xen_convert_trap_info(desc, traps, false);
-	memset(&traps[out], 0, sizeof(traps[0]));
+	traps[out] = zero;
 
 	xen_mc_flush();
 	if (HYPERVISOR_set_trap_table(traps))



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux