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
This commit is contained in:
Warner Losh 2014-11-29 17:29:30 +00:00
parent 6762091ea4
commit fac92ae126
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=275261
3 changed files with 3 additions and 2 deletions

View File

@ -938,7 +938,7 @@ moduledir_readhints(struct moduledir *mdp)
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;

View File

@ -1752,7 +1752,7 @@ linker_hints_lookup(const char *path, int pathlen, const char *modname,
/*
* 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;
}

View File

@ -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