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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1302796585-29504-1-git-send-email-segoon@openwall.com>
Date:	Thu, 14 Apr 2011 19:56:25 +0400
From:	Vasiliy Kulikov <segoon@...nwall.com>
To:	linux-kernel@...r.kernel.org
Cc:	Greg Kroah-Hartman <gregkh@...e.de>, devel@...verdev.osuosl.org
Subject: [PATCH] char: istallion: fix arbitrary kernel memory reads/writes

stli_brdstats is defined as global variable.  After de-BKL-ization in
the patch b4eda9cb48eac1b7 an access to the variable is not serialized
anymore.  This leads to the race window between the check and the use
in stli_getbrdstats():

        if (copy_from_user(&stli_brdstats, bp, sizeof(combrd_t)))
                return -EFAULT;
        if (stli_brdstats.brd >= STL_MAXBRDS) <<<
                return -ENODEV;
        brdp = stli_brds[stli_brdstats.brd];  <<<

If one process calls COM_GETBRDSTATS ioctl() with sane .brd, second
process calls COM_GETBRDSTATS ioctl() with invalid .brd, and the
second process' copy_from_user() executes exactly between the check and
stli_brds[] indexation of the first process, then the first process gets
contents of memory at *stli_brds[stli_brdstats.brd] address.  Also
the resulting .nrpanels field may be too big, in this case
stli_brdstats.panels array overflows.

Signed-off-by: Vasiliy Kulikov <segoon@...nwall.com>
---
 drivers/staging/tty/istallion.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/tty/istallion.c b/drivers/staging/tty/istallion.c
index 0b26627..ca18cbf 100644
--- a/drivers/staging/tty/istallion.c
+++ b/drivers/staging/tty/istallion.c
@@ -186,7 +186,6 @@ static struct ktermios		stli_deftermios = {
  *	re-used for each stats call.
  */
 static comstats_t	stli_comstats;
-static combrd_t		stli_brdstats;
 static struct asystats	stli_cdkstats;
 
 /*****************************************************************************/
@@ -4005,6 +4004,7 @@ static int stli_getbrdstats(combrd_t __user *bp)
 {
 	struct stlibrd *brdp;
 	unsigned int i;
+	combrd_t stli_brdstats;
 
 	if (copy_from_user(&stli_brdstats, bp, sizeof(combrd_t)))
 		return -EFAULT;
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