<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>13458</bug_id>
          
          <creation_ts>2019-07-26 17:11:49 +0000</creation_ts>
          <short_desc>Kernel embeds build paths</short_desc>
          <delta_ts>2019-08-29 14:41:31 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>kernel</component>
          <version>0.0.0</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>High</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.8 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ross Burton">ross.burton</reporter>
          <assigned_to name="Bruce Ashfield">bruce.ashfield</assigned_to>
          <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>tom.zanussi</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>84533</commentid>
    <comment_count>0</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-07-26 17:11:49 +0000</bug_when>
    <thetext>If you turn on the buildpaths QA test, or try a reproducible build, you discover that the kernel image contains build paths.

$ strings bzImage-5.0.19-yocto-standard |grep tmp/
out of pgt_buf in /data/poky-tmp/reproducible/tmp/work-shared/qemux86-64/kernel-source/arch/x86/boot/compressed/kaslr_64.c!?

Easy enough to find that in the kernel:

$ git grep &apos;out of pgt_buf&apos;
arch/x86/boot/compressed/kaslr_64.c:            debug_putstr(&quot;out of pgt_buf in &quot; __FILE__ &quot;!?\n&quot;);

But what&apos;s this in the top-level Makefile:

$ git grep prefix-map
Makefile:KBUILD_CFLAGS  += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)

So the __FILE__ shouldn&apos;t be using the full path.  However arch/x86/boot/compressed/Makefile has this:

KBUILD_CFLAGS := -m$(BITS) -O2

So that clears KBUILD_FLAGS, removing the -fmacro-prefix-map option.

I&apos;ve now hit the edge of my knowledge.  Is the build in arch/x86/boot/compressed sufficiently special that it *should* start from a clean KBUILD_CFLAGS, so it needs this added:

+KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)

Or, should it *not* clear the KBUILD_CFLAGS and instead just extend or prune.  Of not is that none of the other architectures reset KBUILD_CFLAGS but prune it first, so I&apos;m guessing that is what the x86 Makefile should do too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84535</commentid>
    <comment_count>1</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-07-26 18:04:31 +0000</bug_when>
    <thetext>Decided to file this upstream too https://bugzilla.kernel.org/show_bug.cgi?id=204333</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84574</commentid>
    <comment_count>2</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2019-08-02 02:24:40 +0000</bug_when>
    <thetext>arch/x86/boot/compressed has always been treated like this, since it really is quite special.

I&apos;d suggest that yes, we should just add the -fmacro-prefix-map to the Makefile and call it done, unless the maintainers can come up with a reason that the build flags are now safe to inherit.

I can fix this for linux-yocto with a patch, but it won&apos;t be a universal fix until something makes it into the mainline kernel.

Thoughts as to whether just fixing linux-yocto is enough for now ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84575</commentid>
    <comment_count>3</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-08-02 10:00:55 +0000</bug_when>
    <thetext>A patch to linux-yocto is a step in the right direction.  I&apos;ve filed an upstream bug and can engage with a friendly kernel guy here.

http://git.yoctoproject.org/cgit.cgi/poky-contrib/commit/?h=ross/reprod&amp;id=0266c973a8076d2e4e044016ef42aae329786a6a is the patch I hacked up which seems to work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84578</commentid>
    <comment_count>4</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2019-08-02 12:57:22 +0000</bug_when>
    <thetext>Yep, that&apos;s pretty much the same thing I did here. I&apos;ll add yours to my queue and have it out ASAP.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84753</commentid>
    <comment_count>5</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2019-08-27 15:17:26 +0000</bug_when>
    <thetext>this is fixed for linux-yocto.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84763</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-08-29 14:41:31 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=00ad844fe9279cc5c9005e3d096a9f4de0f33a4c</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>