6021ece539
Calculating it earlier is a micro-optimization that doesn't seem like it matters at all compared to all other costs of spawning a process. But at the same time it makes things more fragile. And in fact bootstrap actually passed the wrong value. It passed the total_args_envs_auxvpointee_size that it computed rather than the total_args_envs_size. While over-approximation doesn't cause UB, it unnecessarily increases the amount of memory used after exec. In addition pass &[&[u8]] rather than iterators for args and envs to enable precomputing the total arg and env size. This also prevents you from forgetting to pass a reversed iterator.