Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp634761ybh; Tue, 21 Jul 2020 04:18:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOsfesdCi3icaOZ7wweMw9D0fmipkghQKeh0ja9/0iCymgEWWvQ3O21I/c+zJm47f4fR6+ X-Received: by 2002:a17:906:9147:: with SMTP id y7mr23364625ejw.399.1595330281744; Tue, 21 Jul 2020 04:18:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595330281; cv=none; d=google.com; s=arc-20160816; b=l4IeKPplHE4renUNoK9YY/JL8ncFk3+LZWY36hR63etO50CGwJpKUuFBuu8VSAJ6w2 mszB7h8FHXhiRZLbnOTmh9VBrBvQeudIE3fg9itvDj+38tK16ZIsStncXDc3ZXOym/HN DdpB8tDs+DxoVi5QCQ32WINhSmweZfAxDyPybzaN8WcbjprFc/oiVucmhDR0KVLk4vFV RETI4qffWnoYl7+kzAsiAGYsTc10xTfcGxTMWGf7wU8FypeU9aaYk21ok2QLQbzCabBR YchPN/v4FVPjNOzxgFD+ZUlzWuHd9C6ZaN87MHnAL3wh+GqX6cWDEifEHMkLOJgLeSYf hS/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=pSktzcj1bgwrmLdk5zfOkioDb7jzdj12tDDqgLkLso0=; b=NgVR8L5soc/8j/1GArNi/SE/me3TPsA88/ljKp32LuoSmq75zY+HGW4WaUrwulqAYI YDGFcbEVbn/TGXWdOIqufU1A8ZCx2KWEiay2ERbcixTtTxWKFIg22+7TFpCoHbzPeWkM olneklVkQgmERYqlx2vQ9TSQI9YnXrAxBVIIiWeRz+P8z7oSqDlQy6iwn8+Zw08EzEwm X0HRHhir+Y+UoFLEYOQw02R37dKXw/XWi4khD26bVHafJCHhcg6rT1xIqM/DL2+NOmGy UMOFuo08jvLEdefWnYe8whdylTEMCszkgg6I1iFQt088hoPjF8vfcWNtPxijz+CeeUzF ASaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n15si13181970eje.289.2020.07.21.04.17.38; Tue, 21 Jul 2020 04:18:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729476AbgGULRD (ORCPT + 99 others); Tue, 21 Jul 2020 07:17:03 -0400 Received: from mx2.suse.de ([195.135.220.15]:57182 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728159AbgGULRC (ORCPT ); Tue, 21 Jul 2020 07:17:02 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DFB29AFF8; Tue, 21 Jul 2020 11:17:07 +0000 (UTC) Date: Tue, 21 Jul 2020 13:17:00 +0200 (CEST) From: Miroslav Benes To: Josh Poimboeuf cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Zijlstra , Randy Dunlap Subject: Re: [PATCH] Revert "kbuild: use -flive-patching when CONFIG_LIVEPATCH is enabled" In-Reply-To: <696262e997359666afa053fe7d1a9fb2bb373964.1595010490.git.jpoimboe@redhat.com> Message-ID: References: <696262e997359666afa053fe7d1a9fb2bb373964.1595010490.git.jpoimboe@redhat.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 17 Jul 2020, Josh Poimboeuf wrote: > Use of the new -flive-patching flag was introduced with the following > commit: > > 43bd3a95c98e ("kbuild: use -flive-patching when CONFIG_LIVEPATCH is enabled") > > This flag has several drawbacks: > > - It disables some optimizations, so it can have a negative effect on > performance. > > - According to the GCC documentation it's not compatible with LTO, which > will become a compatibility issue as LTO support gets upstreamed in > the kernel. > > - It was intended to be used for source-based patch generation tooling, > as opposed to binary-based patch generation tooling (e.g., > kpatch-build). It probably should have at least been behind a > separate config option so as not to negatively affect other livepatch > users. > > - Clang doesn't have the flag, so as far as I can tell, this method of > generating patches is incompatible with Clang, which like LTO is > becoming more mainstream. > > - It breaks GCC's implicit noreturn detection for local functions. This > is the cause of several "unreachable instruction" objtool warnings. > > - The broken noreturn detection is an obvious GCC regression, but we > haven't yet gotten GCC developers to acknowledge that, which doesn't > inspire confidence in their willingness to keep the feature working as > optimizations are added or changed going forward. > > - While there *is* a distro which relies on this flag for their distro > livepatch module builds, there's not a publicly documented way to > create safe livepatch modules with it. Its use seems to be based on > tribal knowledge. It serves no benefit to those who don't know how to > use it. > > (In fact, I believe the current livepatch documentation and samples > are misleading and dangerous, and should be corrected. Or at least > amended with a disclaimer. But I don't feel qualified to make such > changes.) > > Also, we have an idea for using objtool to detect function changes, > which could potentially obsolete the need for this flag anyway. > > At this point the flag has no benefits for upstream which would > counteract the above drawbacks. Revert it until it becomes more ready. > > This reverts commit 43bd3a95c98e1a86b8b55d97f745c224ecff02b9. > > Fixes: 43bd3a95c98e ("kbuild: use -flive-patching when CONFIG_LIVEPATCH is enabled") > Reported-by: Randy Dunlap > Signed-off-by: Josh Poimboeuf Acked-by: Miroslav Benes M