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: <3be004fb-5e00-2275-6f63-87c4605b8b0c@linux.vnet.ibm.com>
Date:   Thu, 14 Nov 2019 12:03:52 -0600
From:   Cristobal Forno <cforno12@...ux.vnet.ibm.com>
To:     netdev@...r.kernel.org
Cc:     tlfalcon@...ux.ibm.com, davem@...emloft.net, f.fainelli@...il.com
Subject: Re: [PATCH net-net v2] ibmveth: Detect unsupported packets before
 sending to the hypervisor

CC'd Florian and David. Please review changes as suggested.

On 13/11/2019 15:06, Cris Forno wrote:
> Currently, when ibmveth receive a loopback packet, it reports an
> ambiguous error message "tx: h_send_logical_lan failed with rc=-4"
> because the hypervisor rejects those types of packets. This fix
> detects loopback packet and assures the source packet's MAC address
> matches the driver's MAC address before transmitting to the
> hypervisor.
>
> Signed-off-by: Cris Forno <cforno12@...ux.vnet.ibm.com>
> ---
> changes in v2
> -demoted messages to netdev_dbg
> -reversed christmas tree ordering for local variables
> ---
>   drivers/net/ethernet/ibm/ibmveth.c | 26 ++++++++++++++++++++++++++
>   1 file changed, 26 insertions(+)
>
> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
> index d654c23..1e0208f 100644
> --- a/drivers/net/ethernet/ibm/ibmveth.c
> +++ b/drivers/net/ethernet/ibm/ibmveth.c
> @@ -1011,6 +1011,29 @@ static int ibmveth_send(struct ibmveth_adapter *adapter,
>   	return 0;
>   }
>
> +static int ibmveth_is_packet_unsupported(struct sk_buff *skb,
> +					 struct net_device *netdev)
> +{
> +	struct ethhdr *ether_header;
> +	int ret = 0;
> +
> +	ether_header = eth_hdr(skb);
> +
> +	if (ether_addr_equal(ether_header->h_dest, netdev->dev_addr)) {
> +		netdev_dbg(netdev, "veth doesn't support loopback packets, dropping packet.\n");
> +		netdev->stats.tx_dropped++;
> +		ret = -EOPNOTSUPP;
> +	}
> +
> +	if (!ether_addr_equal(ether_header->h_source, netdev->dev_addr)) {
> +		netdev_dbg(netdev, "source packet MAC address does not match veth device's, dropping packet.\n");
> +		netdev->stats.tx_dropped++;
> +		ret = -EOPNOTSUPP;
> +	}
> +
> +	return ret;
> +}
> +
>   static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,
>   				      struct net_device *netdev)
>   {
> @@ -1022,6 +1045,9 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,
>   	dma_addr_t dma_addr;
>   	unsigned long mss = 0;
>
> +	if (ibmveth_is_packet_unsupported(skb, netdev))
> +		goto out;
> +
>   	/* veth doesn't handle frag_list, so linearize the skb.
>   	 * When GRO is enabled SKB's can have frag_list.
>   	 */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