From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3rrDqk2rPHzDqFR for ; Fri, 15 Jul 2016 11:04:33 +1000 (AEST) Message-ID: <1468544658.30053.26.camel@redhat.com> Subject: Re: [PATCH v2 02/11] mm: Hardened usercopy From: Rik van Riel To: bsingharora@gmail.com, Kees Cook Cc: linux-kernel@vger.kernel.org, Casey Schaufler , PaX Team , Brad Spengler , Russell King , Catalin Marinas , Will Deacon , Ard Biesheuvel , Benjamin Herrenschmidt , Michael Ellerman , Tony Luck , Fenghua Yu , "David S. Miller" , x86@kernel.org, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Andy Lutomirski , Borislav Petkov , Mathias Krause , Jan Kara , Vitaly Wool , Andrea Arcangeli , Dmitry Vyukov , Laura Abbott , linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, kernel-hardening@lists.openwall.com Date: Thu, 14 Jul 2016 21:04:18 -0400 In-Reply-To: <20160714232019.GA28254@350D> References: <1468446964-22213-1-git-send-email-keescook@chromium.org> <1468446964-22213-3-git-send-email-keescook@chromium.org> <20160714232019.GA28254@350D> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-KZJAwjbKcy8GWaOESkNS" Mime-Version: 1.0 List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , --=-KZJAwjbKcy8GWaOESkNS Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2016-07-15 at 09:20 +1000, Balbir Singh wrote: > > =3D=3D > > + =C2=A0=C2=A0=C2=A0((unsigned long)end & (unsigned > > long)PAGE_MASK))) > > + return NULL; > > + > > + /* Allow if start and end are inside the same compound > > page. */ > > + endpage =3D virt_to_head_page(end); > > + if (likely(endpage =3D=3D page)) > > + return NULL; > > + > > + /* Allow special areas, device memory, and sometimes > > kernel data. */ > > + if (PageReserved(page) && PageReserved(endpage)) > > + return NULL; >=20 > If we came here, it's likely that endpage > page, do we need to check > that only the first and last pages are reserved? What about the ones > in > the middle? I think this will be so rare, we can get away with just checking the beginning and the end. --=20 All Rights Reversed. --=-KZJAwjbKcy8GWaOESkNS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJXiDaSAAoJEM553pKExN6D6uIIAKN7TgG6txgGbnc5u842to8Y 3onll7X1bxNRDoiohBXsmoCTB8Taa6Ww5jduLzxsxD5jFJSjRAKpR9Dq1RLTeG+P jKOw5tUu3KGj86rJuCpRHZF/FcPWIFode9mhcRFP+l4SucdpGY2TT4qdwuHPtkAC +e04TCM0knAUCsZAjh1/dewujxGK45ssvdS0W9z6ASEEO07dnfbkwe10jAtAHwJ/ RpyHZAtOUyc0mpYb+JFhD1bdN1BS9YQTydVkTC2Xb33u1TYKd8mkILPs/cSe7Atk 7kZKV9BFL1qQgnUvKuTjf6pBQDf3HqAnFvgLzDG9d1niLnZ+/8/1LKoum3nLMPw= =+jcM -----END PGP SIGNATURE----- --=-KZJAwjbKcy8GWaOESkNS--