lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180827202706.olt3saqjzzzyax6i@redhat.com>
Date:   Mon, 27 Aug 2018 16:27:06 -0400
From:   Aristeu Rozanski <aris@...hat.com>
To:     linux-kernel@...r.kernel.org
Cc:     "Luis R. Rodriguez" <mcgrof@...nel.org>,
        Kees Cook <keescook@...omium.org>
Subject: [PATCH] sysctl: do not allow a 64bit value write in a 32bit knob

Writing to a sysctl file that uses proc_dointvec_minmax like user/max_uts_namespaces
a larger than 32 bit value won't cause an error as expected but instead will zero
its value:
	# echo 214748364800000 > max_uts_namespaces
	# cat max_uts_namespaces
	0

This patches fixes it.

Signed-off-by: Aristeu Rozanski <aris@...hat.com>
Cc: "Luis R. Rodriguez" <mcgrof@...nel.org>
Cc: Kees Cook <keescook@...omium.org>

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 4ac9b9a..243f277 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2486,7 +2486,8 @@ static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
 	if (write) {
 		int val = *negp ? -*lvalp : *lvalp;
 		if ((param->min && *param->min > val) ||
-		    (param->max && *param->max < val))
+		    (param->max && *param->max < val) ||
+		    *lvalp >> (sizeof(int) * 8))
 			return -EINVAL;
 		*valp = val;
 	} else {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