Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp377108rwi; Mon, 10 Oct 2022 01:26:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45d6z+xPG+uIBTlidd7GVWQbjRweQvIaBrjnzzm+WJQ8jUAqmBFEyYtV1K5S0qYBNFK7MW X-Received: by 2002:a17:907:97d2:b0:787:a9ee:8ced with SMTP id js18-20020a17090797d200b00787a9ee8cedmr13746734ejc.335.1665390375502; Mon, 10 Oct 2022 01:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665390375; cv=none; d=google.com; s=arc-20160816; b=ZjwnJBE7sXoVUVEJG0Xz1oXZuzsBtR2gS9P3mvFrM3VsvP1xCMpWKGFIWPXwghsJyw 6+8WrqNY1/4cr+soQjegYHwXTFwJ9/6bPIcfofPpdJwjoCCp/8brwYjVld0BzwdmCjV8 pyqZpg1jSdQsJgEGQlzvqccwXM/o6CLBe2gb49I3QLzjasqF7W0cTdPYsF+j8kGEoxbS aSSjT004sbnoDBXrhcJjWc02tByQC4AYIzXI5yzhpUGANRD6zefIYCgm14GD8o+Iw66W HQfjWyrrwP+/IvPNozBAuQNDWYFWeLxy7UmS1VVUttkTEB2F9XtfgcwsQyZNoRd5wyLD wCBA== 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=1eRxM63YBnLGny/uQKmG8pvw2aWvkBhE+yRLA3VSCIo=; b=T7TSKS+rPtSzLasbZyVSTB2d98SKja85QihrYHhgkn5fHYSmsi0vNiW0CgU07ui5FI 8ncTxPwX3yZS6XqupiAr3pqKj9imaUA6ts+ZUZ9GDbAmtr5Kf7zUwxoTDigU/HM2ii19 7ww5XCsA0KjKhwhciOE2wbyqbOj0+p55r4J/wNCC1oKYgBejUKtF2XDRHQGyrvfFaEZa pnPITkb4oDd+gg+tyVRnoEoUP8BzxENbLLJ3vkHEehYSwLxhaud4NrxuTJTFCch0uUP0 Yw7iwxWXyHtBBhNZFBfCWkiqtpYQO4MQFnChFy+iynJwhiA93o9168kdUBQ1WElwPu7k fLCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=alpCk4Y7; 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 qk20-20020a1709077f9400b00783de095de7si12199223ejc.847.2022.10.10.01.25.47; Mon, 10 Oct 2022 01:26:15 -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=alpCk4Y7; 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 S232546AbiJJHn0 (ORCPT + 99 others); Mon, 10 Oct 2022 03:43:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232511AbiJJHmh (ORCPT ); Mon, 10 Oct 2022 03:42:37 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F3AB1A3AB; Mon, 10 Oct 2022 00:38:29 -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=1eRxM63YBnLGny/uQKmG8pvw2aWvkBhE+yRLA3VSCIo=; b=alpCk4Y7XDeobV7r9Ze3bANnuZ YsatUfSY7waSevjuZjzkz3TguPyg0CPr0q7Sdh1FM3A9UKmyKoGsbt2tHp1xhwhKzwvX6+rdEEKnz 1QJO/1bqiFsf7Gl0cTI1GlzTcsU7DHlfUXMtDcrUR5CSy7N4AgeEigb6wtZUmfKNI3DpobUKdy3Vs UlpYBoonNFHS1b0622NexQMFh9oRy0sCvMKQac3Lv+IXtzScVawVEtrv24Qu1su8zPcgq3VCoMwWM DWfBdcmm3xTOnPYu2XEz4HSORmDKdRBDNzkaoqAMvOLRAi982hFCPcrI9LRDtGlQgEXGtiI1dJ7XS k7yzt+NQ==; 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 1ohnMe-0042uk-GF; Mon, 10 Oct 2022 07:38:16 +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 8F0183001CB; Mon, 10 Oct 2022 09:38:11 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7BFC12BF1DAC2; Mon, 10 Oct 2022 09:38:11 +0200 (CEST) Date: Mon, 10 Oct 2022 09:38:11 +0200 From: Peter Zijlstra To: Kees Cook Cc: Ingo Molnar , Sami Tolvanen , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , "Gustavo A . R . Silva" , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: Re: [PATCH] sched: Introduce struct balance_callback to avoid CFI mismatches Message-ID: References: <20221008000758.2957718-1-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221008000758.2957718-1-keescook@chromium.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 Fri, Oct 07, 2022 at 05:07:58PM -0700, Kees Cook wrote: > Introduce distinct struct balance_callback instead of performing function > pointer casting which will trip CFI. Avoids warnings as found by Clang's > future -Wcast-function-type-strict option: > > In file included from kernel/sched/core.c:84: > kernel/sched/sched.h:1755:15: warning: cast from 'void (*)(struct rq *)' to 'void (*)(struct callback_head *)' converts to incompatible function type [-Wcast-function-type-strict] > head->func = (void (*)(struct callback_head *))func; > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > No binary differences result from this change. > > This patch is a cleanup based on Brad Spengler/PaX Team's modifications > to sched code in their last public patch of grsecurity/PaX based on my > understanding of the code. Changes or omissions from the original code > are mine and don't reflect the original grsecurity/PaX code. > > Reported-by: Sami Tolvanen > Link: https://github.com/ClangBuiltLinux/linux/issues/1724 > Cc: Ingo Molnar > Cc: Peter Zijlstra > Cc: Juri Lelli > Cc: Vincent Guittot > Cc: Dietmar Eggemann > Cc: Steven Rostedt > Cc: Ben Segall > Cc: Mel Gorman > Cc: Daniel Bristot de Oliveira > Cc: Valentin Schneider > Cc: Gustavo A. R. Silva > Signed-off-by: Kees Cook > --- > kernel/sched/core.c | 24 ++++++++++++------------ > kernel/sched/deadline.c | 4 ++-- > kernel/sched/rt.c | 4 ++-- > kernel/sched/sched.h | 14 ++++++++++---- > 4 files changed, 26 insertions(+), 20 deletions(-) Thanks!