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

Re: [PATCH 4/4] livepatch: differentiate between old and new build systems


  • To: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>, Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>, "konrad.wilk@xxxxxxxxxx" <konrad.wilk@xxxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 21 Mar 2022 11:25:40 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I/OEFbRNgjxpheFo5Iez2tzgxUucqboVBeNXDiGalCg=; b=TIuTxyVg8HFnPamjWWo11fhV911xPu5aIwG+yvPfRkR8TXn4HpTI2I69eBN3O6LWxDBoZe1VeKiPfpUlV+mYdiQ6EPZbMfGl3meAxD72AWo0KUxPBLzP7mxkbZJGAeYOYnbgBwHgkhGVBrhGhOdIBHM9YAxUDcaZewQ62E8X0mNLvWkC7nWEFB5V5NLpuInVebj79CBv4dYFvJ+cl9CfT2oI+gnjgqXzSUAHww0NAseA/vzcYU/gcQBDbqbXycVULpU0K6tlROj9nTIwc81A7hEzpiIHXx5evRKhnb6b29NWIG/DP7Erwtq6C1DpUgqDJq+rki0EPj/KkvQWMWKM9Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bsBTq0i/rawIP5dkLvvAtHAxEhITYN/8itMdCGwbaWToe8mI1noncL7V0QXBkkrWzEPHC5wQN6zkKIDdCgqOwdKoW7kc/TazEP1aZcDGJL8MBjH0IGS2BRD3CKI9LAhMdhoAOs9S/gSueje/91iS7XmAm2jqxHO3e//DENXhKOaJ5OOaNCFxTfCzdw/8i1Fv6zDSMiO/4S63nYZ3jkQbItA5HeWZfHcNljcLGY8ZXyH+MMwW7BPrICmpXzlZualcz3fKClkh7Iluu35CD4sE+TOpJ6DOd/iM/n0RoSuAup4e4/zJWC/iHFOtngKZ19cfXpCXryc7Js9aoRLz/URcBQ==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "doebel@xxxxxxxxx" <doebel@xxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>
  • Delivery-date: Mon, 21 Mar 2022 10:25:56 +0000
  • Ironport-data: A9a23:tnmweqBy6qHJbxVW/w3jw5YqxClBgxIJ4kV8jS/XYbTApGgmhT0Gz DBJXjiAPv3eYGKnKYsiPd61oUkHvZTQx9BlQQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMZiaA4E/raNANlFEkvU2ybuOU5NXsZ2YgHWeIdA970Ug5w7Vj29Yx6TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPhD5 tB25LLhUj0sHYyLhrQBbgVYFnBhaPguFL/veRBTsOSWxkzCNXDt3+9vHAc9OohwFuRfWD8Us 6ZCcXZUM07F17neLLGTE4GAguw5K8bmJsUHs2xIxjDFF/c2B5vERs0m4PcGjW5p2JwTQp4yY eJGThw1MizLeiFLM09OCtU4rP6MwVbWJmgwRFW9+vNsvjm7IBZK+LTqPdDYfvSDQMxHmUDeq m+u12bkBhAXMvSPxDzD9Wij7sfMmiXhUY5UC7y89dZtmlSYwmFVAxo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GZAVwIv7GeDlPhiWt6UkWoJgjpHFogfD2nR87heUAotd/lq D5259T5cNzp/8tHNFA7dg6ML6K40z2MFvx2TGpUBza/J9uAQO4l3ew2sRz2N2X
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Mar 11, 2022 at 09:33:15AM +0100, Roger Pau Monné wrote:
> On Thu, Mar 10, 2022 at 06:01:48PM +0000, Andrew Cooper wrote:
> > On 08/03/2022 14:52, Roger Pau Monne wrote:
> > > On Tue, Mar 08, 2022 at 02:38:47PM +0000, Andrew Cooper wrote:
> > >> On 02/03/2022 14:27, Roger Pau Monne wrote:
> > >>> diff --git a/livepatch-build b/livepatch-build
> > >>> index 38a92be..656cdac 100755
> > >>> --- a/livepatch-build
> > >>> +++ b/livepatch-build
> > >>> @@ -98,14 +98,20 @@ function build_special()
> > >>>  
> > >>>      # Build with special GCC flags
> > >>>      cd "${SRCDIR}/xen" || die
> > >>> -    sed -i 's/CFLAGS += -nostdinc/CFLAGS += -nostdinc 
> > >>> -ffunction-sections -fdata-sections/' Rules.mk
> > >>> -    cp -p arch/x86/Makefile arch/x86/Makefile.bak
> > >>> -    sed -i 
> > >>> 's/--section-alignment=0x200000/--section-alignment=0x1000/' 
> > >>> arch/x86/Makefile
> > >>> -    # Restore timestamps to prevent spurious rebuilding
> > >>> -    touch --reference=arch/x86/Makefile.bak arch/x86/Makefile
> > >>> -    make "-j$CPUS" $XEN_DEBUG &> "${OUTPUT}/build_${name}_compile.log" 
> > >>> || die
> > >>> -    sed -i 's/CFLAGS += -nostdinc -ffunction-sections 
> > >>> -fdata-sections/CFLAGS += -nostdinc/' Rules.mk
> > >>> -    mv -f arch/x86/Makefile.bak arch/x86/Makefile
> > >>> +    if grep -q 'nostdinc' Rules.mk; then
> > >>> +         # Support for old build system, attempt to set 
> > >>> -f{function,data}-sections and rebuild
> > >>> +        sed -i 's/CFLAGS += -nostdinc/CFLAGS += -nostdinc 
> > >>> -ffunction-sections -fdata-sections/' Rules.mk
> > >>> +        cp -p arch/x86/Makefile arch/x86/Makefile.bak
> > >>> +        sed -i 
> > >>> 's/--section-alignment=0x200000/--section-alignment=0x1000/' 
> > >>> arch/x86/Makefile
> > >>> +        # Restore timestamps to prevent spurious rebuilding
> > >>> +        touch --reference=arch/x86/Makefile.bak arch/x86/Makefile
> > >>> +        make "-j$CPUS" $XEN_DEBUG &> 
> > >>> "${OUTPUT}/build_${name}_compile.log" || die
> > >>> +        sed -i 's/CFLAGS += -nostdinc -ffunction-sections 
> > >>> -fdata-sections/CFLAGS += -nostdinc/' Rules.mk
> > >>> +        mv -f arch/x86/Makefile.bak arch/x86/Makefile
> > >>> +    else
> > >>> +        # -f{function,data}-sections set by CONFIG_LIVEPATCH
> > >>> +        make "-j$CPUS" $XEN_DEBUG &> 
> > >>> "${OUTPUT}/build_${name}_compile.log" || die
> > >>> +    fi
> > >> This really ought to be the other way around, by spotting the thing we
> > >> know is good, and then falling back to the heuristics.  In light of the
> > >> updates to the Xen side, something like:
> > > I'm not sure I agree. I do prefer to spot the 'bad' one, and just
> > > fallback to expecting Xen to correctly set -f{function,data}-sections
> > > otherwise.
> > >
> > >> if grep -q CC_SPLIT_SECTIONS Kconfig; then
> > > Because this logic ties us to not moving CC_SPLIT_SECTIONS from being
> > > defined in xen/Kconfig (or even changing it's name), and gain ties the
> > > livepatch tools to internal details about the Xen build system.
> > 
> > It doesn't particularly matter which way around the if/else is.  It does
> > matter that we're choosing based on something relevant.
> > 
> > nostdinc in Rules.mk has exactly the same amount of "magic string in
> > magic file" as CC_SPLIT_SECTIONS in Kconfig, but has absolutely nothing
> > to do with the property we actually care about.
> > 
> > Really what you actually want is
> > 
> > if grep -q CC_SPLIT_SECTIONS Kconfig; then
> >     # Xen behaves sensibly
> > elif grep -q 'nostdinc' Rules.mk; then
> >     # Legacy mess with Rules.mk
> > else
> >     die "Help with build system divination"
> > fi
> > 
> > The "behaves sensibly" case is unlikely to change name and unlikely to
> > move locations, but each are easy to cope with via `grep -e FOO -e BAR
> > file1 file2`, and this approach avoids the problem of blindly (and
> > falsely) assuming that anything which is 4.14 and later splits sections
> > correctly, and that this will remain true even when someone adds "# use
> > to have -nostdinc here" to Rules.mk.
> 
> TBH, I don't find the proposed solution is much better to what's in
> this patch, and as said I really dislike tying the behavior of the
> livepatch build tools to heuristics against Xen internal build files -
> be it a Kconfig or a Makefile. Specially because your proposed
> approach adds heuristics to detect the 'good' case which should be the
> default one going forward.
> 
> A better option might be to just make the 'build adjustments' a
> command line option that the user can pass to the tools, ie:
> --build-adjust and let the user decide whether it needs the
> adjustments or not. If I was a livepatch user myself I would seriously
> consider picking the linker script changes and backport that to my
> production version.

Ping?

Is the proposed command line option an acceptable way to move this
forward?

Can I have an opinion from the maintainers?

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.