Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1003809yba; Fri, 26 Apr 2019 12:20:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUcp5PP5mDlVbbqBzXA/NIr/ZbCtJXkSZhy9MAJBv9aMdMOnWxok1KSjoi2ZymXaQaWu5k X-Received: by 2002:a65:5086:: with SMTP id r6mr17655509pgp.301.1556306403961; Fri, 26 Apr 2019 12:20:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556306403; cv=none; d=google.com; s=arc-20160816; b=cb1R9+vJQ/B0QBr80AYQMmNsE14JAikfBcNexBXZqwpCg30GbpV0veWKqx9Iy/sne8 cV3ONrKjDSgybd/jZcV/sd39sPK1/lSmVPz6htmgipk3P9xbKrcQFr4IBBcSKzzcFyaB b34kpwEjHXPqPH0UUjnjk9xs/MCyj/PKo5Kfb8ztncMBJPebj0F95gYAQiiFE5pm61O8 6Urqvhnz4RfwaPfQK72TLGU2YaVTJkrw1ltqmoUgs2M71ap/XBGJdlCWxUzzPzNJG6Eu ledxU2nbONoHyFz2sRbe/wLfBKnGlb8LlBFsEfJoDuGv96SR/koTiI4OhjMgsu+4wXwd XAMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=8ErY/3cRDAfVjixyGGyDnVZPWNXM1Rcb9XkY+zGUrsA=; b=tIxQNzMGbQ7xP/insE0zo9ISEIoYwjig8yEiMI+EQ9aEkKfzh/O0JsgLTElZnZou3p ZVB/8VLuiufWrHWfZME51S4ezWbk537JUCY5Cajl97fLvYPfcHjBEtCut49TrSKvA77P K2UxdHxbzOoyIN9KZ1TkahhqoDoNsvGwLaQz6VSpCkmfcvkISLaBRwCdwxSXGSrnRWSj xYJtqJvfXUYoGA8dLCbkEEM+9L6E/PvXlCZ/kni+XTQ4xLLzLPNBGa51H1t0NQ35PbCm OyunT48r7IaOAuwjxSZWU6e1MCBpsWSDTnyl2vXevJbNTT13X2UkoGo13+dr7e/LT8Gp gGIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t18si26233153plo.113.2019.04.26.12.19.48; Fri, 26 Apr 2019 12:20:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726402AbfDZTS6 (ORCPT + 99 others); Fri, 26 Apr 2019 15:18:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61590 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725875AbfDZTS6 (ORCPT ); Fri, 26 Apr 2019 15:18:58 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C8AE713AC13; Fri, 26 Apr 2019 19:18:57 +0000 (UTC) Received: from treble (ovpn-123-99.rdu2.redhat.com [10.10.123.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3209E5D9C9; Fri, 26 Apr 2019 19:18:53 +0000 (UTC) Date: Fri, 26 Apr 2019 14:18:51 -0500 From: Josh Poimboeuf To: Miroslav Benes Cc: live-patching@vger.kernel.org, Peter Zijlstra , Mark Rutland , linux-kernel@vger.kernel.org, mliska@suse.cz, hubicka@ucw.cz Subject: Re: Livepatch vs LTO Message-ID: <20190426191851.5oodjy2m2bobqoio@treble> References: <20190425152628.ogk4woi3omeocwly@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 26 Apr 2019 19:18:58 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 26, 2019 at 11:00:48AM +0200, Miroslav Benes wrote: > > - For binary-based patch generation (kpatch-build), we currently diff > > objects at a per-compilation-unit level. That would have to be > > changed to work on vmlinux.o instead. > > > > - Objtool would also have to be changed to work on vmlinux.o. It's > > currently not optimized for large files, and the per-.o whitelisting > > would need to be fixed. And there may be other issues lurking. > > > > Also, thinking about objtool in this context has given me another idea, > > which might allow us to get rid of the use of -flive-patching and > > -fdump-ipa-clones altogether (which are both nasty and way too > > compiler-dependent): > > > > Since objtool is already reading every function in the kernel, it could > > create a checksum associated with each function, based on all the > > instructions (both within the function and any alternatives or other > > special sections it relies on). The function checksums could be written > > to a file. > > > > Then, when a patch file is applied and the kernel rebuilt, the checksum > > files could be compared to determine exactly which functions have > > changed at a binary level. > > > > Thoughts? Any reasons why that wouldn't work? > > I think it could work. If nothing else, it would give us the information > we look for. I'm gone next week but after that I'll start looking at implementing this. > > And, if we wanted to take the idea even further, objtool could have the > > ability to write the changed functions to a new object file. Voila, we > > now pretty much have kpatch-build :-) (Though whether this is better > > than source-based patch generation is certainly an open question.) > > ...worth of discussion. When I get some free time I might prototype something to see what it would look like. -- Josh