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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81343C4743C for ; Wed, 23 Jun 2021 03:25:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5CE1060FDC for ; Wed, 23 Jun 2021 03:25:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230205AbhFWD1W (ORCPT ); Tue, 22 Jun 2021 23:27:22 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:11083 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbhFWD1V (ORCPT ); Tue, 22 Jun 2021 23:27:21 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4G8pTj2nBkzZhvD; Wed, 23 Jun 2021 11:22:01 +0800 (CST) Received: from dggema774-chm.china.huawei.com (10.1.198.216) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Wed, 23 Jun 2021 11:25:02 +0800 Received: from [10.67.102.197] (10.67.102.197) by dggema774-chm.china.huawei.com (10.1.198.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 23 Jun 2021 11:25:01 +0800 Subject: Re: [BUG] arm64: an infinite loop in generic_perform_write() To: Al Viro , Chen Huang CC: Andrew Morton , Stephen Rothwell , "Matthew Wilcox (Oracle)" , Randy Dunlap , Catalin Marinas , Will Deacon , Linux ARM , linux-mm , "open list" References: From: Xiaoming Ni Message-ID: <92fa298d-9d88-0ca4-40d9-13690dcd42f9@huawei.com> Date: Wed, 23 Jun 2021 11:24:54 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.0.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.102.197] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggema774-chm.china.huawei.com (10.1.198.216) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/6/23 10:50, Al Viro wrote: > On Wed, Jun 23, 2021 at 10:39:31AM +0800, Chen Huang wrote: > >> Then when kernel handles the alignment_fault, it will not panic. As the >> arm64 memory model spec said, when the address is not a multiple of the >> element size, the access is unaligned. Unaligned accesses are allowed to >> addresses marked as Normal, but not to Device regions. An unaligned access >> to a Device region will trigger an exception (alignment fault). >> >> do_alignment_fault >> do_bad_area >> __do_kernel_fault >> fixup_exception >> >> But that fixup cann't handle the unaligned copy, so the >> copy_page_from_iter_atomic returns 0 and traps in loop. > > Looks like you need to fix your raw_copy_from_user(), then... > . > Exit loop when iov_iter_copy_from_user_atomic() returns 0. This should solve the problem, too, and it's easier. Thanks. Xiaoming Ni 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 X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC414C4743C for ; Wed, 23 Jun 2021 03:26:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 465A06113B for ; Wed, 23 Jun 2021 03:26:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 465A06113B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:CC:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=U9F3mumMdX27DR3d1qUuSjD9TCZo8IeE+XGTsJe7wQQ=; b=XmV37kOKS9qh2qzrMe56DmZBEB Tg9GwpNF5662MoCxTChUlR4l/j+NPf0caKvGG2MlOVLgHF4F192GEa00K24s/qS3v0rDTe/HKu1dN jUqlIQdxmGe8B6U1HI8EEtNEjVYo+xusCKkTQ7x6RJvoL4aSpHuAxaziIv9j5YZlKYJkLnac/kFiv spaftZSWeCYchUxM5UCrrH78OYnDMXvKHbz7VeZz0c2E+AhUpgj8gBAWWIXiPxUwKzyyor4S74bEc S/+wNMJCCKA1i2LS/tHplT2IHKp/nVB1BAbvN4cvrvTBDmFc0MsL3/nwOdZE0XhCTxnt1VBKCZYC1 5e7KGXiw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lvtVq-0099Rf-Mc; Wed, 23 Jun 2021 03:25:14 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lvtVl-0099Po-9i for linux-arm-kernel@lists.infradead.org; Wed, 23 Jun 2021 03:25:12 +0000 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4G8pTj2nBkzZhvD; Wed, 23 Jun 2021 11:22:01 +0800 (CST) Received: from dggema774-chm.china.huawei.com (10.1.198.216) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Wed, 23 Jun 2021 11:25:02 +0800 Received: from [10.67.102.197] (10.67.102.197) by dggema774-chm.china.huawei.com (10.1.198.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 23 Jun 2021 11:25:01 +0800 Subject: Re: [BUG] arm64: an infinite loop in generic_perform_write() To: Al Viro , Chen Huang CC: Andrew Morton , Stephen Rothwell , "Matthew Wilcox (Oracle)" , Randy Dunlap , Catalin Marinas , Will Deacon , Linux ARM , linux-mm , "open list" References: From: Xiaoming Ni Message-ID: <92fa298d-9d88-0ca4-40d9-13690dcd42f9@huawei.com> Date: Wed, 23 Jun 2021 11:24:54 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.0.1 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.67.102.197] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggema774-chm.china.huawei.com (10.1.198.216) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210622_202509_552074_8D2EC4D8 X-CRM114-Status: GOOD ( 11.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021/6/23 10:50, Al Viro wrote: > On Wed, Jun 23, 2021 at 10:39:31AM +0800, Chen Huang wrote: > >> Then when kernel handles the alignment_fault, it will not panic. As the >> arm64 memory model spec said, when the address is not a multiple of the >> element size, the access is unaligned. Unaligned accesses are allowed to >> addresses marked as Normal, but not to Device regions. An unaligned access >> to a Device region will trigger an exception (alignment fault). >> >> do_alignment_fault >> do_bad_area >> __do_kernel_fault >> fixup_exception >> >> But that fixup cann't handle the unaligned copy, so the >> copy_page_from_iter_atomic returns 0 and traps in loop. > > Looks like you need to fix your raw_copy_from_user(), then... > . > Exit loop when iov_iter_copy_from_user_atomic() returns 0. This should solve the problem, too, and it's easier. Thanks. Xiaoming Ni _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel