Re: [PATCH nft 2/2] json: drop handling missing json() hook for "struct expr_ops"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 02, 2023 at 03:09:42PM +0100, Thomas Haller wrote:
> On Thu, 2023-11-02 at 12:27 +0100, Pablo Neira Ayuso wrote:
> > On Thu, Nov 02, 2023 at 12:20:29PM +0100, Thomas Haller wrote:
> > > By now, all "struct expr_ops" have a json() hook set. Thus, drop
> > > handling the possibility that they might not. From now on, it's a
> > > bug
> > > to create a ops without the hook.
> > > 
> > > It's not clear what the code tried to do. It bothered to implement
> > > a
> > > fallback via fmemopen(), but apparently that fallback is no
> > > considered a
> > > good solution as it also printed a "warning". Either the fallback
> > > is
> > > good and does not warrant a warning. Or the condition is to be
> > > avoided
> > > to begin with, which we should do by testing the expr_ops
> > > structures.
> > > 
> > > As the fallback path has an overhead to create the memory stream,
> > > the
> > > fallback path is indeed not great. That is the reason to outlaw a
> > > missing json() hook, to require that all hooks are present, and to
> > > drop
> > > the fallback path.
> > > 
> > > A missing hook is very easy to cover with unit tests. Such a test
> > > shall
> > > be added soon.
> > 
> > That's fine to simplify code.
> > 
> > But then, in 1/2 you better set some STUB that hits BUG() because we
> > should not ever see variable and symbol expression from json listing
> > path ever.
> > 
> 
> I think BUG() would not work. This does happen, as the tests in patches
> 
> Subject:	[PATCH nft 0/7] add and check dump files for JSON in tests/shell
> Date:	Tue, 31 Oct 2023 19:53:26 +0100
> 
> expose.

No listing from the kernel would use the variable expression.

What example would be triggering bug?



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux