Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp8467035rwd; Tue, 20 Jun 2023 15:55:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7PpK8PIKYNeejJMyIes8QoQ6LB1j1CHNKzP0ufBqREo/t/2jfCqPCtLMoxsIVNCzTidcy3 X-Received: by 2002:a17:90a:db49:b0:25e:a1c0:af23 with SMTP id u9-20020a17090adb4900b0025ea1c0af23mr10421637pjx.38.1687301703745; Tue, 20 Jun 2023 15:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687301703; cv=none; d=google.com; s=arc-20160816; b=eYp5bC9lMBmZtmTBkJOx8YGgyDPMUq2jES+4BJAM1ukI1jnlUrhxJJmExRJ2tFOuph bJLolFgx0u4JdUTaPgbXyZ4jJicm3co4dLtIqX0Mx+W167+PBsqKUcdpvUCYDpPZ+GDf qJCvo4acmmoDRPiqtqrljU8/50tHsCemcrRyKc0/er9SeLRGjEd0gWL3o9w8ByWfD2Hv BF+d5nvgw/UbDBIP++nHf8jI8dTE5qNm3ZdH5rdWgQtKuAFSm1A3r0lYWNgyzHXTBqEA y53xCvnyJTVjHw5Q7F+bKKiK2I+0N83dhym35xPd+f7p1D23njuGvMnuZYBjaGcr74Oy RDAA== 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=mfPFecbkGQnl+lZbzEtCF3B0GD8CMvopuSef+xtXtws=; b=ksWbDp65PtvGX1mC1qzli085kplmBu0uOXLwYv+kKVu2Pjv2kTdSJ7t6i+AiSmWrWb 4DcgldI3IxZlVtZMaeqOfzoy8S1ifsbNHynttTeHrQ/YX6hT2SiXBS3oVVkwQPlncaMR zSbQpjTZbL8pPBC2hSZcO5lDgkKV+2/oe+yqe5v+SoRi5A3LoJkFHsRB03tjloQtqd47 scRHfyM0VbXwFWv2cdNEo4m/BfZxIJrk8onzAx/eN7U/HpuchTcVUCFMzVLfTtDEU7xI x6zQGjq25l+wKEftz71RB5O/hIJDB07R3CXKLmY68TVk5YdknB84XCRXDL5ymZFjMQvW J6nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=d+TmiCDl; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l70-20020a639149000000b0053f265b0ef2si2619226pge.471.2023.06.20.15.54.50; Tue, 20 Jun 2023 15:55:03 -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=@chromium.org header.s=google header.b=d+TmiCDl; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230183AbjFTV40 (ORCPT + 99 others); Tue, 20 Jun 2023 17:56:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230080AbjFTV4Z (ORCPT ); Tue, 20 Jun 2023 17:56:25 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DA751730 for ; Tue, 20 Jun 2023 14:56:24 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-543c6a2aa07so2889525a12.0 for ; Tue, 20 Jun 2023 14:56:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1687298184; x=1689890184; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=mfPFecbkGQnl+lZbzEtCF3B0GD8CMvopuSef+xtXtws=; b=d+TmiCDlK3YlhE+l/jzqzrm6zC6N3UVVNGZR8/F4fQXBAID/AztjzN5u/hUbU8iMMf N97vnxsp3pdQaj3LYlzKDgSin95e59++FaJED2+f1TC8BFwBGXZyW4FcL+gTny82sgCn MUlhpMYlYscmhSnNtbGmxbbCguk7AV15asK24= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687298184; x=1689890184; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mfPFecbkGQnl+lZbzEtCF3B0GD8CMvopuSef+xtXtws=; b=CgJmeXsSX3V5PxB9+US1c177HkyJTRaLFU+AdNSkIODFo2sTw7f674RFhspznjNKZH 7+3REJ8NYKPRswK+Se9lG/GPTif42L6xEZoWQrJJPiGNau2GwELZawequOu6XoHbl1Pg BKcLjbjMNNKeN+kZtU1ceZBrqor1V07QEkDo9LxY+aKI8rBZaxoNeEmVOsvFDrlB2I86 mSYNBEsoLnZPJb3HZflZ/iPZ8T2PaoLT3XRj7IBG9JgFQCYZsdnl3qUUM6gVEbEP38Kz P51aobdK4I946nK/rZZ21w8UrvNy3IcTEa3N0jWpk3L8EJ34UoHMtcEtg/GcRFVUFgUW j/5w== X-Gm-Message-State: AC+VfDwtEj9cmEcV/5nbtfgGORkIngTk3bS9uB2UBt6jLNp+b6X/CxFf zAKNuffat+eJdaTcnmnbTdusuQ== X-Received: by 2002:a05:6a20:9143:b0:122:6fd2:7a2a with SMTP id x3-20020a056a20914300b001226fd27a2amr3793205pzc.55.1687298183768; Tue, 20 Jun 2023 14:56:23 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id u21-20020a62ed15000000b00660d80087a0sm1708300pfh.199.2023.06.20.14.56.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 14:56:23 -0700 (PDT) Date: Tue, 20 Jun 2023 14:56:22 -0700 From: Kees Cook To: Peter Zijlstra Cc: x86@kernel.org, alyssa.milburn@linux.intel.com, linux-kernel@vger.kernel.org, samitolvanen@google.com, jpoimboe@kernel.org, joao@overdrivepizza.com, tim.c.chen@linux.intel.com Subject: Re: [PATCH 1/2] x86/cfi: Fix ret_from_fork indirect calls Message-ID: <202306201455.AF16F617A@keescook> References: <20230615193546.949657149@infradead.org> <20230615193722.127844423@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230615193722.127844423@infradead.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,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 Thu, Jun 15, 2023 at 09:35:47PM +0200, Peter Zijlstra wrote: > The ret_from_fork stub does an indirect call to the kthread function, > but only knows about Retpolines. Instead of making the asm more > complicated, punt to C and let the compiler figure it out. > > Specifically, this makes it a proper kCFI indirect call when needed (in > fact, it is nearly impossible to code a kCFI indirect call in asm). > > This was the only callsite that was still calling func()+0 on regular > indirect functions. > > Signed-off-by: Peter Zijlstra (Intel) I worry this creates a calling gadget, but I don't think it really counts since it's just converting between two prototypes. Regardless: Acked-by: Kees Cook -- Kees Cook