Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4029988ybl; Mon, 3 Feb 2020 11:10:10 -0800 (PST) X-Google-Smtp-Source: APXvYqyER3o6HjISbRN6nBzr0GdHbQfCQlgfNTcSv3HOe7CboQbhXfejqnT2Fwz7vAXgcnLvU8Dq X-Received: by 2002:a05:6808:902:: with SMTP id w2mr388087oih.170.1580757010812; Mon, 03 Feb 2020 11:10:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580757010; cv=none; d=google.com; s=arc-20160816; b=rcZcWu2kMJzOaBbPubN4B2zPbqVW9Bdkct4s2i3nNnVQEEkltP9LNKLsRaQE5YuWtH R629/Z6ykJfcnjiO1e/B3RcSL+3M3dbeUbUmv52patNKWTvyV2zumXIpOc47B/+mXtQ0 /nF1RLcoh2yhXrRMmtBDv7KLlf8gWWbk3bGdBM+EmthkjJCbzMQB77wAxgjjxqZcmDsa KNqiGmSL20EVNrhi2dWO9z8KR5L+M1E4FeGGNuNeHJDOlwlZOLXlLHdq5T7g70PBRONy NvUdbO6PLtzjwLmJwRjJbq7TIqosOxxajFypdgcCn0hrwffjO+EWj9urumVZ8sI4tNMC AbwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=XdCyjVQXiFWNG4kkdXfMamIDrFtHU/eGD1AMRHWzvMg=; b=I8FRPEPahH6C2bu2xlRa/zS27qL1Df6Hn7WMLiM+XJOBpWV1BcX76FAvFv1rH+92cm iGkkLXy9e5RElrQwa6IVPYtaXA9La39AeWIeU3NWjmGGRKeVyrL3OSFgjh+5sHb58lD4 Vry2AzOgs7vOk3za0pf9k4KVDd+Oz3ajGEe6yuBiGsZH/C10DKc8un5vmViWm9s//Wn0 35VKBbeLzRW/p2E2ZJ2FKOxxRT/B8s0MXpy3ZHmY0lWTgJ/qa+Ff0BGWXqr6ItTgZNJ9 qQPx1oD0zTGT2gGOPpGsl0LRMsYm5wEBU1HUPf3DjY+f28NF4uEF5NLrlaXaA4jDzaqC gEkQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g22si9069750otp.55.2020.02.03.11.09.57; Mon, 03 Feb 2020 11:10:10 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729474AbgBCRUE (ORCPT + 98 others); Mon, 3 Feb 2020 12:20:04 -0500 Received: from gentwo.org ([3.19.106.255]:41104 "EHLO gentwo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727429AbgBCRUE (ORCPT ); Mon, 3 Feb 2020 12:20:04 -0500 Received: by gentwo.org (Postfix, from userid 1002) id 5781C3F244; Mon, 3 Feb 2020 17:20:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 55B463ED62; Mon, 3 Feb 2020 17:20:02 +0000 (UTC) Date: Mon, 3 Feb 2020 17:20:02 +0000 (UTC) From: Christopher Lameter X-X-Sender: cl@www.lameter.com To: Kees Cook cc: Jann Horn , Christian Borntraeger , Christoph Hellwig , Jiri Slaby , Julian Wiedmann , Ursula Braun , Alexander Viro , kernel list , David Windsor , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Linux-MM , linux-xfs@vger.kernel.org, Linus Torvalds , Andy Lutomirski , "David S. Miller" , Laura Abbott , Mark Rutland , "Martin K. Petersen" , Paolo Bonzini , Christoffer Dall , Dave Kleikamp , Jan Kara , Luis de Bethencourt , Marc Zyngier , Rik van Riel , Matthew Garrett , linux-fsdevel , linux-arch , Network Development , Kernel Hardening , Vlastimil Babka , Michal Kubecek Subject: Re: [kernel-hardening] [PATCH 09/38] usercopy: Mark kmalloc caches as usercopy caches In-Reply-To: <202002010952.ACDA7A81@keescook> Message-ID: References: <202001271519.AA6ADEACF0@keescook> <5861936c-1fe1-4c44-d012-26efa0c8b6e7@de.ibm.com> <202001281457.FA11CC313A@keescook> <6844ea47-8e0e-4fb7-d86f-68046995a749@de.ibm.com> <20200129170939.GA4277@infradead.org> <771c5511-c5ab-3dd1-d938-5dbc40396daa@de.ibm.com> <202001300945.7D465B5F5@keescook> <202002010952.ACDA7A81@keescook> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 1 Feb 2020, Kees Cook wrote: > > I can't find where the address limit for dma-kmalloc is implemented. include/linux/mmzones.h enum zone_type { /* * ZONE_DMA and ZONE_DMA32 are used when there are peripherals not able * to DMA to all of the addressable memory (ZONE_NORMAL). * On architectures where this area covers the whole 32 bit address * space ZONE_DMA32 is used. ZONE_DMA is left for the ones with smaller * DMA addressing constraints. This distinction is important as a 32bit * DMA mask is assumed when ZONE_DMA32 is defined. Some 64-bit * platforms may need both zones as they support peripherals with * different DMA addressing limitations. * * Some examples: * * - i386 and x86_64 have a fixed 16M ZONE_DMA and ZONE_DMA32 for the * rest of the lower 4G. * * - arm only uses ZONE_DMA, the size, up to 4G, may vary depending on * the specific device. * * - arm64 has a fixed 1G ZONE_DMA and ZONE_DMA32 for the rest of the * lower 4G. * * - powerpc only uses ZONE_DMA, the size, up to 2G, may vary * depending on the specific device. * * - s390 uses ZONE_DMA fixed to the lower 2G. * * - ia64 and riscv only use ZONE_DMA32. * * - parisc uses neither. */ #ifdef CONFIG_ZONE_DMA ZONE_DMA, #endif #ifdef CONFIG_ZONE_DMA32 ZONE_DMA32, #endif /* * Normal addressable memory is in ZONE_NORMAL. DMA operations can be * performed on pages in ZONE_NORMAL if the DMA devices support * transfers to all addressable memory. */ ZONE_NORMAL, #ifdef CONFIG_HIGHMEM /* * A memory area that is only addressable by the kernel through * mapping portions into its own address space. This is for example * used by i386 to allow the kernel to address the memory beyond * 900MB. The kernel will set up special mappings (page * table entries on i386) for each page that the kernel needs to * access. */ ZONE_HIGHMEM, #endif ZONE_MOVABLE, #ifdef CONFIG_ZONE_DEVICE ZONE_DEVICE, #endif __MAX_NR_ZONES };