Mac12.0.1 loadNib NSValidateNibPathInMainBundle issue

I found that after my iMac upgraded to 12.0.1 (21A559), my app get slower than before.

When debugging, I find there is a new function NSValidateNibPathInMainBundle called before loadNib. it will always cause a CodeSign exception. please help.

Code

    0x7ff81f90830b <+1524>: movq   0x3ee478ee(%rip), %rsi    ; "_nibFileToLoadFromListOfFiles:atNibPath:isKeyed:"
    0x7ff81f908312 <+1531>: movq   -0xc0(%rbp), %rdi
    0x7ff81f908319 <+1538>: movq   %rdi, %r12
    0x7ff81f90831c <+1541>: movq   -0xf0(%rbp), %rdx
    0x7ff81f908323 <+1548>: movq   -0xd8(%rbp), %r14
    0x7ff81f90832a <+1555>: movq   %r14, %rcx
    0x7ff81f90832d <+1558>: callq  *0x3d43ef05(%rip)         ; (void *)0x00007ff81ccd9040: objc_msgSend
    0x7ff81f908333 <+1564>: testq  %rax, %rax
    0x7ff81f908336 <+1567>: je     0x7ff81f908371            ; <+1626>
    0x7ff81f908338 <+1569>: movq   %rax, %r15
    0x7ff81f90833b <+1572>: movq   %rax, %rdi
    0x7ff81f90833e <+1575>: callq  0x7ff820435a15            ; NSValidateNibPathInMainBundle
->  0x7ff81f908343 <+1580>: cmpb   $0x0, -0xb1(%rbp)
    0x7ff81f90834a <+1587>: movq   -0xc8(%rbp), %r13
    0x7ff81f908351 <+1594>: je     0x7ff81f9083a4            ; <+1677>
    0x7ff81f908353 <+1596>: movq   %r15, %rdi
    0x7ff81f908356 <+1599>: movq   -0xe8(%rbp), %rsi
    0x7ff81f90835d <+1606>: movq   -0x100(%rbp), %rdx
    0x7ff81f908364 <+1613>: callq  0x7ff81f908984            ; loadNib
    0x7ff81f908369 <+1618>: movl   %eax, %r15d
    0x7ff81f90836c <+1621>: jmp    0x7ff81f9084e3            ; <+1996>

Exception Stack

#1	0x00007ff81f041133 in Security::CodeSigning::CSError::throwMe(int, __CFString const*, void const*) ()
#2	0x00007ff81f0357e5 in Security::CodeSigning::SecStaticCode::staticValidateCore(unsigned int, Security::CodeSigning::SecRequirement const*) ()
#3	0x00007ff81f037315 in Security::CodeSigning::SecStaticCode::staticValidateResource(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, unsigned int, Security::CodeSigning::SecRequirement const*) ()
#4	0x00007ff81f02970b in SecStaticCodeValidateResourceWithErrors ()
#5	0x00007ff820435c73 in NSValidateNibPathInMainBundle ()
#6	0x00007ff81f908343 in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:options:withZone:ownerBundle:] ()
#7	0x00007ff81f907c22 in -[NSBundle(NSNibLoading) loadNibNamed:owner:topLevelObjects:] ()

every loadNib will spend much time on SecStaticCodeValidateResourceWithErrors

CodeSign exception is fixed, but SecStaticCodeValidateResourceWithErrors still costs 90%+ time in loadNib.

How did you fix the codesign exception?

Mac12.0.1 loadNib NSValidateNibPathInMainBundle issue
 
 
Q