Page MenuHomeFreeBSD

Make kern.argmax boot tunable
Needs ReviewPublic

Authored by novel on Jun 27 2016, 10:25 PM.
This revision needs review, but there are no reviewers specified.



This is a continuation of effort started here: with a patch provided Per Hedeland. Frankly, it didn't change much although almost 13 years passed.

I haven't had a close look at the userland part of it, though it seems that some things have improved and a lot more things use sysconf(_SC_ARG_MAX).

I performed some basic testing, i.e. I needed that for some specific need and it fixed my issue.

Diff Detail

rS FreeBSD src repository
Lint Skipped
Unit Tests Skipped
Build Status
Buildable 7089

Event Timeline

novel retitled this revision from to Make kern.argmax boot tunable.Jun 27 2016, 10:25 PM
novel updated this object.
novel edited the test plan for this revision. (Show Details)
novel set the repository for this revision to rS FreeBSD src repository.
novel updated this revision to Diff 17954.
jilles added a subscriber: jilles.Jul 3 2016, 12:47 PM

Perhaps this is a good first step regarding ARG_MAX.

The kernel uses ARG_MAX more frequently such as when copying in and out argument strings (including ABI compatibility layers and sysctl kern.proc.<N>.args), which are not adjusted by the patch.

115 ↗(On Diff #17954)

Please do not remove CTLFLAG_CAPRD here.

86 ↗(On Diff #17954)

Are these conditional #defines necessary? The conditional #defines above seem to allow for optional values in the kernel configuration, but ARG_MAX and _POSIX_ARG_MAX are defined in header files. Changing _POSIX_ARG_MAX in a kernel configuration definitely does not make sense.

267 ↗(On Diff #17954)

This will use more kernel virtual address space (KVA) which may be a problem on 32-bit systems. Users can work around this by setting the tunable vm.exec_map_entries lower (default 16).

Perhaps we want to treat small arguments lists specially or copy from old to new address space directly.

novel added a comment.Jul 11 2016, 1:22 AM

Thanks for looking! I'll update the patch to include missing bits.

Added some inline comments as well...

115 ↗(On Diff #17954)

Will add it back.

86 ↗(On Diff #17954)

ARG_MAX holds the default size of arg max. _POSIX_ARG_MAX is the minimum value we allow for arg max. Do you mean it should be just inlined?

267 ↗(On Diff #17954)

Honestly speaking, that's something I have to look deeper to understand. Pointers where to start would be much appreciated.

jilles added inline comments.Jul 11 2016, 2:04 PM
86 ↗(On Diff #17954)

The value of ARG_MAX should be obtained from <sys/syslimits.h>. The definition of _POSIX_ARG_MAX should probably be moved from include/limits.h to something under sys/ that can be included here.

267 ↗(On Diff #17954)

For copying from old to new address space, see proc_rwmem() in sys/kern/sys_process.c.

novel updated this revision to Diff 24568.Jan 30 2017, 4:58 PM

Just rebase onto fresh -CURRENT.