Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1609175rwb; Thu, 19 Jan 2023 13:00:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXvSwA5QnddMEz0Yr1QQiGMxRIv5Nko6tdJIKJNXQ6ylRV7nghWiSnjYDee+wGHypPVE3zgA X-Received: by 2002:a50:ef13:0:b0:49b:67c3:39a7 with SMTP id m19-20020a50ef13000000b0049b67c339a7mr14395970eds.20.1674162014556; Thu, 19 Jan 2023 13:00:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674162014; cv=none; d=google.com; s=arc-20160816; b=DgCZe5Fi+UeMGLwoAo+Jmcgit/HNOLEyswzpzNWt8QGNJ4KXAPKr3Yz6Xjjao7746L P/dE11e7gvlL0ks6v9XvOaKlccpmJZ0QbLFqMydrocXDn8uswjzGNbOrILRDofsNVEt5 92BC7MARDkEFhUnNIRJ2mmdhJzTw/rw3+6spqjqo5ZL3wNxSTEhSUOrnjG8RKB8jvVnx Eo6J9aL43Rw5KjMACK7UIgHXIAxdx3COVJ6xm3AlLsnl+X5QKQ17Ch+NZvCo8YFoQBBg Bm55VLVf1lIx6qktdi0gu4r6KNzt97zFi031UZE6JbnlpidR43gtWCiHm5Hg7nYCiJfT CTuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=KAPcY0RoQ7iL4uKaVfduqgbpKvCcIDu0ezbY0gZvBZw=; b=lHa39aJXIo1JonRrFuVgbUZArUhCO57A38hzvTo0geG3oEVd1NY5/jntuX8ND1RzXh HcRlUxIvUpRVutusul4CY3TJY5oLpS4o+oUCrjm14ulcRSz97YD55YKZ+Lbs/syn04et G3+vcH0OqjtqD6a2MSmgKsyj9hRs+MgC7elHSfXyepIXWX45Ib+B4Wa87IdjFl1x1y69 p4fV/HbPdEZgjDXqeqgXui7r9che6bHzrxbCP16yZavA+sj5/sOB0kW/BbKkQKXzsVhO 8pOidX2tgds+YtVmmCPiaQluHRWpBM8ZM0zlIOvYD6ao85dbZIi77ad+ktw2LTFzXZPQ 11xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rGc04Ubp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d23-20020aa7ce17000000b0049b471421dasi25259294edv.316.2023.01.19.13.00.02; Thu, 19 Jan 2023 13:00:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rGc04Ubp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231235AbjASTJC (ORCPT + 46 others); Thu, 19 Jan 2023 14:09:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230106AbjASTIa (ORCPT ); Thu, 19 Jan 2023 14:08:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 163EF9B113; Thu, 19 Jan 2023 11:07:08 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 02F9661D55; Thu, 19 Jan 2023 19:06:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F1C7C433D2; Thu, 19 Jan 2023 19:06:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674155210; bh=84wFksc5y+vkdlmosNddXFXLVddcPsdJwTu1PkhnkU8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=rGc04UbpBVmqi4/ZK3APXtn4XV5D6LVQvU5RmTz2mq3BvwJJ2wfIck5SiJlkcj8i9 gRwZswiTyCJH9xIjrW5ribwgXDEa2YOm41YsWsuXwUuVDw6ArG0raUEAEf8NtydewE ELcISv52HkMP7nJrPcEboD5Zzn9Na84AiJEOyPWa7DMsB4z5aCSO3ndGfOMersTGR0 wS7DKxawLsq1ae1i5hm6FZOrGYWV0ls1R0VaKZ91ReiTKDFgXpGo96g6G8oKXFme/o dFUVq2JjpBG+cd/wQBIyZXRTNKtwOdsA5iDDEo4pmYtj3sddeBg2IJfk78O2a4Uumx MK+KhVRryRK9w== Received: by mail-lf1-f44.google.com with SMTP id br9so4643809lfb.4; Thu, 19 Jan 2023 11:06:50 -0800 (PST) X-Gm-Message-State: AFqh2kqtqdgOWTaA+m1wB3Cz3AMlZWAlJHQfJFn6rpGYflI6n46M0KzD B2tfKuI6ZgP7re5DWa++0hZCRYjTrIBB7SOpkKY= X-Received: by 2002:ac2:48b7:0:b0:4b6:e71d:94a6 with SMTP id u23-20020ac248b7000000b004b6e71d94a6mr901375lfg.476.1674155208380; Thu, 19 Jan 2023 11:06:48 -0800 (PST) MIME-Version: 1.0 References: <20230118204728.1876249-1-song@kernel.org> <20230118220812.dvztwhlmliypefha@treble> In-Reply-To: <20230118220812.dvztwhlmliypefha@treble> From: Song Liu Date: Thu, 19 Jan 2023 11:06:35 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v9] livepatch: Clear relocation targets on a module removal To: Josh Poimboeuf Cc: linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, live-patching@vger.kernel.org, x86@kernel.org, jikos@kernel.org, pmladek@suse.com, joe.lawrence@redhat.com, Miroslav Benes , Josh Poimboeuf Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 18, 2023 at 2:08 PM Josh Poimboeuf wrote: > > On Wed, Jan 18, 2023 at 12:47:28PM -0800, Song Liu wrote: > > From: Miroslav Benes > > > > Josh reported a bug: > > > > When the object to be patched is a module, and that module is > > rmmod'ed and reloaded, it fails to load with: > > > > module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 2, loc 00000000ba0302e9, val ffffffffa03e293c > > livepatch: failed to initialize patch 'livepatch_nfsd' for module 'nfsd' (-8) > > livepatch: patch 'livepatch_nfsd' failed for module 'nfsd', refusing to load module 'nfsd' > > > > The livepatch module has a relocation which references a symbol > > in the _previous_ loading of nfsd. When apply_relocate_add() > > tries to replace the old relocation with a new one, it sees that > > the previous one is nonzero and it errors out. > > > > On ppc64le, we have a similar issue: > > > > module_64: livepatch_nfsd: Expected nop after call, got e8410018 at e_show+0x60/0x548 [livepatch_nfsd] > > livepatch: failed to initialize patch 'livepatch_nfsd' for module 'nfsd' (-8) > > livepatch: patch 'livepatch_nfsd' failed for module 'nfsd', refusing to load module 'nfsd' > > Shouldn't there also be a fix for this powerpc issue? There was a working version, but it was not very clean. We couldn't agree on the path forward for powerpc, so we are hoping to ship the fix to x86 (and s390?) first [1]. Thanks, Song [1] https://lore.kernel.org/live-patching/Y7hLvpHqgY0oJ4GY@alley/#t