From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8FF0C433F5 for ; Mon, 25 Apr 2022 07:45:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 760668D0011; Mon, 25 Apr 2022 03:45:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 70F5A8D0006; Mon, 25 Apr 2022 03:45:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D71F8D0011; Mon, 25 Apr 2022 03:45:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 4F64D8D0006 for ; Mon, 25 Apr 2022 03:45:37 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1B88722929 for ; Mon, 25 Apr 2022 07:45:37 +0000 (UTC) X-FDA: 79394616714.17.43928B7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf27.hostedemail.com (Postfix) with ESMTP id 4CEC640039 for ; Mon, 25 Apr 2022 07:45:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650872735; 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=tpWZgiPbAxsqPPPmhkGAZAhjYuoPx+itMj+31Vjm+VU=; b=Nj2M5LJLHwafiblFyP3vO9memNTBGfqwLAuQyMQnmTg6I6c8rP54wvm+ZAYE0qogISHR7F lb4/1x07dE9P2eZArbK6/IYWINyiQfRxAkI17sUofKj4e+MXefTxa7/kp9+UL5s0PjkuaH L4BJopBjpK9x5DXAHxSXy/STRboCWSM= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-581-aoAahNhNPMSY1nf2j7-pAA-1; Mon, 25 Apr 2022 03:45:34 -0400 X-MC-Unique: aoAahNhNPMSY1nf2j7-pAA-1 Received: by mail-wm1-f69.google.com with SMTP id q188-20020a1c43c5000000b003928f679c42so6423507wma.5 for ; Mon, 25 Apr 2022 00:45:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=tpWZgiPbAxsqPPPmhkGAZAhjYuoPx+itMj+31Vjm+VU=; b=ETv395Y1YEeTsoU+tSXYJ/TkA5sjmKfcchUHViq/K/eX9tJNx7nbhjgLnxeT7c2GSd 9ksc5pPMXU8OPGZFf4T56KJGCRor6UbXk/F4n8sQZYDV2qWmdWH6XcKftl1zOsUoIKKt CUx5IdUS0BHrKmV+F2vdT6QSWaKImEJP/x56mS5zryOOG1kHLHI/56/IIbv1I3FhvSPA PdS997WLCr4RzyVnulzUbjKnLyLimoOJY0UILJLF/gVvuy8nhS3Mc256RCfRvhOOKxpn hAVSUIHdqtISu+W7cPDRqsfRqhKpKLbiEqjqZd6E8jpIfzVhAGywjjvghM3BF1GMRjTc IBxg== X-Gm-Message-State: AOAM530xSjDYlUJqY/jBYsoQKSmZya1ZZq06FGncjyKxkYo88WhTljqx WVCnwdcntBeB3sORx3XdpQZGAu+9zyLvFjKjDtbC9t6aONRKHT3korIK31qRACa+u+96xEnfiX3 Irc0UMM6gcDU= X-Received: by 2002:a05:600c:1e09:b0:390:f313:bf15 with SMTP id ay9-20020a05600c1e0900b00390f313bf15mr24733911wmb.172.1650872733593; Mon, 25 Apr 2022 00:45:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVJnHaO9F/y9ZuWWcrcXXk1YwuRc7TsAX+Zeq7Nao24gvi2VH1SFP3lFk3t8yQ2He/EDlNkA== X-Received: by 2002:a05:600c:1e09:b0:390:f313:bf15 with SMTP id ay9-20020a05600c1e0900b00390f313bf15mr24733887wmb.172.1650872733344; Mon, 25 Apr 2022 00:45:33 -0700 (PDT) Received: from ?IPV6:2003:cb:c700:fc00:490d:ed6a:8b22:223a? (p200300cbc700fc00490ded6a8b22223a.dip0.t-ipconnect.de. [2003:cb:c700:fc00:490d:ed6a:8b22:223a]) by smtp.gmail.com with ESMTPSA id bg26-20020a05600c3c9a00b00393e997c657sm3145948wmb.37.2022.04.25.00.45.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Apr 2022 00:45:32 -0700 (PDT) Message-ID: Date: Mon, 25 Apr 2022 09:45:31 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 To: =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , Miaohe Lin Cc: "akpm@linux-foundation.org" , "willy@infradead.org" , "vbabka@suse.cz" , "dhowells@redhat.com" , "neilb@suse.de" , "apopple@nvidia.com" , "surenb@google.com" , "minchan@kernel.org" , "peterx@redhat.com" , "sfr@canb.auug.org.au" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" References: <20220424091105.48374-1-linmiaohe@huawei.com> <20220424091105.48374-2-linmiaohe@huawei.com> <20220425010804.GA3746096@hori.linux.bs1.fc.nec.co.jp> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v3 1/3] mm/swapfile: unuse_pte can map random data if swap read fails In-Reply-To: <20220425010804.GA3746096@hori.linux.bs1.fc.nec.co.jp> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 4CEC640039 X-Stat-Signature: xeyrabf35n17azjdo7ixu5ta5x4o54kb X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Nj2M5LJL; spf=none (imf27.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1650872735-887710 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 25.04.22 03:08, HORIGUCHI NAOYA(堀口 直也) wrote: > On Sun, Apr 24, 2022 at 05:11:03PM +0800, Miaohe Lin wrote: >> There is a bug in unuse_pte(): when swap page happens to be unreadable, >> page filled with random data is mapped into user address space. In case >> of error, a special swap entry indicating swap read fails is set to the >> page table. So the swapcache page can be freed and the user won't end up >> with a permanently mounted swap because a sector is bad. And if the page >> is accessed later, the user process will be killed so that corrupted data >> is never consumed. On the other hand, if the page is never accessed, the >> user won't even notice it. >> >> Signed-off-by: Miaohe Lin >> Acked-by: David Hildenbrand > > Hi Miaohe, > > This bug sounds relatively serious to me, and it seems old, so is it worth > sending to -stable? I'm not sure if this is worth -stable, but no strong opinion. The do_swap_page() part was added in 2005: commit b81074800b98ac50b64d4c8d34e8abf0fda5e3d1 Author: Kirill Korotaev Date: Mon May 16 21:53:50 2005 -0700 [PATCH] do_swap_page() can map random data if swap read fails There is a bug in do_swap_page(): when swap page happens to be unreadable, page filled with random data is mapped into user address space. The fix is to check for PageUptodate and send SIGBUS in case of error. Signed-Off-By: Kirill Korotaev Signed-Off-By: Alexey Kuznetsov Acked-by: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds So the do_swap_page() part has been fixed for quite a while already. -- Thanks, David / dhildenb