Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3562528pxb; Mon, 1 Mar 2021 13:26:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJ0GnwMxkS/hdrtpTh7misWB4c+0e9/1PeeFUUHLnAqhzaNvnK1ZFDb/bW7TfDZheiXKZf X-Received: by 2002:a17:906:8a6e:: with SMTP id hy14mr611876ejc.356.1614633980123; Mon, 01 Mar 2021 13:26:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614633980; cv=none; d=google.com; s=arc-20160816; b=zMe8ConL/VjDjIjYSkfjKbiDsbfrmrDn6GnN6b6dNa/WgKDD+a9YBROLTBfnUQvyRD S/7zMNbOMEeeWZMES+o324KIjFuuhkVw9QqYbaFYhGYMlETR3GRGr0hcVoZQiHhoQmdq YW/77tlUwPVBBd0WFJ6u+HwH+EefatiKDcLlHWhaLWYLXrSVRuWO02RT4oqeTnYAjAq5 T3/4etaNudwx3pBhXNh0GzJL2gYDtEar81Q8Dqk3gLUrOA4SFyTEaBXalWK+fy7mWER0 9Tss9tU9yInzzYbq2gjuN0qna+1WTDvE3pwCH9n38Fa2AR+XN+F6quHmmZdZt3UInxb0 cOsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1yoGlTCaEs3EPVXtjfyYezLIV7FGKIqhRx3QBwZDs6Q=; b=oZ9kS6i1SV7yHaTHjbx2C63Y6Sw2dW3YY8RS7t/bBAvW5eIyQMcuxYHDIgBnLBaCbA d+6jOcSLTbFWH9VVqrSflfY6gFkyTBcxq7zaQ9LiTCbyfkVY1Xl+Ka6qEOOEl7VtFt1L D1vCUpOtKd9/Lh7aOfwbLQ9hhnJ4ocNHSb9k0a6wsEyjQ5vEOPbhMMR9XEi1CWP4F8Pv /+bmoWFCqlwlS3B86g3U6PfRf0ntxpt9lyxwrjRuhf80lGwg97dRru2QESQfRonjNN8t lQ3cV5Q7yZjxthDDGGSqNfAWbgHjoUc4PdEhwyq4njPjGOw6/HaV5vcHOBP90qJfE+oT X47w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="md/xotTx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b4si12503593edk.452.2021.03.01.13.25.57; Mon, 01 Mar 2021 13:26:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="md/xotTx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244141AbhCAVXg (ORCPT + 99 others); Mon, 1 Mar 2021 16:23:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:57228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237987AbhCARQD (ORCPT ); Mon, 1 Mar 2021 12:16:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4B90861606; Mon, 1 Mar 2021 16:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614617176; bh=F3uOmjDRirqlt+F07n7sLAB9NP0IpsyjcYsORllsl2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=md/xotTxZbPa7/EV779be1vOdENgMqRDP5Ou6cAvvLtmA+uUgqDXA3R4nazP19vTX 4+0k6DsQUkdmSMQGecn0W2B+FKX7olSmIJK2LiQD1mGEaPaCz9B+Jf/O+PhHfzzi7F BsA25SU+o2jqugx03umm8mxSj4sDPO53Zfpt9Dp8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Al Viro , "David S. Miller" Subject: [PATCH 4.19 230/247] sparc32: fix a user-triggerable oops in clear_user() Date: Mon, 1 Mar 2021 17:14:10 +0100 Message-Id: <20210301161042.956038531@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro commit 7780918b36489f0b2f9a3749d7be00c2ceaec513 upstream. Back in 2.1.29 the clear_user() guts (__bzero()) had been merged with memset(). Unfortunately, while all exception handlers had been copied, one of the exception table entries got lost. As the result, clear_user() starting at 128*n bytes before the end of page and spanning between 8 and 127 bytes into the next page would oops when the second page is unmapped. It's trivial to reproduce - all it takes is main() { int fd = open("/dev/zero", O_RDONLY); char *p = mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0); munmap(p + 8192, 8192); read(fd, p + 8192 - 128, 192); } which had been oopsing since March 1997. Says something about the quality of test coverage... ;-/ And while today sparc32 port is nearly dead, back in '97 it had been very much alive; in fact, sparc64 had only been in mainline for 3 months by that point... Cc: stable@kernel.org Fixes: v2.1.29 Signed-off-by: Al Viro Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- arch/sparc/lib/memset.S | 1 + 1 file changed, 1 insertion(+) --- a/arch/sparc/lib/memset.S +++ b/arch/sparc/lib/memset.S @@ -142,6 +142,7 @@ __bzero: ZERO_LAST_BLOCKS(%o0, 0x48, %g2) ZERO_LAST_BLOCKS(%o0, 0x08, %g2) 13: + EXT(12b, 13b, 21f) be 8f andcc %o1, 4, %g0