Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 May 2019 04:28:18 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r347423 - head/sys/dev/random
Message-ID:  <201905100428.x4A4SImq099037@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Fri May 10 04:28:17 2019
New Revision: 347423
URL: https://svnweb.freebsd.org/changeset/base/347423

Log:
  Avoid returning a NULL pointer from the Intel hw PRNG ifunc resolver.
  
  DTrace expects kernel function symbols of a non-zero size to have an
  implementation, which is a reasonable invariant to preserve.
  
  Reported and tested by:	ler
  Reviewed by:	cem, kib
  Approved by:	so (delphij)
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D20218

Modified:
  head/sys/dev/random/ivy.c

Modified: head/sys/dev/random/ivy.c
==============================================================================
--- head/sys/dev/random/ivy.c	Fri May 10 02:30:16 2019	(r347422)
+++ head/sys/dev/random/ivy.c	Fri May 10 04:28:17 2019	(r347423)
@@ -97,6 +97,13 @@ x86_rdseed_store(u_long *buf)
 	return (retry);
 }
 
+static int
+x86_unimpl_store(u_long *buf __unused)
+{
+
+	panic("%s called", __func__);
+}
+
 DEFINE_IFUNC(static, int, x86_rng_store, (u_long *buf), static)
 {
 	has_rdrand = (cpu_feature2 & CPUID2_RDRAND);
@@ -107,7 +114,7 @@ DEFINE_IFUNC(static, int, x86_rng_store, (u_long *buf)
 	else if (has_rdrand)
 		return (x86_rdrand_store);
 	else
-		return (NULL);
+		return (x86_unimpl_store);
 }
 
 /* It is required that buf length is a multiple of sizeof(u_long). */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905100428.x4A4SImq099037>