Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6050250yba; Thu, 11 Apr 2019 10:59:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgCExJacUM/zqi+kdwIPXv+e4aBTMWcHYKxQUvkyA8sIeNkdTkHTn7lWiNmWgDr8WtxnPs X-Received: by 2002:a63:4558:: with SMTP id u24mr26036758pgk.225.1555005560144; Thu, 11 Apr 2019 10:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555005560; cv=none; d=google.com; s=arc-20160816; b=qnZn9iBDOaRjcPxwAZHU41NSlgsedZOu9Of8V8sYsbyqBGZpWHKCQ7SAUfNtTeJZK+ t6F/e4utqdkkRIBCPkRsfEe4Adu+B4MKmD09+2O00xqFFjHmUc2L/OqHreWONycHypu/ AWEwWRTqt3joNkeHjH9OKplnmtML3xr/7DDcIQtPMzxTkG3ObLCCky9OSA1coaReed8P FdhvtecCNmXNHvd7JQCoQXtBDEfcrVIxPrrYQ8YEHLqRqP3S0q2O9U6PtLHIjZUoLm6L 57Posc6E0u/CuCt2726D++fW+yEsYc/Sri5KeCLGAXHIGaKtpthX3ol9rOsNr26Hr8y1 zVfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jiUAb2gpJFn67EVuvYEQJP8K7EiC5auRTjLVtAjvz+o=; b=On7rOrUQsPoEusTaYFlNRX9xP659RdqfiOQIkZ1deoZ92CmpwkIEkd9XsvYmrnSZsI WULYrBNz4ssaOZBcxqgL+xXdwaj8izsa5LbAFZLmD7Gf85VdFvfErZ5KiiAB2evAPFAX lk8jINyOoVl2ROgLFkkvRkyIVujJrlYe2zObeYhmqSQ/xiMJYOF4HffNdmuc238BpcLM kvob26QUbTzbq/Fg1Cmv0spzPz/D6t69PjsonrdWzfpEmbI6Gj4/paYq89ajPyoEPezj If4dH+9e9GTLpQV/Nj8dPllNcmf0Ggm0NoYiSW1pmh/voaycekOAcmNADpAwclR7wLCw 3O6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="TqRT/D2b"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s17si21677662pfm.170.2019.04.11.10.59.03; Thu, 11 Apr 2019 10:59:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="TqRT/D2b"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726661AbfDKR61 (ORCPT + 99 others); Thu, 11 Apr 2019 13:58:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:60214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726577AbfDKR61 (ORCPT ); Thu, 11 Apr 2019 13:58:27 -0400 Received: from gmail.com (unknown [104.132.1.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2A37F2070D; Thu, 11 Apr 2019 17:58:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555005506; bh=pDhoCNdjeWrX/vbXMoWNxoXMBQ5uWIGVajVGVcqJMWQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TqRT/D2bY+vD2/ipEBuIR7EhPIJZ1dyOdUd1PhF/ZbNz1X2+KRuqX4zrziUuz9cOB uTT0Xr1mikQiwpDMnAwdPiA3W4KqXFwtWOzwrjpiHfke0Dw2OoA9d4XEs2qFwSrj+W 15+Z2cp/nX6yoafj5Xgw7D4l9bqFSqf4r4T8hvIk= Date: Thu, 11 Apr 2019 10:58:24 -0700 From: Eric Biggers To: Kees Cook Cc: Geert Uytterhoeven , Herbert Xu , linux-security-module , Linux ARM , Linux Crypto Mailing List , Linux Kernel Mailing List , Laura Abbott , Rik van Riel Subject: Re: crypto: Kernel memory overwrite attempt detected to spans multiple pages Message-ID: <20190411175823.GC225654@gmail.com> References: <20190319170911.GB202956@gmail.com> <20190320185719.GB180195@gmail.com> <20190321175122.GA1587@sol.localdomain> <20190410031734.GB7140@sol.localdomain> <20190410190729.GA120258@gmail.com> <20190410231156.GB120258@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 10, 2019 at 04:27:28PM -0700, Kees Cook wrote: > On Wed, Apr 10, 2019 at 4:12 PM Eric Biggers wrote: > > You've explained *what* it does again, but not *why*. *Why* do you want > > hardened usercopy to detect copies across page boundaries, when there is no > > actual buffer overflow? > > But that *is* how it determines it was a buffer overflow: "if you > cross page boundaries (of a non-compound allocation), it *is* a buffer > overflow". This assertion, however, is flawed because many contiguous > allocations are not marked as being grouped together when it reality > they were. It was an attempt to get allocation size information out of > the page allocator, similar to how slab can be queries about > allocation size. I'm open to improvements here, since it's obviously > broken in its current state. :) > > -- > Kees Cook Well, I'm still at a loss as to whether I'm actually supposed to "fix" this by adding __GFP_COMP, or whether you're saying the option is broken anyway so I shouldn't bother doing anything. IIUC, even the kernel stack is still not marked __GFP_COMP, so copies to/from the stack can trigger this too, despite this being reported over 2 years ago (http://lkml.iu.edu/hypermail/linux/kernel/1701.2/01450.html)? CONFIG_HARDENED_USERCOPY_PAGESPAN is even disabled in syzbot because you already said the option is broken and should not be used. I worry that people will enable all the hardened usercopy options "because security", then when the pagespan check breaks something they will disable all hardened usercopy options, because they don't understand the individual options. Providing broken options is actively harmful, IMO. - Eric