Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp514403pxb; Fri, 16 Apr 2021 11:00:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyo8DuJ/tyJbkDpihRpLb4wFov4oB5RoBIheUCZZ3iXH3oAUyiBbjEGKmszxGsfHQPj1/KK X-Received: by 2002:a17:90a:fb4c:: with SMTP id iq12mr10876637pjb.121.1618596008013; Fri, 16 Apr 2021 11:00:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618596008; cv=none; d=google.com; s=arc-20160816; b=vJHyTmAqy1X+CWMLCMGM3m0/eE8pdjleJ8A9znM9r+g6qlEipZzQ/UIr5gfpLm/VMA xcbCnpCVvMMh1RkO6HjVa0G8dS6Jw0ky9dTrWpMWimK2Emq3eOX0AyKTvZJx+N9euIhf p87yif/vHfXF3GRH7QSYlI4YSMv2KC2QeHhGM5l65L0UFTojus+TfIhZMKaV4zOgIlgk zWUgEWEkAgEWMkNjearmdZJqnZvz2e74fgpZWO5KDxafXmUKd5cyqJL7HtxTzQnKNGNy 8INezvV6VgA8+muVxmSvp+0fHlq/zzTNDNw5JmIeBMRzg8eItdKIEVhiibOTOymiNP87 owvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=40AK2C1YfbaH++4wuvlP0O1xCfNixr5gbRGouP4KlYQ=; b=aLvSRtAELfllk/HO0WXRG0SeoWuQCM/pLgmlDM3fyWycl+x3cUivgdgQDbP87nL6Q6 9bXbOHaO6vKHgqMaduW0/pjZ8kCGvS41zRlVAFLlL0X2NAQGECtYcss+lqeVikQmSxgC a6Zh5QewVK1NNQrzrkzSXcyql3YxrGIxLyNK39M3WB5uOmisVQLzQrVFB8fxVhpoCJoo q3rwcOm/T3BVGUhFNusNSsImCsyJ6CVpe3Ta+3A1cX33/7luuo0Jd5AvLepvfnJu80zp CNDJIFwRBqrwRsrMkdNO8Fh2i08446jWaKl4f0RGKqVCiDn8OjMTvraqprHksZlpHnh+ sZ5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cu24si6249772pjb.132.2021.04.16.10.59.55; Fri, 16 Apr 2021 11:00:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344114AbhDPPmY (ORCPT + 99 others); Fri, 16 Apr 2021 11:42:24 -0400 Received: from mga07.intel.com ([134.134.136.100]:3339 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343961AbhDPPmK (ORCPT ); Fri, 16 Apr 2021 11:42:10 -0400 IronPort-SDR: xXrc7HYIwZTDsgwF1KUCZWZZFNKqHukzxVxjwAPQjmDg2wph8cdNfwSUYaEVXnLXkEGI5a0rwG 6kN1Wfxoa3zg== X-IronPort-AV: E=McAfee;i="6200,9189,9956"; a="259013598" X-IronPort-AV: E=Sophos;i="5.82,226,1613462400"; d="scan'208";a="259013598" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2021 08:41:43 -0700 IronPort-SDR: smzvmzhAz7siSWzlCg7OhYyupxhl2DWlKLBDXV9vxp3jd807ASXENtwiD31DJV3hL/ZKXosc7a d9bJxAknmEZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,226,1613462400"; d="scan'208";a="533495256" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 16 Apr 2021 08:41:37 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 2964030E; Fri, 16 Apr 2021 18:41:50 +0300 (EEST) From: "Kirill A. Shutemov" To: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Sean Christopherson , Jim Mattson Cc: David Rientjes , "Edgecombe, Rick P" , "Kleen, Andi" , "Yamahata, Isaku" , Erdem Aktas , Steve Rutherford , Peter Gonda , David Hildenbrand , x86@kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [RFCv2 09/13] shmem: Fail shmem_getpage_gfp() on poisoned pages Date: Fri, 16 Apr 2021 18:41:02 +0300 Message-Id: <20210416154106.23721-10-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210416154106.23721-1-kirill.shutemov@linux.intel.com> References: <20210416154106.23721-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Forbid access to poisoned pages. TODO: Probably more fine-grained approach is needed. It shuld be a allowed to fault-in these pages as hwpoison entries. Not-Signed-off-by: Kirill A. Shutemov --- mm/shmem.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/shmem.c b/mm/shmem.c index 7c6b6d8f6c39..d29a0c9be19c 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1832,6 +1832,13 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index, if (page) hindex = page->index; + + if (page && PageHWPoison(page)) { + unlock_page(page); + put_page(page); + return -EIO; + } + if (page && sgp == SGP_WRITE) mark_page_accessed(page); -- 2.26.3