# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/linux/hotfix-exec.patch # Copyright (C) 2022 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License version 2 as used by the T2 SDE. # --- T2-COPYRIGHT-NOTE-END --- Prevert PwnKit class of vulnerabilities by not allowing 0 argv, like OpenBSD. https://bugzilla.kernel.org/show_bug.cgi?id=8408 --- linux-5.15/fs/exec.c.vanilla 2022-01-27 17:12:37.390020117 +0100 +++ linux-5.15/fs/exec.c 2022-01-27 17:12:38.727020064 +0100 @@ -1897,6 +1897,10 @@ retval = count(argv, MAX_ARG_STRINGS); if (retval < 0) goto out_free; + else if (retval == 0) { + retval = -EINVAL; + goto out_free; + } bprm->argc = retval; retval = count(envp, MAX_ARG_STRINGS);