Subject: Re: [PATCH ipsec-next v1 8/8] iptfs: impl: add new iptfs xfrm mode impl

From: Simon Horman <[email-masked]>
Date: Mon, 26 Feb 2024 20:57:46 +0000

On Thu, Feb 22, 2024 at 03:23:36PM -0500, Christian Hopps wrote:
> 
> Simon Horman <[email-masked]> writes:
> 
> > On Mon, Feb 19, 2024 at 03:57:35AM -0500, Christian Hopps wrote:
> > > From: Christian Hopps <[email-masked]>
> > > 
> > > Add a new xfrm mode implementing AggFrag/IP-TFS from RFC9347.
> > > 
> > > This utilizes the new xfrm_mode_cbs to implement demand-driven IP-TFS
> > > functionality. This functionality can be used to increase bandwidth
> > > utilization through small packet aggregation, as well as help solve PMTU
> > > issues through it's efficient use of fragmentation.
> > > 
> > > Link: https://www.rfc-editor.org/rfc/rfc9347.txt
> > > 
> > > Signed-off-by: Christian Hopps <[email-masked]>
> > 
> > ...
> > 
> > > diff --git a/net/xfrm/xfrm_iptfs.c b/net/xfrm/xfrm_iptfs.c
> > 
> > ...
> > 
> > > +/**
> > > + * skb_head_to_frag() - initialize a skb_frag_t based on skb head data
> > > + * @skb: skb with the head data
> > > + * @frag: frag to initialize
> > > + */
> > > +static void skb_head_to_frag(const struct sk_buff *skb, skb_frag_t *frag)
> > > +{
> > > +	struct page *page = virt_to_head_page(skb->data);
> > > +	unsigned char *addr = (unsigned char *)page_address(page);
> > > +
> > > +	BUG_ON(!skb->head_frag);
> > 
> > Is it strictly necessary to crash the Kernel here?
> > Likewise, many other places in this patch.
> 
> In all use cases it represents a programming error (bug) if the condition is met.
> 
> What is the correct use of BUG_ON?

Hi Christian,

I would say that BUG_ON should used in situations where
there is an unrecoverable error to the extent where
the entire system cannot continue to function.

...