DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Christensen <drc@linux.vnet.ibm.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, stable@dpdk.org
Subject: Re: [PATCH] net/tap: resolve stringop-overflow with gcc 12 on ppc64le
Date: Thu, 23 Mar 2023 09:45:54 -0700	[thread overview]
Message-ID: <b849eced-4e9c-505c-fe9d-52eec885d705@linux.vnet.ibm.com> (raw)
In-Reply-To: <20230322164300.2402d9f1@hermes.local>

On 3/22/23 4:43 PM, Stephen Hemminger wrote:
>>   static int
>>   set_mac_type(const char *key __rte_unused,
>>   	     const char *value,
>> @@ -2311,7 +2288,7 @@ set_mac_type(const char *key __rte_unused,
>>   		goto success;
>>   	}
>>   
>> -	if (parse_user_mac(user_mac, value) != 6)
>> +	if (rte_ether_unformat_addr(value, user_mac) < 0)
>>   		goto error;
>>   success:
>>   	TAP_LOG(DEBUG, "TAP user MAC param (%s)", value);
> 
> There might still be case where user_mac == NULL since it comes
> from extra_args.

Ok, I'll fix in v2.

> Also, this code has this suspicious code:
> 
> 	if (!strncasecmp(ETH_TAP_MAC_FIXED, value, strlen(ETH_TAP_MAC_FIXED))) {
> 		static int iface_idx;
> 
> 		/* fixed mac = 00:64:74:61:70:<iface_idx> */
> 		memcpy((char *)user_mac->addr_bytes, "\0dtap",
> 			RTE_ETHER_ADDR_LEN);
> 		user_mac->addr_bytes[RTE_ETHER_ADDR_LEN - 1] =
> 			iface_idx++ + '0';
> 		goto success;
> 	}
> 
> The OUI for that MAC address is not registered but it might be someday.
> Choosing magic constants in IANA assigned space is not best practice.
> Unless some vendor wants to spend lots of time registering these.
> 
> Better to use locally assigned value.  See RFC7042 for more details.

I think that's out of scope for this issue.  Opened a DPDK Bugzilla to 
document the concern which changes "\0dtap" to "\002dtap" to set the 
local bit as required by the RFC.  I'll send out the patch for code and 
documentation after 23.03 is released.

Dave

  reply	other threads:[~2023-03-23 16:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 21:24 David Christensen
2023-03-22 23:43 ` Stephen Hemminger
2023-03-23 16:45   ` David Christensen [this message]
2023-03-23 17:01 ` [PATCH v2] " David Christensen
2023-05-15 23:14   ` Ferruh Yigit
2023-05-15 23:20     ` Stephen Hemminger
2023-05-15 23:35       ` Ferruh Yigit
2023-05-16  1:28         ` Stephen Hemminger
2023-05-16  9:55           ` Ferruh Yigit
2023-06-07 18:47             ` Ferruh Yigit
2023-06-08  2:02               ` Stephen Hemminger
2023-09-29 13:48               ` Ferruh Yigit
2023-10-06 18:31                 ` David Christensen
2023-10-09  9:17                   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b849eced-4e9c-505c-fe9d-52eec885d705@linux.vnet.ibm.com \
    --to=drc@linux.vnet.ibm.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).