lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YyERjpSlz+MVCULd@dev-arch.thelio-3990X>
Date:   Tue, 13 Sep 2022 16:26:06 -0700
From:   Nathan Chancellor <nathan@...nel.org>
To:     Nathan Huckleberry <nhuck@...gle.com>
Cc:     Dan Carpenter <error27@...il.com>, llvm@...ts.linux.dev,
        Pravin B Shelar <pshelar@....org>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Tom Rix <trix@...hat.com>, netdev@...r.kernel.org,
        dev@...nvswitch.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] openvswitch: Change the return type for vport_ops.send
 function hook to int

On Tue, Sep 13, 2022 at 04:07:38PM -0700, Nathan Huckleberry wrote:
> All usages of the vport_ops struct have the .send field set to
> dev_queue_xmit or internal_dev_recv.  Since most usages are set to
> dev_queue_xmit, the function hook should match the signature of
> dev_queue_xmit.
> 
> The only call to vport_ops->send() is in net/openvswitch/vport.c and it
> throws away the return value.
> 
> This mismatched return type breaks forward edge kCFI since the underlying
> function definition does not match the function hook definition.
> 
> Reported-by: Dan Carpenter <error27@...il.com>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1703
> Cc: llvm@...ts.linux.dev
> Signed-off-by: Nathan Huckleberry <nhuck@...gle.com>

Reviewed-by: Nathan Chancellor <nathan@...nel.org>

> ---
>  net/openvswitch/vport-internal_dev.c | 2 +-
>  net/openvswitch/vport.h              | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
> index 35f42c9821c2..74c88a6baa43 100644
> --- a/net/openvswitch/vport-internal_dev.c
> +++ b/net/openvswitch/vport-internal_dev.c
> @@ -190,7 +190,7 @@ static void internal_dev_destroy(struct vport *vport)
>  	rtnl_unlock();
>  }
>  
> -static netdev_tx_t internal_dev_recv(struct sk_buff *skb)
> +static int internal_dev_recv(struct sk_buff *skb)
>  {
>  	struct net_device *netdev = skb->dev;
>  
> diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h
> index 7d276f60c000..6ff45e8a0868 100644
> --- a/net/openvswitch/vport.h
> +++ b/net/openvswitch/vport.h
> @@ -132,7 +132,7 @@ struct vport_ops {
>  	int (*set_options)(struct vport *, struct nlattr *);
>  	int (*get_options)(const struct vport *, struct sk_buff *);
>  
> -	netdev_tx_t (*send) (struct sk_buff *skb);
> +	int (*send)(struct sk_buff *skb);
>  	struct module *owner;
>  	struct list_head list;
>  };
> -- 
> 2.37.2.789.g6183377224-goog
> 

Powered by blists - more mailing lists