Subject: Re: linux-next: Tree for May 14 (objtool 2/2)

From: Kees Cook <[email-masked]>
Date: Thu, 28 May 2020 23:06:32 -0700

On Thu, May 28, 2020 at 10:44:04AM -0500, Josh Poimboeuf wrote:
> On Thu, May 14, 2020 at 09:04:36AM -0700, Randy Dunlap wrote:
> > On 5/14/20 4:07 AM, Stephen Rothwell wrote:
> > > Hi all,
> > > 
> > > Changes since 20200512:
> > > 
> > 
> > on x86_64:
> > 
> > drivers/ide/ide-tape.o: warning: objtool: ide_tape_discard_merge_buffer.constprop.7()+0x4e: unreachable instruction
> > drivers/scsi/sd.o: warning: objtool: sd_pr_clear()+0x1e: unreachable instruction
> > drivers/scsi/sd_zbc.o: warning: objtool: sd_zbc_update_wp_offset_workfn()+0xec: unreachable instruction
> > drivers/target/target_core_xcopy.o: warning: objtool: target_xcopy_do_work()+0xdd6: unreachable instruction
> > 
> > 
> > randconfig file is attached.
> 
> Kees,
> 
> More UBSAN_TRAP fun.  This randconfig has:
> 
> CONFIG_UBSAN_TRAP=y
> CONFIG_UBSAN_ALIGNMENT=y
> # CONFIG_COMPILE_TEST is not set

Ugh, I thought CONFIG_COMPILE_TEST always gets set for randconfig and
the all*config choices, but now I see that CONFIG_COMPILE_TEST is
enabled due to the "all" part of the all*config choices. Okay. Big
hammer:

diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan
index 929211039bac..27bcc2568c95 100644
--- a/lib/Kconfig.ubsan
+++ b/lib/Kconfig.ubsan
@@ -63,7 +63,7 @@ config UBSAN_SANITIZE_ALL
 config UBSAN_ALIGNMENT
        bool "Enable checks for pointers alignment"
        default !HAVE_EFFICIENT_UNALIGNED_ACCESS
-       depends on !X86 || !COMPILE_TEST
+       depends on !UBSAN_TRAP
        help
          This option enables the check of unaligned memory accesses.
          Enabling this option on architectures that support unaligned

How about that?

-- 
Kees Cook