Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp381425rwi; Wed, 2 Nov 2022 13:05:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4SaKldDsv+agxA1bLy2Ljd+ECnNcgtGhDexTe9HPepp6sRd3sia+t9o28230NnXXaVd7Wr X-Received: by 2002:a17:903:50e:b0:182:631b:df6f with SMTP id jn14-20020a170903050e00b00182631bdf6fmr26459496plb.66.1667419530922; Wed, 02 Nov 2022 13:05:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667419530; cv=none; d=google.com; s=arc-20160816; b=AzOzB+6vcV/To7nv8E87brfuexC4sYR6FAST7SLTdsTUQHAWJuH6gfizwguQ2x1h8K Fq34DzT6Xhiv8av5KbjYxCu93bfz76L6h7cZiP+5/ZGVt3DnJsWn8nong90H4ZS9SH5i OHamawzE8TcTwKwdxmZFp6zQaCcYVeb3zxD8vS8pj7sjUirwtFIbUMffhY87mnbzW/FP hKS3auJIdIGi5ZywT9iJGwTsPjAVHYsKx2m5tUyIECOVibvUYBnY0ItF3SYbmriUdZdO AmuhRAqeGI2U36z2b/bZz2zgXCXIKsJptYtAg/qliV89yDAncKWY46FLs8C+O7Fxirjw Rzjw== 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=vw1PeYfYrmcqxsdFm8vSKj6yNnyKJrjXBsCDkZ8l7vk=; b=EnTmhfjzj4IrhhBjjz8LNzZJaTkvzePKCzQQzXXniGs+PqyXcotqXnhhVSJyVsLDJD tuYM0zwTnVPXrYiIHRH/kQYXYOaPnCC7yOqJ6KfmzMRx3xHvdZ1MZfOfig3P2wVtlEKD Y3O65EtGVXFzzIRc31ZDVprsZS9qgGEcWFFOqAPYUYH6HonbTINa5/U1Cq6tqgUyf+Z2 aMgjpzHhweHRB7M4JV4ZP2jQ7CG9FSzc/kh8uZFxfr+MPeTES2s7e+5mJNm3b2JqnNHD IZJNgh3T/coWXG9EnAUvDHcrj24orGuofXPjyJb1Uj4TmFfNEqnfHNbAM6SVI/6r71+s SkHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XNJLSicR; 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 29-20020a630a1d000000b0045a048683dcsi16548557pgk.236.2022.11.02.13.04.52; Wed, 02 Nov 2022 13:05:30 -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=XNJLSicR; 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 S230087AbiKBTIF (ORCPT + 98 others); Wed, 2 Nov 2022 15:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230012AbiKBTID (ORCPT ); Wed, 2 Nov 2022 15:08:03 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3ECFC00 for ; Wed, 2 Nov 2022 12:08:01 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id l6so17166816pjj.0 for ; Wed, 02 Nov 2022 12:08:01 -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=vw1PeYfYrmcqxsdFm8vSKj6yNnyKJrjXBsCDkZ8l7vk=; b=XNJLSicRjEN8rmTBOFq4nZjBNIwb3bfbU77PQOf7hvq7/KsYyf4RBy+5zc2UAJlGhc TMgcRxRmNxosn3VWIIRRCpYt9DoDGwFFE5H6e1NdTJGJbA1bAcnhH8n7lpiKmKZMfShp b+fHS0RnxesbdRP/UtHxZ3cWF55CBAMmG0h1c= 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=vw1PeYfYrmcqxsdFm8vSKj6yNnyKJrjXBsCDkZ8l7vk=; b=d6Jww+PiBBU2sKZLDPvBeeVP/u3oCM7iSqpYPjyCSMjdwiMkm5nVUx1qKybfvE0HUN r4eILRArGKYZQTasoqS2p9mSiIRG+w6bZmUANzXmuxcXR/tXrH0jlN15w4eOIB6wKFbk AHBxlaASgU5Esx7ch4ZCC8+FfaVllgGrHUcbNrD5YZP4Hti5/LHuZesfWcuRKvTHj9jp adyDqB63HKr76Z4QIAow6s1os4aXDLUehBYnz6518mvztbrc8J7TJ/kdxGaVMfHvgiI4 6AOh+cCC9miw1uwl4ywdK8WbuaHg80dDLq3RDNj2T+dZrz30Ces3LfCadrSjs6fTLqck tsxQ== X-Gm-Message-State: ACrzQf2tWE90Q9a7LY7/Hs1/ccDDSV6bUjtPU6X7uShR0kT1WNVhNQOg eizsr/T/5F0/bIPXPRmM0KMr+w== X-Received: by 2002:a17:90a:3947:b0:213:ebeb:2cf3 with SMTP id n7-20020a17090a394700b00213ebeb2cf3mr16561908pjf.9.1667416081215; Wed, 02 Nov 2022 12:08:01 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h23-20020aa796d7000000b0056d2e716e01sm8015248pfq.139.2022.11.02.12.08.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 12:08:00 -0700 (PDT) Date: Wed, 2 Nov 2022 12:08:00 -0700 From: Kees Cook To: Nathan Chancellor Cc: Thomas Sailer , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-hams@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] hamradio: baycom_epp: Fix return type of baycom_send_packet() Message-ID: <202211021207.E41AE398@keescook> References: <20221102160610.1186145-1-nathan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221102160610.1186145-1-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=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, Nov 02, 2022 at 09:06:10AM -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/net/hamradio/baycom_epp.c:1119:25: 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 = baycom_send_packet, > ^~~~~~~~~~~~~~~~~~ > 1 error generated. > > ->ndo_start_xmit() in 'struct net_device_ops' expects a return type of > 'netdev_tx_t', not 'int'. Adjust the return type of baycom_send_packet() > to match the prototype's to resolve the warning and CFI failure. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1750 > Signed-off-by: Nathan Chancellor Heh, this one was already using the enum for the argument to "return", too. :) Reviewed-by: Kees Cook -- Kees Cook