Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp377599rwi; Wed, 2 Nov 2022 13:03:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Sa+hstjQm5UTMmvMCiyGTl5Xqe98zjUwG8ZuHFbQ+ij/i+eTutxC5Oe7SREUV+MoGA3/7 X-Received: by 2002:a17:902:aa0b:b0:187:34e8:7285 with SMTP id be11-20020a170902aa0b00b0018734e87285mr11408183plb.156.1667419394871; Wed, 02 Nov 2022 13:03:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667419394; cv=none; d=google.com; s=arc-20160816; b=WmGmJKqDeuXD3p7503kxEbhnFcIf1yWRDVWxbpJR9pp3Rxxn4gZvUf0tMKpKxDtLmP AmeIdvvHxszLgFkisPkbNh41vw823SPzKQ2SDoT+brvNXx/HFfQjQ25U41XpAs/Vv0bG YGJWM2VDkNiNEjuUzKKOJQ/t9jOuq0bMi9WqC3ctl1ymywdm+yDpvfd77FydU+43Ce9N IWhXsBv92CSQpLgWyHmtw+QrlbOp04hxjvTX2bC8HGmdk3wjwmM8UrnAMbJn71k9/79E smnzZEcoNr4uD9cI44cHpbWyPMN2RQVKo4lCiXU6KpwKcJzPt0dIruS95Wk1lHodcu7C tRTg== 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=qNhnJbXAJF4UzyH8g8T6ZxMpszM79ChXkqdNt8W8NYI=; b=TiMboIqQPx4GWgK4B3YaFDlarC9HdW0OYoqQu3c7XupDFl3Om64yaX3mcmiTlR5DfH vYS1IgsOe4QIL/XKUA1NdeNee9sQC2KKn7NrjZnGIZTQ2Ta9SdhCNsZBPOxRdY5Wx29C iDnEIKBWGs81iCMS3DrVdIL7xNe3cThS0DGuftdi+renchR8L3cE7d/fO1gcR9J7uAAA xbddDOKkjs++pnnlm2wnizAJSBg98wmGOiqvERYp9h2wxbroi4f0YX4ZjnTeFkmsE4Yi +syfqGqlLHUlHmNbjhNvtcjrNi/IjS4yIQ5K09NJeBgWve4MnwZqNqjyONuLkBGKvZph 813A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VwmffTXN; 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 u9-20020a17090282c900b0016f9420a15asi15942337plz.168.2022.11.02.13.03.01; Wed, 02 Nov 2022 13:03:14 -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=VwmffTXN; 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 S231367AbiKBTKa (ORCPT + 98 others); Wed, 2 Nov 2022 15:10:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231847AbiKBTJ7 (ORCPT ); Wed, 2 Nov 2022 15:09:59 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 517541093 for ; Wed, 2 Nov 2022 12:09:56 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id r61-20020a17090a43c300b00212f4e9cccdso2994506pjg.5 for ; Wed, 02 Nov 2022 12:09:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; 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=qNhnJbXAJF4UzyH8g8T6ZxMpszM79ChXkqdNt8W8NYI=; b=VwmffTXNNVk9OBe+Hnb1vM8Qkem8njG1t/7NVdWtvzLrL7Silwy1LUoeD738n3tOxs iK3jGMKaUFT7YdCmh+Gc9iJ/YxnaQ2rljYHzLP0L65O3V7/zav62TcWDBN+p4X1FC2G3 eyyWgcMxBcpZxnBLphn5OoB8FI5JAsGow22/M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=qNhnJbXAJF4UzyH8g8T6ZxMpszM79ChXkqdNt8W8NYI=; b=DjMJeoQFjfhXbk9/b81qpo2tp7DeWhvCxv8j4fGLPF19iEk7Xb7sVNhycURwTrOVJI 5hT9pjsp/K6bdEmTtHHdWJsL/YnY89I4pW4vPI7pFAvqc6MCMSJg/poj+ApHfqBVc7Xa Zg7IYXvdyDIxznllFGFca0MByHSBh4SpPy+D6nMEs6GKmYEvEd0a84P3QIH5CAM/54lB CmtpBu9yoqMyqK0XYEV8clC5dFFe7ElJBQj3f1vdz0wmMlYQwOUL56HOtbYNmKr1IgeA 55HhSjJNomcgXl3PKa/6By4Jbcv349gOaPaxJY3HUsQ/f/Q8cOfAX0I4CzlEJXsRNwd7 tNxg== X-Gm-Message-State: ACrzQf34s8/HJFMbumzEyQhhfR4Cx9GL8t8LqaDAT9GGR0UgfU+LjTpR +WkfGCcZ6eqYciEkpNS5iK521w== X-Received: by 2002:a17:902:e883:b0:187:27a7:c8a3 with SMTP id w3-20020a170902e88300b0018727a7c8a3mr14846919plg.32.1667416195682; Wed, 02 Nov 2022 12:09:55 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id a16-20020aa794b0000000b005627d995a36sm8805579pfl.44.2022.11.02.12.09.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 12:09:55 -0700 (PDT) Date: Wed, 2 Nov 2022 12:09:54 -0700 From: Kees Cook To: Nathan Chancellor Cc: Alexandra Winter , Wenjia Zhang , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , linux-s390@vger.kernel.org, netdev@vger.kernel.org, Nick Desaulniers , Tom Rix , Sami Tolvanen , llvm@lists.linux.dev, linux-kernel@vger.kernel.org, patches@lists.linux.dev Subject: Re: [PATCH 2/3] s390/netiucv: Fix return type of netiucv_tx() Message-ID: <202211021209.8BAB0ABFCE@keescook> References: <20221102163252.49175-1-nathan@kernel.org> <20221102163252.49175-2-nathan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221102163252.49175-2-nathan@kernel.org> X-Spam-Status: No, score=-3.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 autolearn=unavailable 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, Nov 02, 2022 at 09:32:51AM -0700, Nathan Chancellor wrote: > With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), > indirect call targets are validated against the expected function > pointer prototype to make sure the call target is valid to help mitigate > ROP attacks. If they are not identical, there is a failure at run time, > which manifests as either a kernel panic or thread getting killed. A > proposed warning in clang aims to catch these at compile time, which > reveals: > > drivers/s390/net/netiucv.c:1854:21: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict] > .ndo_start_xmit = netiucv_tx, > ^~~~~~~~~~ > > ->ndo_start_xmit() in 'struct net_device_ops' expects a return type of > 'netdev_tx_t', not 'int'. Adjust the return type of netiucv_tx() to > match the prototype's to resolve the warning and potential CFI failure, > should s390 select ARCH_SUPPORTS_CFI_CLANG in the future. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1750 > Signed-off-by: Nathan Chancellor Reviewed-by: Kees Cook -- Kees Cook