patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] net/tap: resolve stringop-overflow with gcc 12 on ppc64le
@ 2023-03-22 21:24 David Christensen
  2023-03-22 23:43 ` Stephen Hemminger
  2023-03-23 17:01 ` [PATCH v2] " David Christensen
  0 siblings, 2 replies; 14+ messages in thread
From: David Christensen @ 2023-03-22 21:24 UTC (permalink / raw)
  To: dev; +Cc: David Christensen, stable

Building DPDK with gcc 12 on a ppc64le system generates a
stringop-overflow warning. Replace the local MAC address
validation function parse_user_mac() with a call to
rte_ether_unformat_addr() instead.

Bugzilla ID: 1197
Cc: stable@dpdk.org

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
---
 drivers/net/tap/rte_eth_tap.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 089ac202fa..1f83f49c0e 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -2267,29 +2267,6 @@ set_remote_iface(const char *key __rte_unused,
 	return 0;
 }
 
-static int parse_user_mac(struct rte_ether_addr *user_mac,
-		const char *value)
-{
-	unsigned int index = 0;
-	char mac_temp[strlen(ETH_TAP_USR_MAC_FMT) + 1], *mac_byte = NULL;
-
-	if (user_mac == NULL || value == NULL)
-		return 0;
-
-	strlcpy(mac_temp, value, sizeof(mac_temp));
-	mac_byte = strtok(mac_temp, ":");
-
-	while ((mac_byte != NULL) &&
-			(strlen(mac_byte) <= 2) &&
-			(strlen(mac_byte) == strspn(mac_byte,
-					ETH_TAP_CMP_MAC_FMT))) {
-		user_mac->addr_bytes[index++] = strtoul(mac_byte, NULL, 16);
-		mac_byte = strtok(NULL, ":");
-	}
-
-	return index;
-}
-
 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);
-- 
2.31.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] net/tap: resolve stringop-overflow with gcc 12 on ppc64le
  2023-03-22 21:24 [PATCH] net/tap: resolve stringop-overflow with gcc 12 on ppc64le David Christensen
@ 2023-03-22 23:43 ` Stephen Hemminger
  2023-03-23 16:45   ` David Christensen
  2023-03-23 17:01 ` [PATCH v2] " David Christensen
  1 sibling, 1 reply; 14+ messages in thread
From: Stephen Hemminger @ 2023-03-22 23:43 UTC (permalink / raw)
  To: David Christensen; +Cc: dev, stable

On Wed, 22 Mar 2023 17:24:39 -0400
David Christensen <drc@linux.vnet.ibm.com> wrote:

> Building DPDK with gcc 12 on a ppc64le system generates a
> stringop-overflow warning. Replace the local MAC address
> validation function parse_user_mac() with a call to
> rte_ether_unformat_addr() instead.
> 
> Bugzilla ID: 1197
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
> ---
>  drivers/net/tap/rte_eth_tap.c | 25 +------------------------
>  1 file changed, 1 insertion(+), 24 deletions(-)
> 
> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
> index 089ac202fa..1f83f49c0e 100644
> --- a/drivers/net/tap/rte_eth_tap.c
> +++ b/drivers/net/tap/rte_eth_tap.c
> @@ -2267,29 +2267,6 @@ set_remote_iface(const char *key __rte_unused,
>  	return 0;
>  }
>  
> -static int parse_user_mac(struct rte_ether_addr *user_mac,
> -		const char *value)
> -{
> -	unsigned int index = 0;
> -	char mac_temp[strlen(ETH_TAP_USR_MAC_FMT) + 1], *mac_byte = NULL;
> -
> -	if (user_mac == NULL || value == NULL)
> -		return 0;
> -
> -	strlcpy(mac_temp, value, sizeof(mac_temp));
> -	mac_byte = strtok(mac_temp, ":");
> -
> -	while ((mac_byte != NULL) &&
> -			(strlen(mac_byte) <= 2) &&
> -			(strlen(mac_byte) == strspn(mac_byte,
> -					ETH_TAP_CMP_MAC_FMT))) {
> -		user_mac->addr_bytes[index++] = strtoul(mac_byte, NULL, 16);
> -		mac_byte = strtok(NULL, ":");
> -	}
> -
> -	return index;
> -}
> -
>  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.

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.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] net/tap: resolve stringop-overflow with gcc 12 on ppc64le
  2023-03-22 23:43 ` Stephen Hemminger
