[ovs-dev] [PATCH] odp-util: Fix abort while formatting nsh actions.

Mark Gray mark.d.gray at redhat.com
Mon Jan 11 18:22:41 UTC 2021


On 18/12/2020 13:34, Ilya Maximets wrote:
> OVS should not exit if it cannot format NSH actions for the user.
> It should just report the error like the other formatting functions do.
> 
> Credit to OSS-Fuzz.
> 
> Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21509
> Fixes: 1fc11c5948cf ("Generic encap and decap support for NSH")
> Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
> ---
>  lib/odp-util.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/odp-util.c b/lib/odp-util.c
> index 879dea97e..bf19fa647 100644
> --- a/lib/odp-util.c
> +++ b/lib/odp-util.c
> @@ -391,7 +391,8 @@ format_odp_push_nsh_action(struct ds *ds,
>          break;
>      }
>      default:
> -        OVS_NOT_REACHED();

As we are not abort()ing, I wonder should we additionally log that this
is unexpected. I am not sure that the problem would be would be entirely
obvious from an output like the following. Also, it should probably be
logged explicitly as an error.

ufid:479d4436-123f-4492-b822-1d84431d5595
recirc_id(0),dp_hash(0/0),skb_priority(0/0),in_port(5),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),eth(src=ea:04:01:22:b2:68/00:00:00:00:00:00,dst=01:02:03:04:05:06/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.1.1.1/0.0.0.0,dst=10.1.1.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0),
actions:push_nsh(flags=0,ttl=63,mdtype=0,np=3,spi=0x0,si=255,<error:
unknown mdtype>),push_eth(src=00:00:00:00:00:00,dst=00:00:00:00:00:00),6


> +        ds_put_cstr(ds, ",<error: unknown mdtype>");
> +        break;
>      }
>      ds_put_format(ds, ")");
>  }
> 

It's a little difficult to test but I hacked the code to test it.



More information about the dev mailing list