Re: Crash loading dtraceall

From: Larry Rosenman <ler_at_FreeBSD.org>
Date: Thu, 09 May 2019 07:08:24 -0500
On 05/08/2019 11:31 pm, Mark Johnston wrote:
> On Wed, May 08, 2019 at 11:01:58PM -0500, Larry Rosenman wrote:
>> On 05/08/2019 10:32 pm, Mark Johnston wrote:
>> > On Wed, May 08, 2019 at 05:57:18PM -0500, Larry Rosenman wrote:
>> >> On 05/08/2019 5:55 pm, Mark Johnston wrote:
>> >> > On Wed, May 08, 2019 at 05:47:08PM -0500, Larry Rosenman wrote:
>> >> >> On 05/08/2019 5:29 pm, Mark Johnston wrote:
>> >> >> > On Wed, May 08, 2019 at 03:52:45PM -0500, Larry Rosenman wrote:
>> >> >> >> Greetings,
>> >> >> >>
>> >> >> >>     Somewhere between r346483 and r347241 loading dtraceall causes a
>> >> >> >>     crash.  I have the cores and kernels.
>> >> >> >>
>> >> >> >>     It's hard for me to bisect more than this, as the box is remote.
>> >> >> >>
>> >> >> >>     What more do you need?  (this dump is fropm r347355).
>> >> >> >
>> > The problem is with the kernel linker's handling of ifuncs.  When
>> > enumerating symbols, it replaces ifunc symbol values with the return
>> > value of the resolver but preserves the original symbol size, which is
>> > that of the resolver.  I believe this patch will address the panic
>> > you're seeing:
>> >
>> It does *NOT*.
> 
> I see, my theory above is not the real problem here.  The resolver for
> x86_rng_store() may return NULL, which we do not expect.  Can you show
> the CPU info and features lines from the dmesg to confirm?
> 
> Also see if this patch helps:
> 
> diff --git a/sys/dev/random/ivy.c b/sys/dev/random/ivy.c
> index 57f3d0a1d80b..71065d788cf9 100644
> --- a/sys/dev/random/ivy.c
> +++ b/sys/dev/random/ivy.c
> _at__at_ -97,6 +97,13 _at__at_ x86_rdseed_store(u_long *buf)
>  	return (retry);
>  }
> 
> +static int
> +x86_dead_store(u_long *buf __unused)
> +{
> +
> +	panic("missing hardware PRNG support");
> +}
> +
>  DEFINE_IFUNC(static, int, x86_rng_store, (u_long *buf), static)
>  {
>  	has_rdrand = (cpu_feature2 & CPUID2_RDRAND);
> _at__at_ -107,7 +114,7 _at__at_ DEFINE_IFUNC(static, int, x86_rng_store, (u_long
> *buf), static)
>  	else if (has_rdrand)
>  		return (x86_rdrand_store);
>  	else
> -		return (NULL);
> +		return (x86_dead_store);
>  }
> 
>  /* It is required that buf length is a multiple of sizeof(u_long). */

The above patch (on top of the previous one) fixes the crash.

flags/features as requested:
CPU: Intel(R) Xeon(R) CPU           E5440  _at_ 2.83GHz (2826.30-MHz 
K8-class CPU)
   Origin="GenuineIntel"  Id=0x1067a  Family=0x6  Model=0x17  Stepping=10
   
Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
   
Features2=0xc0ce3bd<SSE3,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,DCA,SSE4.1,XSAVE,OSXSAVE>
   AMD Features=0x20100800<SYSCALL,NX,LM>
   AMD Features2=0x1<LAHF>
   VT-x: HLT,PAUSE
   TSC: P-state invariant, performance statistics


-- 
Larry Rosenman                     http://people.freebsd.org/~ler
Phone: +1 214-642-9640                 E-Mail: ler_at_FreeBSD.org
US Mail: 5708 Sabbia Dr, Round Rock, TX 78665-2106
Received on Thu May 09 2019 - 10:08:27 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:20 UTC