@ 2023-03-23 16:45   ` David Christensen
  0 siblings, 0 replies; 14+ messages in thread
From: David Christensen @ 2023-03-23 16:45 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, stable

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2] net/tap: resolve stringop-overflow with gcc 12 on ppc64le
  2023-03-22 21:24 [PATCH] net/tap: resolve stringop-overflow with gcc 12 on ppc64le David Christensen
  2023-03-22 23:43 ` Stephen Hemminger
@ 2023-03-23 17:01 ` David Christensen
  2023-05-15 23:14   ` Ferruh Yigit
  1 sibling, 1 reply; 14+ messages in thread
From: David Christensen @ 2023-03-23 17:01 UTC (permalink / raw)
  To: dev, stephen; +Cc: David Christensen, stable

Building DPDK with gcc 12 on a ppc64le system generates a
stringop-overflow warning. Replace the local MAC address
validation function parse_user_mac() with a call to
rte_ether_unformat_addr() instead.

Bugzilla ID: 1197
Cc: stable@dpdk.org

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
---
v2:
* Added NULL checks previously performed in parse_user_mac()
---
 drivers/net/tap/rte_eth_tap.c | 26 ++------------------------
 1 file changed, 2 insertions(+), 24 deletions(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 089ac202fa..8c50801fd4 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -2267,29 +2267,6 @@ set_remote_iface(const char *key __rte_unused,
 	return 0;
 }
 
-static int parse_user_mac(struct rte_ether_addr *user_mac,
-		const char *value)
-{
-	unsigned int index = 0;
-	char mac_temp[strlen(ETH_TAP_USR_MAC_FMT) + 1], *mac_byte = NULL;
-
-	if (user_mac == NULL || value == NULL)
-		return 0;
-
-	strlcpy(mac_temp, value, sizeof(mac_temp));
-	mac_byte = strtok(mac_temp, ":");
-
-	while ((mac_byte != NULL) &&
-			(strlen(mac_byte) <= 2) &&
-			(strlen(mac_byte) == strspn(mac_byte,
-					ETH_TAP_CMP_MAC_FMT))) {
-		user_mac->addr_bytes[index++] = strtoul(mac_byte, NULL, 16);
-		mac_byte = strtok(NULL, ":");
-	}
-
-	return index;
-}
-
 static int
 set_mac_type(const char *key __rte_unused,
 	     const char *value,
@@ -2311,7 +2288,8 @@ set_mac_type(const char *key __rte_unused,
 		goto success;
 	}
 
-	if (parse_user_mac(user_mac, value) != 6)
+	if (value == NULL || user_mac == NULL ||
+			rte_ether_unformat_addr(value, user_mac) < 0)
 		goto error;
 success:
 	TAP_LOG(DEBUG, "TAP user MAC param (%s)", value);
-- 
2.31.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] net/tap: resolve stringop-overflow with gcc 12 on ppc64le
  2023-03-23 17:01 ` [PATCH v2] " David Christensen
@ 2023-05-15 23:14   ` Ferruh Yigit
  2023-05-15 23:20     ` Stephen Hemminger
  0 siblings, 1 reply; 14+ messages in thread
From: Ferruh Yigit @ 2023-05-15 23:14 UTC (permalink / raw)
  To: David Christensen, dev, stephen; +Cc: stable, Stephen Hemminger

On 3/23/2023 5:01 PM, David Christensen wrote:
> Building DPDK with gcc 12 on a ppc64le system generates a
> stringop-overflow warning. Replace the local MAC address
> validation function parse_user_mac() with a call to
> rte_ether_unformat_addr() instead.
> 
> Bugzilla ID: 1197
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
> ---
> v2:
> * Added NULL checks previously performed in parse_user_mac()
> ---
>  drivers/net/tap/rte_eth_tap.c | 26 ++------------------------
>  1 file changed, 2 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
> index 089ac202fa..8c50801fd4 100644
> --- a/drivers/net/tap/rte_eth_tap.c
> +++ b/drivers/net/tap/rte_eth_tap.c
> @@ -2267,29 +2267,6 @@ set_remote_iface(const char *key __rte_unused,
>  	return 0;
>  }
>  
> -static int parse_user_mac(struct rte_ether_addr *user_mac,
> -		const char *value)
> -{
> -	unsigned int index = 0;
> -	char mac_temp[strlen(ETH_TAP_USR_MAC_FMT) + 1], *mac_byte = NULL;
> -
> -	if (user_mac == NULL || value == NULL)
> -		return 0;
> -
> -	strlcpy(mac_temp, value, sizeof(mac_temp));
> -	mac_byte = strtok(mac_temp, ":");
> -
> -	while ((mac_byte != NULL) &&
> -			(strlen(mac_byte) <= 2) &&
> -			(strlen(mac_byte) == strspn(mac_byte,
> -					ETH_TAP_CMP_MAC_FMT))) {
> -		user_mac->addr_bytes[index++] = strtoul(mac_byte, NULL, 16);
> -		mac_byte = strtok(NULL, ":");
> -	}
> -
> -	return index;
> -}
> -
>  static int
>  set_mac_type(const char *key __rte_unused,
>  	     const char *value,
> @@ -2311,7 +2288,8 @@ set_mac_type(const char *key __rte_unused,
>  		goto success;
>  	}
>  
> -	if (parse_user_mac(user_mac, value) != 6)
> +	if (value == NULL || user_mac == NULL ||
> +			rte_ether_unformat_addr(value, user_mac) < 0)
>  		goto error;
>  success:
>  	TAP_LOG(DEBUG, "TAP user MAC param (%s)", value);

Hi David,

I confirm the build error, btw it helps to future references to put
build failure to the commit log,

and change is reasonable to convert PMD local parse function to an API,
BUT my concern is they don't behave exactly same, which changes user
interface of the driver.

The 'rte_ether_unformat_addr()' API expects exact "XX:XX:XX:XX:XX:XX or
XXXX:XXXX:XXXX" format.
Like 'parse_user_mac()' accepts 'a:a:a:a:a:a' as input, but API requires
'0A:0A:0A:0A:0A:0A'.

This is a small change but still may create a bad experience if an
existing user/script hit by this, and I believe we don't have a strong
reason to change the interface.


To keep behavior same, we can either update 'rte_ether_unformat_addr()'
to accept singe chars between ':',
or fix the existing 'parse_user_mac()' for compiler warning, what do you
think?



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] net/tap: resolve stringop-overflow with gcc 12 on ppc64le
  2023-05-15 23:14   ` Ferruh Yigit
@ 2023-05-15 23:20     ` Stephen Hemminger
  2023-05-15 23:35       ` Ferruh Yigit
  0 siblings, 1 reply; 14+ messages in thread
From: Stephen Hemminger @ 2023-05-15 23:20 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: David Christensen, dev, stable

On Tue, 16 May 2023 00:14:52 +0100
Ferruh Yigit <ferruh.yigit@amd.com> wrote:

> Hi David,
> 
> I confirm the build error, btw it helps to future references to put
> build failure to the commit log,
> 
> and change is reasonable to convert PMD local parse function to an API,
> BUT my concern is they don't behave exactly same, which changes user
> interface of the driver.
> 
> The 'rte_ether_unformat_addr()' API expects exact "XX:XX:XX:XX:XX:XX or
> XXXX:XXXX:XXXX" format.
> Like 'parse_user_mac()' accepts 'a:a:a:a:a:a' as input, but API requires
> '0A:0A:0A:0A:0A:0A'.
> 
> This is a small change but still may create a bad experience if an
> existing user/script hit by this, and I believe we don't have a strong
> reason to change the interface.
> 
> 
> To keep behavior same, we can either update 'rte_ether_unformat_addr()'
> to accept singe chars between ':',
> or fix the existing 'parse_user_mac()' for compiler warning, what do you
> think?

This is the kind of change where a simple release note will suffice.

Not sure if anyone beyond some test script would ever use this anyway.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] net/tap: resolve stringop-overflow with gcc 12 on ppc64le
  2023-05-15 23:20     ` Stephen Hemminger
@ 2023-05-15 23:35       ` Ferruh Yigit
  2023-05-16  1:28         ` Stephen Hemminger
  0 siblings, 1 reply; 14+ messages in thread
From: Ferruh Yigit @ 2023-05-15 23:35 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Christensen, dev, stable

On 5/16/2023 12:20 AM, Stephen Hemminger wrote:
> On Tue, 16 May 2023 00:14:52 +0100
> Ferruh Yigit <ferruh.yigit@amd.com> wrote:
> 
>> Hi David,
>>
>> I confirm the build error, btw it helps to future references to put
>> build failure to the commit log,
>>
>> and change is reasonable to convert PMD local parse function to an API,
>> BUT my concern is they don't behave exactly same, which changes user
>> interface of the driver.
>>
>> The 'rte_ether_unformat_addr()' API expects exact "XX:XX:XX:XX:XX:XX or
>> XXXX:XXXX:XXXX" format.
>> Like 'parse_user_mac()' accepts 'a:a:a:a:a:a' as input, but API requires
>> '0A:0A:0A:0A:0A:0A'.
>>
>> This is a small change but still may create a bad experience if an
>> existing user/script hit by this, and I believe we don't have a strong
>> reason to change the interface.
>>
>>
>> To keep behavior same, we can either update 'rte_ether_unformat_addr()'
>> to accept singe chars between ':',
>> or fix the existing 'parse_user_mac()' for compiler warning, what do you
>> think?
> 
> This is the kind of change where a simple release note will suffice.
> 
> Not sure if anyone beyond some test script would ever use this anyway.


Yes only some scripts and possible applications that hotplug tap
interface with hardcoded parameters may impacted, don't know how big is
this amount but this ends up breaking something that was working before
upgrading DPDK for them.

And I believe the motivation is weak to break the behavior.

Won't it be better to update 'rte_ether_unformat_addr()' to accept more
flexible syntax, and use it? Is there any disadvantage of this approach?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] net/tap: resolve stringop-overflow with gcc 12 on ppc64le
  2023-05-15 23:35       ` Ferruh Yigit
