Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp625958rwd; Tue, 16 May 2023 05:59:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6x/sN3k3Kg1BOHJuPPL8lnnUvBPH7V5hEViGBSLOucqSyQebRmaAmhiQ2jGg2cYEmjvlIJ X-Received: by 2002:a17:90a:134b:b0:250:aa9e:f8e2 with SMTP id y11-20020a17090a134b00b00250aa9ef8e2mr25948595pjf.18.1684241996282; Tue, 16 May 2023 05:59:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684241996; cv=none; d=google.com; s=arc-20160816; b=kNDAeeBhrJDcA2q/7UV9AtV1MCzAhZ58IfTXSozGq4fYAiWqk6/O2momSSYT1RdcH9 CivnRTpnlqDCU1BPdoLJUrRFpLf5wS7nITLIBwEc5H0nsO63JnPKVpLvD2Mo01gz+aQe UDIKUS/M2M9PysaPqnNkMwrlCGO8v/gQzVhY6v83yP+xSHmp2yr3at2ugu9QWF5Ka7WH KcKJ6GVVvwuSmiXwlKFyQVHP8ahf3xqbtLJ2wai7xAYo6yw8oSP2jylDVLRIBQKIioXE jqjqxxsKcihCAm7PlTNBalKBJpkRYSA13kDLkHMD3ZOpFOK2EUwANJe2ox6V2wI0RKgh ICXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=TcyEykK3oU2aR43SsclKXEYSiS1KO2O1iEjSHmGB+ZA=; b=NkwKq0CXwT/z6l3sWsy+txnfRBq+6Zd+f201FcMrOdgvG5Fimp26T+2+I7ScII0Zrw lEZau3XO7qZa41DMVj7VoM9JVZ1PakK0I1EMTzEhBIW8SQML4ISZ7IDhOgL01Tt78a7c GOd+C/qCj5cSMgB9UmKVimmiaTRswG6w8+qLUiO80kz5/2yhTTmFrWyBIfi9muQQMZUV NZ9V+pwU1Lb5Oqu3cP0h3dGcdaxFrQTqwvWZGF4c4y8SqMnBpqDcnShjjGhBniIOw44p 7Xbrv6oRI/15moK2FlNku5IhAV5BL9ryBpn1Hadr3RxoJ/ji6IP4ZqUxO7lJk1/oj05k NRUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="E/PMAng5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020a17090ab29400b0023b481b8dcesi1615766pjr.102.2023.05.16.05.59.42; Tue, 16 May 2023 05:59:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="E/PMAng5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233324AbjEPM5X (ORCPT + 99 others); Tue, 16 May 2023 08:57:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233409AbjEPM5G (ORCPT ); Tue, 16 May 2023 08:57:06 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C8E67280 for ; Tue, 16 May 2023 05:55:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684241708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TcyEykK3oU2aR43SsclKXEYSiS1KO2O1iEjSHmGB+ZA=; b=E/PMAng5IlilKjOEGiZc70Gd2REspjWBoDhT2opu2HeEx1GpurSeETRbGyVlqGvhlTr6LK vZpi9BbqMHj6xhSyl8QeqsSjZ74t2G9JULJWSI47vq8M1lYb7X8TpNBWYcVnQzPQwv/KD+ 9w5pYaZRRGp9/R6xncQz98dgFbeJodQ= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-306-vtbgforPPyeej-mQfyHUOg-1; Tue, 16 May 2023 08:55:04 -0400 X-MC-Unique: vtbgforPPyeej-mQfyHUOg-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-3f4245ffb03so63285975e9.3 for ; Tue, 16 May 2023 05:55:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684241703; x=1686833703; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TcyEykK3oU2aR43SsclKXEYSiS1KO2O1iEjSHmGB+ZA=; b=CuOXqQKQCQVieUI2CWSuY7KkbX9VZnusakdjxyZS4yIU5Pqgi5Rv/HPVBX8upRO2Ih NaUirqATBNrkFl9L4bxmrYy/zlBSKAceM88DIYxzNgECUj7TRNartDzAEKCn95xtDreo AjaTOxPItPuZWgNNksTUbb7uibGLV1qtfzKkeAA4tyZjbXeONd2tMVd916GtYtEtiXQj Zu04iVxMCnMyIMgdSDYpOu+ytaEEZD2xB4gZ8Y9YEjWPxYU3LSLZ1Jt8VMal+keCRbVi LHhTbH5OL63TzAkqzQFW2pQYHS0DxxYAxsLnntE4vmnd9OxzZY0PujD6gAuAcrOv0vap V79w== X-Gm-Message-State: AC+VfDz/ttR0yVHFjJd7ieExxcoqheTeMY+Gb3JIC43DFsWr8xh5wlwe z5pspdr+5IbqM74xXv5/WdsZVVyviZ+EkSrMQm4qpx48mv9eQt6xJXHI0TrX9o0PcZzpZYLQ+bj iPy01JVHOAk2ua7kgPiQRnAfc X-Received: by 2002:a7b:cc93:0:b0:3f4:2bb3:a5bb with SMTP id p19-20020a7bcc93000000b003f42bb3a5bbmr16864223wma.9.1684241703493; Tue, 16 May 2023 05:55:03 -0700 (PDT) X-Received: by 2002:a7b:cc93:0:b0:3f4:2bb3:a5bb with SMTP id p19-20020a7bcc93000000b003f42bb3a5bbmr16864199wma.9.1684241703121; Tue, 16 May 2023 05:55:03 -0700 (PDT) Received: from ?IPV6:2003:cb:c74f:2500:1e3a:9ee0:5180:cc13? (p200300cbc74f25001e3a9ee05180cc13.dip0.t-ipconnect.de. [2003:cb:c74f:2500:1e3a:9ee0:5180:cc13]) by smtp.gmail.com with ESMTPSA id o2-20020a1c7502000000b003f195d540d9sm2256533wmc.14.2023.05.16.05.55.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 May 2023 05:55:02 -0700 (PDT) Message-ID: <72fc50da-c3b9-b71b-209b-9413a8693f13@redhat.com> Date: Tue, 16 May 2023 14:55:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v2 3/4] mm: page_table_check: Make it dependent on EXCLUSIVE_SYSTEM_RAM Content-Language: en-US To: Ruihan Li , linux-mm@kvack.org, linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Pasha Tatashin , Matthew Wilcox , Andrew Morton , Christoph Hellwig , Alan Stern , Greg Kroah-Hartman , stable@vger.kernel.org References: <20230515130958.32471-1-lrh2000@pku.edu.cn> <20230515130958.32471-4-lrh2000@pku.edu.cn> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20230515130958.32471-4-lrh2000@pku.edu.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15.05.23 15:09, Ruihan Li wrote: > Without EXCLUSIVE_SYSTEM_RAM, users are allowed to map arbitrary > physical memory regions into the userspace via /dev/mem. At the same > time, pages may change their properties (e.g., from anonymous pages to > named pages) while they are still being mapped in the userspace, leading > to "corruption" detected by the page table check. > > To avoid these false positives, this patch makes PAGE_TABLE_CHECK > depends on EXCLUSIVE_SYSTEM_RAM. This dependency is understandable > because PAGE_TABLE_CHECK is a hardening technique but /dev/mem without > STRICT_DEVMEM (i.e., !EXCLUSIVE_SYSTEM_RAM) is itself a security > problem. > > Even with EXCLUSIVE_SYSTEM_RAM, I/O pages may be still allowed to be > mapped via /dev/mem. However, these pages are always considered as named > pages, so they won't break the logic used in the page table check. > > Cc: # 5.17 > Signed-off-by: Ruihan Li Acked-by: David Hildenbrand -- Thanks, David / dhildenb