Handling argc==0 in the kernel
Handling argc==0 in the kernel
Posted Feb 1, 2022 1:37 UTC (Tue) by NYKevin (subscriber, #129325)In reply to: Handling argc==0 in the kernel by developer122
Parent article: Handling argc==0 in the kernel
As I explained in another comment, the caller can set argv[0] to any string it wishes, and a setuid program must not trust the caller (because the caller is unprivileged). So all setuid programs *must* behave correctly for invalid or "wrong" argv[0]. If they don't, then that's a separate vulnerability which must be fixed regardless of what the kernel does in the argc == 0 case. By coalescing the two cases into one case, you halve the number of potential vulnerabilities that application writers need to worry about.