@ 2023-05-16  1:28         ` Stephen Hemminger
  2023-05-16  9:55           ` Ferruh Yigit
  0 siblings, 1 reply; 14+ messages in thread
From: Stephen Hemminger @ 2023-05-16  1:28 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: David Christensen, dev, stable

On Tue, 16 May 2023 00:35:56 +0100
Ferruh Yigit <ferruh.yigit@amd.com> wrote:

> Yes only some scripts and possible applications that hotplug tap
> interface with hardcoded parameters may impacted, don't know how big is
> this amount but this ends up breaking something that was working before
> upgrading DPDK for them.
> 
> And I believe the motivation is weak to break the behavior.
> 
> Won't it be better to update 'rte_ether_unformat_addr()' to accept more
> flexible syntax, and use it? Is there any disadvantage of this approach?

It is already more flexible than the standard ether_aton().

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] net/tap: resolve stringop-overflow with gcc 12 on ppc64le
  2023-05-16  1:28         ` Stephen Hemminger
@ 2023-05-16  9:55           ` Ferruh Yigit
  2023-06-07 18:47             ` Ferruh Yigit
  0 siblings, 1 reply; 14+ messages in thread
From: Ferruh Yigit @ 2023-05-16  9:55 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Christensen, dev, stable

On 5/16/2023 2:28 AM, Stephen Hemminger wrote:
> On Tue, 16 May 2023 00:35:56 +0100
> Ferruh Yigit <ferruh.yigit@amd.com> wrote:
> 
>> Yes only some scripts and possible applications that hotplug tap
>> interface with hardcoded parameters may impacted, don't know how big is
>> this amount but this ends up breaking something that was working before
>> upgrading DPDK for them.
>>
>> And I believe the motivation is weak to break the behavior.
>>
>> Won't it be better to update 'rte_ether_unformat_addr()' to accept more
>> flexible syntax, and use it? Is there any disadvantage of this approach?
> 
> It is already more flexible than the standard ether_aton().

I mean to accept single chars, as 'tap' currently does, like "a:a:a:a:a:a".

Agree that impact of tap change is small, but if we can eliminate it
completely without any side affect, why not?


As accepting single char will be expanding 'rte_ether_unformat_addr()'
capability, it will be backward compatible, am I missing anything?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] net/tap: resolve stringop-overflow with gcc 12 on ppc64le
  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
  0 siblings, 2 replies; 14+ messages in thread
From: Ferruh Yigit @ 2023-06-07 18:47 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Christensen, dev, stable

On 5/16/2023 10:55 AM, Ferruh Yigit wrote:
> On 5/16/2023 2:28 AM, Stephen Hemminger wrote:
>> On Tue, 16 May 2023 00:35:56 +0100
>> Ferruh Yigit <ferruh.yigit@amd.com> wrote:
>>
>>> Yes only some scripts and possible applications that hotplug tap
>>> interface with hardcoded parameters may impacted, don't know how big is
>>> this amount but this ends up breaking something that was working before
>>> upgrading DPDK for them.
>>>
>>> And I believe the motivation is weak to break the behavior.
>>>
>>> Won't it be better to update 'rte_ether_unformat_addr()' to accept more
>>> flexible syntax, and use it? Is there any disadvantage of this approach?
>>
>> It is already more flexible than the standard ether_aton().
> 
> I mean to accept single chars, as 'tap' currently does, like "a:a:a:a:a:a".
> 
> Agree that impact of tap change is small, but if we can eliminate it
> completely without any side affect, why not?
> 
> 
> As accepting single char will be expanding 'rte_ether_unformat_addr()'
> capability, it will be backward compatible, am I missing anything?
> 

Hi David,

If API update is not planned, what do you think to just solve the build
error without changing functionality with a change something like below:

```
 -       (strlen(mac_byte) == strspn(mac_byte,
 -                       ETH_TAP_CMP_MAC_FMT))) {
 +       (strlen(mac_byte) == strspn(mac_byte, ETH_TAP_CMP_MAC_FMT)) &&
 +                       index < RTE_ETHER_ADDR_LEN) {

```

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] net/tap: resolve stringop-overflow with gcc 12 on ppc64le
  2023-06-07 18:47             ` Ferruh Yigit
@ 2023-06-08  2:02               ` Stephen Hemminger
  2023-09-29 13:48               ` Ferruh Yigit
  1 sibling, 0 replies; 14+ messages in thread
From: Stephen Hemminger @ 2023-06-08  2:02 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: David Christensen, dev, stable

On Wed, 7 Jun 2023 19:47:04 +0100
Ferruh Yigit <ferruh.yigit@amd.com> wrote:

> On 5/16/2023 10:55 AM, Ferruh Yigit wrote:
> > On 5/16/2023 2:28 AM, Stephen Hemminger wrote:  
> >> On Tue, 16 May 2023 00:35:56 +0100
> >> Ferruh Yigit <ferruh.yigit@amd.com> wrote:
> >>  
> >>> Yes only some scripts and possible applications that hotplug tap
> >>> interface with hardcoded parameters may impacted, don't know how big is
> >>> this amount but this ends up breaking something that was working before
> >>> upgrading DPDK for them.
> >>>
> >>> And I believe the motivation is weak to break the behavior.
> >>>
> >>> Won't it be better to update 'rte_ether_unformat_addr()' to accept more
> >>> flexible syntax, and use it? Is there any disadvantage of this approach?  
> >>
> >> It is already more flexible than the standard ether_aton().  
> > 
> > I mean to accept single chars, as 'tap' currently does, like "a:a:a:a:a:a".
> > 
> > Agree that impact of tap change is small, but if we can eliminate it
> > completely without any side affect, why not?
> > 
> > 
> > As accepting single char will be expanding 'rte_ether_unformat_addr()'
> > capability, it will be backward compatible, am I missing anything?

I did a little poking around. The single character format is actually non
standard.  It would be good to extend rte_unformat_ether_addr to allow a wider
range of formats including all those used by Windows, IEEE, and network vendors.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] net/tap: resolve stringop-overflow with gcc 12 on ppc64le
  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
  1 sibling, 1 reply; 14+ messages in thread
