mbox series

[v3,0/4] Enforce checking on flag values in API's

Message ID 20200427231625.10135-1-stephen@networkplumber.org (mailing list archive)
Headers
Series Enforce checking on flag values in API's |

Message

Stephen Hemminger April 27, 2020, 11:16 p.m. UTC
  The DPDK API's are lax about checking for undefined flag values.
This makes it impossible to add new bits to existing API's
without causing ABI breakage. This means we end up doing unnecessary
symbol versioning just to work around applications that might
pass in naughty bits.

This is the DPDK analog of the Linux kernel openat() problem.
Openat api was added but since kernel did not check flags it
ended up that another syscall openat2() was necessary before
the flags could be used.

v3 - define mask based on existing defines for ring and hash

Stephen Hemminger (4):
  ring: future proof flag settings
  hash: check flags on creation
  stack: check flags on creation
  cfgfile: check flags value

 lib/librte_cfgfile/rte_cfgfile.c  |  4 ++++
 lib/librte_hash/rte_cuckoo_hash.c | 14 ++++++++++++++
 lib/librte_ring/rte_ring.c        | 12 ++++++++++++
 lib/librte_stack/rte_stack.c      |  5 +++++
 4 files changed, 35 insertions(+)
  

Comments

Bruce Richardson April 28, 2020, 10:28 a.m. UTC | #1
On Mon, Apr 27, 2020 at 04:16:21PM -0700, Stephen Hemminger wrote:
> The DPDK API's are lax about checking for undefined flag values.
> This makes it impossible to add new bits to existing API's
> without causing ABI breakage. This means we end up doing unnecessary
> symbol versioning just to work around applications that might
> pass in naughty bits.
> 
> This is the DPDK analog of the Linux kernel openat() problem.
> Openat api was added but since kernel did not check flags it
> ended up that another syscall openat2() was necessary before
> the flags could be used.
> 
> v3 - define mask based on existing defines for ring and hash
> 
> Stephen Hemminger (4):
>   ring: future proof flag settings
>   hash: check flags on creation
>   stack: check flags on creation
>   cfgfile: check flags value
> 
>  lib/librte_cfgfile/rte_cfgfile.c  |  4 ++++
>  lib/librte_hash/rte_cuckoo_hash.c | 14 ++++++++++++++
>  lib/librte_ring/rte_ring.c        | 12 ++++++++++++
>  lib/librte_stack/rte_stack.c      |  5 +++++
>  4 files changed, 35 insertions(+)
> 
I think this is a good idea to do in DPDK

Series-acked-by: Bruce Richardson <bruce.richardson@intel.com>
  
Ananyev, Konstantin April 28, 2020, 11:04 a.m. UTC | #2
> The DPDK API's are lax about checking for undefined flag values.
> This makes it impossible to add new bits to existing API's
> without causing ABI breakage. This means we end up doing unnecessary
> symbol versioning just to work around applications that might
> pass in naughty bits.
> 
> This is the DPDK analog of the Linux kernel openat() problem.
> Openat api was added but since kernel did not check flags it
> ended up that another syscall openat2() was necessary before
> the flags could be used.
> 
> v3 - define mask based on existing defines for ring and hash
> 
> Stephen Hemminger (4):
>   ring: future proof flag settings
>   hash: check flags on creation
>   stack: check flags on creation
>   cfgfile: check flags value
> 
>  lib/librte_cfgfile/rte_cfgfile.c  |  4 ++++
>  lib/librte_hash/rte_cuckoo_hash.c | 14 ++++++++++++++
>  lib/librte_ring/rte_ring.c        | 12 ++++++++++++
>  lib/librte_stack/rte_stack.c      |  5 +++++
>  4 files changed, 35 insertions(+)
> 
> --

Series Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.20.1
  
Thomas Monjalon June 16, 2020, 3:47 p.m. UTC | #3
28/04/2020 12:28, Bruce Richardson:
> On Mon, Apr 27, 2020 at 04:16:21PM -0700, Stephen Hemminger wrote:
> > The DPDK API's are lax about checking for undefined flag values.
> > This makes it impossible to add new bits to existing API's
> > without causing ABI breakage. This means we end up doing unnecessary
> > symbol versioning just to work around applications that might
> > pass in naughty bits.
> > 
> > This is the DPDK analog of the Linux kernel openat() problem.
> > Openat api was added but since kernel did not check flags it
> > ended up that another syscall openat2() was necessary before
> > the flags could be used.
> > 
> > v3 - define mask based on existing defines for ring and hash
> > 
> > Stephen Hemminger (4):
> >   ring: future proof flag settings
> >   hash: check flags on creation
> >   stack: check flags on creation
> >   cfgfile: check flags value
> > 
> I think this is a good idea to do in DPDK
> 
> Series-acked-by: Bruce Richardson <bruce.richardson@intel.com>

Applied, thanks