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.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 E8468C07E95 for ; Wed, 7 Jul 2021 10:35:40 +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 AD69E61C60 for ; Wed, 7 Jul 2021 10:35:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD69E61C60 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=ACULAB.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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GAZJFBzkHxtNHcouAcbBcDgmOgdDk65vwMW9V5D5Z1w=; b=SliRG53Ctn1Y+s uAyilHx8nyNftyf3DI8ngI9belZEbtzhIp7HHcX92uzT1l7zG+fbqsixeNo93CEdqiteInvyi0k7m J3LIIijxYGQyEN/VKbnKI6oT0pFAkXBZm7V4EVtTaQ9P3tIiyFPfJpD3MnxYKQWm3vPzCzeSTI2lh 0TKLNu9uoBYji3Z9m7g0cFlvbZzvA72qkOlsdraKgHVb9Mw12RgNRSh0WpnU+lgKxqOnBMokNZYNn HorgelcAhe6xmaaz0cfDQJKYkxH/UC+KbqeBjuY7E8IKt07UameUv5vgOoulH193qECXNzOFYmyBv VbJtONVBonBVfUBJcP7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m14ri-00EUxV-Mi; Wed, 07 Jul 2021 10:33:16 +0000 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.85.151]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m14HO-00EMUa-Gm for linux-arm-kernel@lists.infradead.org; Wed, 07 Jul 2021 09:55:44 +0000 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-168-w7_5D2ULM7Sj_pMeGe5qtA-1; Wed, 07 Jul 2021 10:55:36 +0100 X-MC-Unique: w7_5D2ULM7Sj_pMeGe5qtA-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 7 Jul 2021 10:55:35 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.018; Wed, 7 Jul 2021 10:55:35 +0100 From: David Laight To: 'Robin Murphy' , Catalin Marinas CC: Chen Huang , Al Viro , Matthew Wilcox , Christoph Hellwig , Mark Rutland , Andrew Morton , Stephen Rothwell , "Randy Dunlap" , Will Deacon , Linux ARM , linux-mm , "open list" Subject: RE: [BUG] arm64: an infinite loop in generic_perform_write() Thread-Topic: [BUG] arm64: an infinite loop in generic_perform_write() Thread-Index: AQHXcpt1OwfjX4VCyEKfx+OvZYZ3DKs3RYEQ Date: Wed, 7 Jul 2021 09:55:35 +0000 Message-ID: <4a1473fc5af9496e9c8ed02c7f631d72@AcuMS.aculab.com> References: <1c635945-fb25-8871-7b34-f475f75b2caf@huawei.com> <27fbb8c1-2a65-738f-6bec-13f450395ab7@arm.com> <20210624185554.GC25097@arm.com> <20210625103905.GA20835@arm.com> <7f14271a-9b2f-1afc-3caf-c4e5b36efa73@arm.com> <20210706175052.GD15218@arm.com> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210707_025542_952515_B8B57385 X-CRM114-Status: GOOD ( 13.81 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > > I think it's worth doing the copy_to_user() fallback in a loop until it > > faults or hits the end of the buffer. This would solve the problem we > > currently have with writing more bytes than actually reported. The > > copy_from_user() is not necessary, a byte would suffice. > > The thing is, we don't really have that problem since the set_fs cleanup > removed IMP-DEF STP behaviour from the picture - even with the current > mess we could perfectly well know which of the two STTRs faulted if we ... There is a much more interesting case though. It is possible for userspace to have supplied a misaligned buffer that is mmapped to an IO address that doesn't support misaligned accesses even though normal memory does support them. So the 'byte retry' loop would work for the entire buffer. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel