From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A08E6A8D6; Wed, 21 Feb 2024 14:23:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708525395; cv=none; b=CktlqkCJBxFgiLZU3pEoxieTV6jI0UAJU5pCyXsWYRU4lB+kzfPLIgAS2uVAbYeNHYvdwQPebxKoHs5SLNtwONioEJ5Dk+aUARmnpQeX4VgaQiBKcgVaVZOVsGlfoLO8xFv7zUtc4pnKqnqvRtn5svOZqAYPBueriZyNBz68fyY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708525395; c=relaxed/simple; bh=sWGr9EviMK9s1aNttGLCDPPNZbP5wFALsA1xZSDi5W8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eLU7CCCViES5VPuvo8VqkBceyQ3kwpiEZ9AKKJLpRa5utrm2X+xRIFFWSCpMxHNvGFXBN9T5LZDINzKNRXxTpUsIih38PhVqSrCHnq8lcgcSkGujTpvnaZfcDh9nzEuA/zQ/7tZ47OjfzzzlN94qwaCC5JwYC/eaTv/L3e9CLJM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TNyjWRdC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="TNyjWRdC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA5A1C433C7; Wed, 21 Feb 2024 14:23:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1708525395; bh=sWGr9EviMK9s1aNttGLCDPPNZbP5wFALsA1xZSDi5W8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TNyjWRdCcG6G6g7jFglg0HcuafwcqDi5gGAaoD/M9QniT35puLVaS59q31uD9xJ+X Sw3lCAuXHEapxzEGCVPozZUT5DeBnDzIrKTd9A6RSCmO19jJNjQbOf5N4Lb3h1ldVa ZSdiR7GqHMoUWLl62p7E8DmIs8BmjOR0trY9sTEw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, kernel test robot , Anton Ivanov , Nathan Chancellor , Richard Weinberger , Sasha Levin Subject: [PATCH 5.4 143/267] um: net: Fix return type of uml_net_start_xmit() Date: Wed, 21 Feb 2024 14:08:04 +0100 Message-ID: <20240221125944.543727873@linuxfoundation.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240221125940.058369148@linuxfoundation.org> References: <20240221125940.058369148@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nathan Chancellor [ Upstream commit 7d748f60a4b82b50bf25fad1bd42d33f049f76aa ] 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 warning in clang aims to catch these at compile time, which reveals: arch/um/drivers/net_kern.c:353:21: warning: 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 *)' [-Wincompatible-function-pointer-types-strict] 353 | .ndo_start_xmit = uml_net_start_xmit, | ^~~~~~~~~~~~~~~~~~ 1 warning generated. ->ndo_start_xmit() in 'struct net_device_ops' expects a return type of 'netdev_tx_t', not 'int'. Adjust the return type of uml_net_start_xmit() to match the prototype's to resolve the warning. While UML does not currently implement support for kCFI, it could in the future, which means this warning becomes a fatal CFI failure at run time. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202310031340.v1vPh207-lkp@intel.com/ Acked-by: Anton Ivanov Signed-off-by: Nathan Chancellor Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- arch/um/drivers/net_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index 327b728f7244..db15a456482f 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c @@ -204,7 +204,7 @@ static int uml_net_close(struct net_device *dev) return 0; } -static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct uml_net_private *lp = netdev_priv(dev); unsigned long flags; -- 2.43.0