Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8747938rwp; Wed, 19 Jul 2023 14:56:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlFc1ADI5dqwTaYSzkSxH9JDYi6KNUPqsTfcEjo8+4mO2hGd5vWLw+BZgcscRdF4e/bL2ZYV X-Received: by 2002:a17:906:3a9a:b0:993:c48f:184c with SMTP id y26-20020a1709063a9a00b00993c48f184cmr3439538ejd.10.1689803796008; Wed, 19 Jul 2023 14:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689803795; cv=none; d=google.com; s=arc-20160816; b=r1wQht6kSm44TzvXF/bLsdzFNZ7cu0FyMVVbWdm1e9p6ExKFtvMczfJyNWFWzBMaEU QPI+WD5nE1DgQ1Wp8NijN2geg1bHGx8Xbue9x81t8ST8BgRonb1fl5lX2qOGDsD2A6pd 9pSUj5Mglk/H4CAuRjxLR+OeBOe/jLsOLjqBr5c+AQPG3Os1kJOFa7jQ1LvPpGnzqwC9 cHUZr3Fh0yV6kksblZ8TVavw3LxdlV9RLpvVlMgr/gSZN41+fqA9LS6qNSpS/FQcDqXR /bwURa2cSjPxvBiI5mOvVfA3s7vwhiiKUS2HOXwi4lL+GQZM3pWRyi8oPI3Chrl3hqu/ FNzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IFLRLR+CVd0fGygK9/y3WQh0FdrsOl8uBfwPnqmJWno=; fh=eRxyTRPqbc2rSKVGXxmbp2ZZXfifOQMeoRkgz4rJUQQ=; b=rYnLnC3y131p2L+kMZpzZapM2o5vHdd4Ttf6pLNg+Y5xFXgIECfM7AZ+KXdNxux+P1 41C8NMyUcktSQles4mHSwAf+o4UVn4phjVD+wXHcLuxCSo1OVU6T1GUxCfVUovCTVCDv 97W95aXBA6UXNqxaIbBo3TewOlCMppkhCX94E9T9YDjrfsiIn6ChrLgbnrv30Xe/+Ymn ooBj/yz833qe9gA5/LlrLc0w8rfgpn+qxYVTB+VE/9YIZ9fw9ApzLeJifAP73qdh9SUE dwsBuCzullXvwwPYTP34Aq+QXr6eUDK6IbTwXp2qZlmtxdGyLFwznuAbwe6MTUJHpU9K bqzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Qa8T1TOj; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j10-20020a170906278a00b00988699d64cdsi3556770ejc.959.2023.07.19.14.56.11; Wed, 19 Jul 2023 14:56:35 -0700 (PDT) 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=@infradead.org header.s=casper.20170209 header.b=Qa8T1TOj; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229813AbjGSUl3 (ORCPT + 99 others); Wed, 19 Jul 2023 16:41:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229625AbjGSUl2 (ORCPT ); Wed, 19 Jul 2023 16:41:28 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C89939E; Wed, 19 Jul 2023 13:41:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=IFLRLR+CVd0fGygK9/y3WQh0FdrsOl8uBfwPnqmJWno=; b=Qa8T1TOjmaokc5Ti9VatGeWZVu D1od/kVme2vcCXmS3L2sgzVgLtnbaTtd5nJvsCwrKCcdiykLyH+HLBW5tFwk5PM/I5Op449zxQILc rd7QxgqjFIwweE7IOLZBjYjxfRRzfL2tntWAnqwUR0R63T2VtbguoJFevcfdFyXM7xEF1+VrffetX QYOcTu8YtuqoF/GaBWM1JfAbXZLtWCLGimCmppvKdxGxncNS0vHntiV/waVI/j7A7HxU/5HzWhUz1 lPxkULin9nY0VxMXgR+j9Wi7Xr5INgdsEyO1icMmA7qwelKBxsMtH51i3rK/2VHFQ77h+Rj601Id6 F6TuVmpg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qMDz3-006S74-16; Wed, 19 Jul 2023 20:41:17 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 8F02530036B; Wed, 19 Jul 2023 22:41:16 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7947926AA535D; Wed, 19 Jul 2023 22:41:16 +0200 (CEST) Date: Wed, 19 Jul 2023 22:41:16 +0200 From: Peter Zijlstra To: Joe Lawrence Cc: Petr Mladek , Brian Gerst , jpoimboe@kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, Thomas Gleixner , Borislav Petkov , "H . Peter Anvin" , Sami Tolvanen , alyssa.milburn@linux.intel.com, keescook@chromium.org, joao@overdrivepizza.com, tim.c.chen@linux.intel.com, live-patching@vger.kernel.org Subject: Re: [PATCH v2 2/2] x86: Rewrite ret_from_fork() in C Message-ID: <20230719204116.GF3529734@hirez.programming.kicks-ass.net> References: <20230623225529.34590-1-brgerst@gmail.com> <20230623225529.34590-3-brgerst@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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, Jul 19, 2023 at 04:33:26PM -0400, Joe Lawrence wrote: > On 7/19/23 11:21, Petr Mladek wrote: > > On Fri 2023-06-23 18:55:29, Brian Gerst wrote: > >> When kCFI is enabled, special handling is needed for the indirect call > >> to the kernel thread function. Rewrite the ret_from_fork() function in > >> C so that the compiler can properly handle the indirect call. > > > > This patch broke livepatching. Kthreads never have a reliable stack. > > It works when I revert it. > > > > Just curious -- did the selftests catch this anywhere? I'm not 100% > clear on what trees / frequency they all run, so maybe Petr you found > this by code inspection or other means? I suspect Petr ran the selftests himself, they're fairly easy to run (once you figure out the magic incantation) and insta fail. I'm not sure the robots consistently run this stuff -- I've had these patches exposed to 0day for weeks...