From: Ferruh Yigit @ 2023-09-29 13:48 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Christensen, dev, stable

On 6/7/2023 7:47 PM, Ferruh Yigit wrote:
> On 5/16/2023 10:55 AM, Ferruh Yigit wrote:
>> On 5/16/2023 2:28 AM, Stephen Hemminger wrote:
>>> On Tue, 16 May 2023 00:35:56 +0100
>>> Ferruh Yigit <ferruh.yigit@amd.com> wrote:
>>>
>>>> Yes only some scripts and possible applications that hotplug tap
>>>> interface with hardcoded parameters may impacted, don't know how big is
>>>> this amount but this ends up breaking something that was working before
>>>> upgrading DPDK for them.
>>>>
>>>> And I believe the motivation is weak to break the behavior.
>>>>
>>>> Won't it be better to update 'rte_ether_unformat_addr()' to accept more
>>>> flexible syntax, and use it? Is there any disadvantage of this approach?
>>>
>>> It is already more flexible than the standard ether_aton().
>>
>> I mean to accept single chars, as 'tap' currently does, like "a:a:a:a:a:a".
>>
>> Agree that impact of tap change is small, but if we can eliminate it
>> completely without any side affect, why not?
>>
>>
>> As accepting single char will be expanding 'rte_ether_unformat_addr()'
>> capability, it will be backward compatible, am I missing anything?
>>
> 
> Hi David,
> 
> If API update is not planned, what do you think to just solve the build
> error without changing functionality with a change something like below:
> 
> ```
>  -       (strlen(mac_byte) == strspn(mac_byte,
>  -                       ETH_TAP_CMP_MAC_FMT))) {
>  +       (strlen(mac_byte) == strspn(mac_byte, ETH_TAP_CMP_MAC_FMT)) &&
>  +                       index < RTE_ETHER_ADDR_LEN) {
> 
> ```

