Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4952936rdb; Fri, 15 Sep 2023 18:57:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIfY8vUX0sFVdKKjbJbZdalC+Rtdq4drueatNtu2Ov2mYK4jmvLeFX0drJt0hl2OUKZ4Cu X-Received: by 2002:a05:620a:2adf:b0:773:a23e:b258 with SMTP id bn31-20020a05620a2adf00b00773a23eb258mr3123612qkb.55.1694829479135; Fri, 15 Sep 2023 18:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694829479; cv=none; d=google.com; s=arc-20160816; b=EEzvkg1MeHx7ByfiqjK3XCK5q0EHA5XzkrFCKVuTnc9PdbPsU9vHNhWnQulUKahL+a K3JqB/GFd1hH55gwCCjDi5IOHEzOspNwSEGJjt+MX3aoaaeQGSiS3m1Rpw3SY1Cz6yLE iWvuuu193zXeefmFmUPeWUWfDMhtsnVJT529R/UGh3SMI0M2iZTUn81x4uwBEOnvofMq /4d48uN4E/sTvx+pUzm8MIW+di5v8WDBDy3P2v8rZ8C1GDx9x5fwGlcRg5hdTezRYf2b fqsbVvCU3odb03HbpLvg9KZgzilT5BBau4iGGRKED9jWfE5SQNQEIR1brpkmaMr6ZS53 NuxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=F6IMANHRE1s3S84jS+w6+Qoqw0M0rcfmVcD5hXKsC/0=; fh=jqyVLh6bCUdwF76+d1nSsH9gan5yVpKFn6DRJJLnHtk=; b=rDQGHnjmJWYDyOJbT//KkZNq9DRZSe5lW1FG6/7A1dMs5cZEZEngeAEceFLBvavR13 udsyJsmX6zbihWSCsoxQd73sPjxQuVy58KXVq5FBEI/0UoLQp/YU7qNFRrz9P5/GjxdM mD3gYBVctObBdUYDu/Ne8D3xbIzhQj/JCvxVIn5suWuhpklX61/1kPmeWAUMjxsgnDy3 Aeru7LvWA3d2EpV9OaGmkdqaFCZ2xyJJ65PqrKqkxmvyxwMaGn1EQw6Y6QihnVz6SdIo JsfU0PaKk3D6nmPF61df/KlvNWbCxIax8+D4d3wA9DBkR9lzAObrgWyxk+jEv/N1GWmO +GYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Bru55z23; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id s32-20020a635260000000b00577f4d736bbsi3981934pgl.373.2023.09.15.18.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 18:57:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Bru55z23; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 4BDFC80268F3; Fri, 15 Sep 2023 14:02:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237647AbjIOVB4 (ORCPT + 99 others); Fri, 15 Sep 2023 17:01:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237852AbjIOVBl (ORCPT ); Fri, 15 Sep 2023 17:01:41 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4F1A2D4C for ; Fri, 15 Sep 2023 13:59:23 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-68fbbb953cfso2237321b3a.2 for ; Fri, 15 Sep 2023 13:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1694811563; x=1695416363; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=F6IMANHRE1s3S84jS+w6+Qoqw0M0rcfmVcD5hXKsC/0=; b=Bru55z23L8YpHrQPY3cxE4rWliYHnr+AaexITUWq0YaRjIi8+y2jVIklOZhO55SYY/ Tpe1Jdd0sMMAPGpDUPNZcJQ9dlLvDWg8dZ/3QBGvQgUVSY2Tm5/Ji5abFsExOO6l+UDW bE6VGXE/5zMjvRHX41BaZuTfhL+Z5nker5WKM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694811563; x=1695416363; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=F6IMANHRE1s3S84jS+w6+Qoqw0M0rcfmVcD5hXKsC/0=; b=HjtW5bATHEdTzIJ1Ts/vAUbHTtmw091/MAQFDnfDpwqzWyHcibDj15Bqo2I/Vivwox reJpx56lX+xdgP8ziZa04Y401yK9k5EvWRAUEiZ5QC5pGSLRjNB7KNSD0HCbsx7PQ8OQ PrilVpqh8LPIfCpmIL/4B+FsbnGxXkDi9vjYK4lftKua+1BevUkZIl2PRGX+rohZv3iA /gTuFjcJKFSV1PeBMFS7mphHZlxnORTzclxssalaMnLd5zlyqvK9JpMzdPzIMXwIrbGK Ii2BeDGH1nRwAYpy/C+Dx7WCxzPOk5BPX4QQJ1QQ5FaM7DXUQFhJXa3f+CiF/C2EeOd8 5j1g== X-Gm-Message-State: AOJu0YzObHVbQaZxIfejH0/XaLSJnzunE1Nn11cwHHJr+6Lj9EflMG10 F06RY3bgYGuQtDD/6aKo5+QDig== X-Received: by 2002:a05:6a00:2d90:b0:68f:c7c5:a73a with SMTP id fb16-20020a056a002d9000b0068fc7c5a73amr3300057pfb.16.1694811563451; Fri, 15 Sep 2023 13:59:23 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id k25-20020aa792d9000000b0068c0fcb40d3sm3306512pfa.211.2023.09.15.13.59.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 13:59:22 -0700 (PDT) Date: Fri, 15 Sep 2023 13:59:22 -0700 From: Kees Cook To: Matteo Rizzo Cc: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, vbabka@suse.cz, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-hardening@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, corbet@lwn.net, luto@kernel.org, peterz@infradead.org, jannh@google.com, evn@google.com, poprdi@google.com, jordyzomer@google.com Subject: Re: [RFC PATCH 04/14] mm: use virt_to_slab instead of folio_slab Message-ID: <202309151359.D608396BF@keescook> References: <20230915105933.495735-1-matteorizzo@google.com> <20230915105933.495735-5-matteorizzo@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230915105933.495735-5-matteorizzo@google.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 15 Sep 2023 14:02:30 -0700 (PDT) On Fri, Sep 15, 2023 at 10:59:23AM +0000, Matteo Rizzo wrote: > From: Jann Horn > > This is refactoring in preparation for the introduction of SLAB_VIRTUAL > which does not implement folio_slab. > > With SLAB_VIRTUAL there is no longer a 1:1 correspondence between slabs > and pages of physical memory used by the slab allocator. There is no way > to look up the slab which corresponds to a specific page of physical > memory without iterating over all slabs or over the page tables. Instead > of doing that, we can look up the slab starting from its virtual address > which can still be performed cheaply with both SLAB_VIRTUAL enabled and > disabled. > > Signed-off-by: Jann Horn Refactoring continues to track. Reviewed-by: Kees Cook -- Kees Cook