Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Nov 2014 17:29:31 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r275261 - in head/sys: boot/common kern sys
Message-ID:  <201411291729.sATHTV7O005256@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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
 



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