Hi David,

If you can confirm above fixes the issue, I can send a patch for it.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] net/tap: resolve stringop-overflow with gcc 12 on ppc64le
  2023-09-29 13:48               ` Ferruh Yigit
@ 2023-10-06 18:31                 ` David Christensen
  2023-10-09  9:17                   ` Ferruh Yigit
  0 siblings, 1 reply; 14+ messages in thread
From: David Christensen @ 2023-10-06 18:31 UTC (permalink / raw)
  To: Ferruh Yigit, Stephen Hemminger; +Cc: dev, stable



On 9/29/23 6:48 AM, Ferruh Yigit wrote:
> On 6/7/2023 7:47 PM, Ferruh Yigit wrote:
>> On 5/16/2023 10:55 AM, Ferruh Yigit wrote:
>>> On 5/16/2023 2:28 AM, Stephen Hemminger wrote:
>>>> On Tue, 16 May 2023 00:35:56 +0100
>>>> Ferruh Yigit <ferruh.yigit@amd.com> wrote:
>>>>
>>>>> Yes only some scripts and possible applications that hotplug tap
>>>>> interface with hardcoded parameters may impacted, don't know how big is
>>>>> this amount but this ends up breaking something that was working before
>>>>> upgrading DPDK for them.
>>>>>
>>>>> And I believe the motivation is weak to break the behavior.
>>>>>
>>>>> Won't it be better to update 'rte_ether_unformat_addr()' to accept more
>>>>> flexible syntax, and use it? Is there any disadvantage of this approach?
>>>>
>>>> It is already more flexible than the standard ether_aton().
>>>
>>> I mean to accept single chars, as 'tap' currently does, like "a:a:a:a:a:a".
>>>
>>> Agree that impact of tap change is small, but if we can eliminate it
>>> completely without any side affect, why not?
>>>
>>>
>>> As accepting single char will be expanding 'rte_ether_unformat_addr()'
>>> capability, it will be backward compatible, am I missing anything?
>>>
>>
>> Hi David,
>>
>> If API update is not planned, what do you think to just solve the build
>> error without changing functionality with a change something like below:
>>
>> ```
>>   -       (strlen(mac_byte) == strspn(mac_byte,
>>   -                       ETH_TAP_CMP_MAC_FMT))) {
>>   +       (strlen(mac_byte) == strspn(mac_byte, ETH_TAP_CMP_MAC_FMT)) &&
>>   +                       index < RTE_ETHER_ADDR_LEN) {
>>
>> ```
> 
> Hi David,
> 
> If you can confirm above fixes the issue, I can send a patch for it.

Confirmed that your proposed change resolves the build issue on ppc64le. 
  Appreciate if you can submit the patch.

Dave

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] net/tap: resolve stringop-overflow with gcc 12 on ppc64le
  2023-10-06 18:31                 ` David Christensen
@ 2023-10-09  9:17                   ` Ferruh Yigit
  0 siblings, 0 replies; 14+ messages in thread
From: Ferruh Yigit @ 2023-10-09  9:17 UTC (permalink / raw)
  To: David Christensen, Stephen Hemminger; +Cc: dev, stable

On 10/6/2023 7:31 PM, David Christensen wrote:
> 
> 
> On 9/29/23 6:48 AM, Ferruh Yigit wrote:
>> On 6/7/2023 7:47 PM, Ferruh Yigit wrote:
>>> On 5/16/2023 10:55 AM, Ferruh Yigit wrote:
>>>> On 5/16/2023 2:28 AM, Stephen Hemminger wrote:
>>>>> On Tue, 16 May 2023 00:35:56 +0100
>>>>> Ferruh Yigit <ferruh.yigit@amd.com> wrote:
>>>>>
>>>>>> Yes only some scripts and possible applications that hotplug tap
>>>>>> interface with hardcoded parameters may impacted, don't know how
>>>>>> big is
>>>>>> this amount but this ends up breaking something that was working
>>>>>> before
>>>>>> upgrading DPDK for them.
>>>>>>
>>>>>> And I believe the motivation is weak to break the behavior.
>>>>>>
>>>>>> Won't it be better to update 'rte_ether_unformat_addr()' to accept
>>>>>> more
>>>>>> flexible syntax, and use it? Is there any disadvantage of this
>>>>>> approach?
>>>>>
>>>>> It is already more flexible than the standard ether_aton().
>>>>
>>>> I mean to accept single chars, as 'tap' currently does, like
>>>> "a:a:a:a:a:a".
>>>>
>>>> Agree that impact of tap change is small, but if we can eliminate it
>>>> completely without any side affect, why not?
>>>>
>>>>
>>>> As accepting single char will be expanding 'rte_ether_unformat_addr()'
>>>> capability, it will be backward compatible, am I missing anything?
>>>>
>>>
>>> Hi David,
>>>
>>> If API update is not planned, what do you think to just solve the build
>>> error without changing functionality with a change something like below:
>>>
>>> ```
>>>   -       (strlen(mac_byte) == strspn(mac_byte,
>>>   -                       ETH_TAP_CMP_MAC_FMT))) {
>>>   +       (strlen(mac_byte) == strspn(mac_byte, ETH_TAP_CMP_MAC_FMT)) &&
>>>   +                       index < RTE_ETHER_ADDR_LEN) {
>>>
>>> ```
>>
>> Hi David,
>>
>> If you can confirm above fixes the issue, I can send a patch for it.
> 
> Confirmed that your proposed change resolves the build issue on ppc64le.
>  Appreciate if you can submit the patch.
> 
> 

Thanks for checking, but Stephen updated the 'rte_ether_unformat_addr()'
API [1] and sent a new version of this patch [2], which is merged in
next-net [3] now.
Build error for PPC should be fixed now.


[1]
https://patchwork.dpdk.org/project/dpdk/patch/20231003202909.391330-3-stephen@networkplumber.org/

[2]
https://patchwork.dpdk.org/project/dpdk/patch/20231003202909.391330-5-stephen@networkplumber.org/

[3]
https://git.dpdk.org/next/dpdk-next-net/log/


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-10-09  9:17 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 21:24 [PATCH] net/tap: resolve stringop-overflow with gcc 12 on ppc64le David Christensen
2023-03-22 23:43 ` Stephen Hemminger
2023-03-23 16:45   ` David Christensen
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

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).