Page MenuHomeFreeBSD

Fix witness warning: uma_zalloc->witness_warn, exclusive sleep mutex xforms_list (IPsec transforms list)
ClosedPublic

Authored by ae on Sep 24 2018, 12:45 PM.
Tags
None
Referenced Files
F103010557: D17302.diff
Tue, Nov 19, 7:18 PM
Unknown Object (File)
Oct 19 2024, 6:11 AM
Unknown Object (File)
Oct 19 2024, 6:11 AM
Unknown Object (File)
Oct 19 2024, 6:10 AM
Unknown Object (File)
Oct 19 2024, 5:50 AM
Unknown Object (File)
Sep 27 2024, 1:47 PM
Unknown Object (File)
Sep 16 2024, 7:56 PM
Unknown Object (File)
Sep 16 2024, 7:56 PM
Subscribers

Details

Summary

After rS336439 crypto_newsession() does uma_zalloc() with M_WAITOK flag and since, xform_init holds mutex during this call, WITNESS shows warning about possible deadlock.
This patch does several things:

  • xform-related functions moved into subr_ipsec.c
  • release XFORMS_LOCK() before invoking xf_init() that calls crypto_newsession()
  • use ipsec_kmod_enter/exit/drain functions to protect from xform kernel module unloading during xfrom_init call
  • always build ipsec_kmod_enter/exit/drain functions into kernel (when options IPSEC or IPSEC_SUPPORT is specified)
  • added new field xf_cntr to struct xformsw, it is used by ipsec_kmod_* functions
  • constified xf_name field
Test Plan

I tested the GENERIC kernel, GENERC w/o IPSEC, and GENERIC w/o IPSEC_SUPPORT. Seems all works as expected.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Moving functions should be a separate commit and not be mixed with the functional changes.

In D17302#368848, @bz wrote:

Moving functions should be a separate commit and not be mixed with the functional changes.

Moving is done, because functions are static, and something should be changed - either ipsec_kmod_* functions should be changed to global, or xform_* moved into subr_ipsec.c, or new functions like ipsec_kmod_* should be added to key.c

This revision was not accepted when it landed; it landed in state Needs Review.Sep 26 2018, 2:48 PM
This revision was automatically updated to reflect the committed changes.