svn commit: r275261 - in head/sys: boot/common kern sys

Warner Losh imp at FreeBSD.org
Sat Nov 29 17:29:32 UTC 2014


Author: imp
Date: Sat Nov 29 17:29:30 2014
New Revision: 275261
URL: https://svnweb.freebsd.org/changeset/base/275261

Log:
  The current limit of 100k for the linker hints file is getting a bit
  crowded as we now are at about 70k. Bump the limit to 1MB instead
  which is still quite a reasonable limit and allows for future growth
  of this file and possible future expansion to additional data.
  
  MFC After: 2 weeks

Modified:
  head/sys/boot/common/module.c
  head/sys/kern/kern_linker.c
  head/sys/sys/linker.h

Modified: head/sys/boot/common/module.c
==============================================================================
--- head/sys/boot/common/module.c	Sat Nov 29 17:18:20 2014	(r275260)
+++ head/sys/boot/common/module.c	Sat Nov 29 17:29:30 2014	(r275261)
@@ -938,7 +938,7 @@ moduledir_readhints(struct moduledir *md
     path = moduledir_fullpath(mdp, "linker.hints");
     if (stat(path, &st) != 0 ||
 	st.st_size < (ssize_t)(sizeof(version) + sizeof(int)) ||
-	st.st_size > 100 * 1024 || (fd = open(path, O_RDONLY)) < 0) {
+	st.st_size > LINKER_HINTS_MAX || (fd = open(path, O_RDONLY)) < 0) {
 	free(path);
 	mdp->d_flags |= MDIR_NOHINTS;
 	return;

Modified: head/sys/kern/kern_linker.c
==============================================================================
--- head/sys/kern/kern_linker.c	Sat Nov 29 17:18:20 2014	(r275260)
+++ head/sys/kern/kern_linker.c	Sat Nov 29 17:29:30 2014	(r275261)
@@ -1752,7 +1752,7 @@ linker_hints_lookup(const char *path, in
 	/*
 	 * XXX: we need to limit this number to some reasonable value
 	 */
-	if (vattr.va_size > 100 * 1024) {
+	if (vattr.va_size > LINKER_HINTS_MAX) {
 		printf("hints file too large %ld\n", (long)vattr.va_size);
 		goto bad;
 	}

Modified: head/sys/sys/linker.h
==============================================================================
--- head/sys/sys/linker.h	Sat Nov 29 17:18:20 2014	(r275260)
+++ head/sys/sys/linker.h	Sat Nov 29 17:29:30 2014	(r275261)
@@ -228,6 +228,7 @@ void *linker_hwpmc_list_objects(void);
 #endif
 
 #define	LINKER_HINTS_VERSION	1		/* linker.hints file version */
+#define	LINKER_HINTS_MAX	(1 << 20)	/* Allow at most 1MB for linker.hints */
 
 #ifdef _KERNEL
 


More information about the svn-src-all mailing list