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
Unknown Object (File)
Jan 8 2024, 2:45 PM
Unknown Object (File)
Jan 8 2024, 2:45 PM
Unknown Object (File)
Jan 8 2024, 2:45 PM
Unknown Object (File)
Jan 8 2024, 2:43 PM
Unknown Object (File)
Jan 7 2024, 6:04 AM
Unknown Object (File)
Dec 21 2023, 3:29 PM
Unknown Object (File)
Dec 20 2023, 5:35 AM
Unknown Object (File)
Nov 30 2023, 4:40 AM
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.