Re: [PATCH -RT] net: xfrm: fix compress vs decompress serialization

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

 



On 2020-08-14 10:37:00 [-0700], Davidlohr Bueso wrote:
> ipcomp_compress() will serialize access to the ipcomp_scratches percpu buffer by
> disabling BH and preventing a softirq from coming in and running ipcom_decompress(),
> which is never called from process context. This of course won't work on RT and
> the buffer can get corrupted; there have been similar issues with in the past with
> such assumptions, ie: ebf255ed6c44 (net: add back the missing serialization in
> ip_send_unicast_reply()).
> 
> Similarly, this patch addresses the issue with locallocks allowing RT to have a
> percpu spinlock and do the correct serialization.
> 
> Addressing such races on an individual basis seemed like a game of whack a mole,
> until afaict local_bh_enable() was reworked to use locallocks in 96fac673174
> (softirq: Add preemptible softirq) which is why the BUG is not seen in newer kernels.

So what you are saying that this patch isn't needed v5.0.19-rt10+
because local_bh_disable() acts there as a lock. Repost is then with Tom
in Cc because he will be the first one to apply to the v4.19 tree. And
please shrink the patch description to a sane amount of information.

For upstream, could you please get rid of get_cpu() in
ipcomp_decompress()? If that function is always called with BH disabled
then something like this_cpu_ptr() would be enough. Also I highly
discourage code where half of the stuff is done in the part of the
function where you define local variables.
Removing get_cpu() would be nice because some implementation of
crypto_comp_decompress() acquire sleeping locks. That would be:
- nx842_crypto_decompress()
- zip_comp_decompress()
- nx842_crypto_decompress()

> Signed-off-by: Davidlohr Bueso <dbueso@xxxxxxx>
> ---
> 
> This applies on top of all v4.x based kernels -rt.

Sebastian



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux