Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1725957ybx; Thu, 7 Nov 2019 16:23:49 -0800 (PST) X-Google-Smtp-Source: APXvYqyI5VTfDK3stXN9ZcykPY4WODvp5uDPc1ktMhVccRrrZhQbJLGuF8lyK3TbP6J7antijo5y X-Received: by 2002:aa7:d4c6:: with SMTP id t6mr6882297edr.228.1573172629265; Thu, 07 Nov 2019 16:23:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573172629; cv=none; d=google.com; s=arc-20160816; b=oQUYOZj44v1wa5EhSEzh/i7N4jxQy7wtYurAwil7PJQUcItOkNM9r3t9QhSrN4rZXp +Zt2hnuLIOTmMVvFPaMZhOYwmyUxVqfmM21e+Xjn+ZGOeigvQOcR8MtYA8U1uDtmCJfW fLMpk5kHw3VMMJzKDIAuXpSKxFsj17pANjCIOFHAO9hCntegLpYu1SwAgRUwGLxt0CDC BAcFnyKm48pD76SYu44GjrmuRa6e3QkpVb/L9EaaW03rr9tC6yeHHuh6nciY4fl1Var8 TQ0vLkov2c48ZX4/dqyEeSpsSgIspFMv81auBU/h1BJ6lTHXEBmquAi6dI5eVCqp/vf9 XuXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:thread-index :thread-topic:mime-version:subject:references:in-reply-to:message-id :cc:to:from:date:dkim-signature; bh=5gCaMc6tX9QOhF6O+c6COJocW0Fk5ySJnwtoUCLt61c=; b=IA9Ph541vjVLPscGsvYQErgq2RX58VXCmbHjd2PE/FDO0PsTWmqprh7OfEsaIKK9jU tNI4aTZxFbWSLG6g5jjRBUTG2qN53+W5/vSroV5GOfEEcxpU47V66Vsfspwsoe/8LCxI sIMzOU7EK+t4MekbT5EMsX/lVrh4MxRP/9SfKSHGp4g2PSdQDH/iDRf1m8oJ4kBivf4+ t7XHgUztL8jxaEan0jTp+MOIIUUFEQzPGP2+P2QIQCS51PU50nv1q6GknJ787bos1EcM cLcaw56twjsZ37GHFup0tw3YGkzEjZ9/erKSSQtq10M5ii9N/ZkSUrOCySUA07OTi92e uAkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="HpVmfJD/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t18si2578394ejx.354.2019.11.07.16.23.25; Thu, 07 Nov 2019 16:23:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="HpVmfJD/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727511AbfKHAUv (ORCPT + 99 others); Thu, 7 Nov 2019 19:20:51 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:35724 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726054AbfKHAUu (ORCPT ); Thu, 7 Nov 2019 19:20:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573172449; 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=5gCaMc6tX9QOhF6O+c6COJocW0Fk5ySJnwtoUCLt61c=; b=HpVmfJD/DQBRv/cvvDjvriBP+VXRY5WTbazk7tug5xze4QzsM8kReqpiBwmnTi9Zo6RNrS 5ujPrW/W+JFqcUeZWSd9lC3OgHwJXH4OtpjYm5/am+u+YnXM5e0s7t5Y7dczZJnjXBG5Hi ipS3sbIx7yxsJ6S4aXnNXcMLaRd3oKk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-187-iBgSgiDTNUSAR9EJuJy-IQ-1; Thu, 07 Nov 2019 19:20:46 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 61750800C61; Fri, 8 Nov 2019 00:20:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4E05F5C3FD; Fri, 8 Nov 2019 00:20:44 +0000 (UTC) Received: from zmail17.collab.prod.int.phx2.redhat.com (zmail17.collab.prod.int.phx2.redhat.com [10.5.83.19]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BA74118095FF; Fri, 8 Nov 2019 00:20:43 +0000 (UTC) Date: Thu, 7 Nov 2019 19:20:43 -0500 (EST) From: Jan Stancek To: Naresh Kamboju , darrick.wong@oracle.com Cc: LTP List , Linux-Next Mailing List , linux-fsdevel@vger.kernel.org, chrubis , open list , Al Viro , Mark Brown , Arnd Bergmann , lkft-triage@lists.linaro.org Message-ID: <852514139.11036267.1573172443439.JavaMail.zimbra@redhat.com> In-Reply-To: References: Subject: Re: LTP: diotest4.c:476: read to read-only space. returns 0: Success MIME-Version: 1.0 X-Originating-IP: [10.43.17.163, 10.4.195.16] Thread-Topic: diotest4.c:476: read to read-only space. returns 0: Success Thread-Index: XegtwwjoOKT9tnnmixJeWQ/ZMQQAiQ== X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: iBgSgiDTNUSAR9EJuJy-IQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- Original Message ----- > LTP test case dio04 test failed on 32bit kernel running linux next > 20191107 kernel. > Linux version 5.4.0-rc6-next-20191107. >=20 > diotest4 1 TPASS : Negative Offset > diotest4 2 TPASS : removed > diotest4 3 TPASS : Odd count of read and write > diotest4 4 TPASS : Read beyond the file size > diotest4 5 TPASS : Invalid file descriptor > diotest4 6 TPASS : Out of range file descriptor > diotest4 7 TPASS : Closed file descriptor > diotest4 8 TPASS : removed > diotest4 9 TCONF : diotest4.c:345: Direct I/O on /dev/null is > not supported > diotest4 10 TPASS : read, write to a mmaped file > diotest4 11 TPASS : read, write to an unmapped file > diotest4 12 TPASS : read from file not open for reading > diotest4 13 TPASS : write to file not open for writing > diotest4 14 TPASS : read, write with non-aligned buffer > diotest4 15 TFAIL : diotest4.c:476: read to read-only space. > returns 0: Success > diotest4 16 TFAIL : diotest4.c:180: read, write buffer in read-only > space > diotest4 17 TFAIL : diotest4.c:114: read allows nonexistant > space. returns 0: Success > diotest4 18 TFAIL : diotest4.c:129: write allows nonexistant > space.returns -1: Invalid argument > diotest4 19 TFAIL : diotest4.c:180: read, write in non-existant spac= e > diotest4 20 TPASS : read, write for file with O_SYNC > diotest4 0 TINFO : 2/15 test blocks failed Smaller reproducer for 32-bit system and ext4 is: openat(AT_FDCWD, "testdata-4.5918", O_RDWR|O_DIRECT) =3D 4 mmap2(NULL, 4096, PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =3D 0xb7f7= b000 read(4, 0xb7f7b000, 4096) =3D 0 // expects -EFAULT Problem appears to be conversion in ternary operator at iomap_dio_bio_actor() return. Test passes for me with following tweak: diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index 2f88d64c2a4d..8615b1f78389 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -318,7 +318,7 @@ iomap_dio_bio_actor(struct inode *inode, loff_t pos, lo= ff_t length, if (pad) iomap_dio_zero(dio, iomap, pos, fs_block_size - pad= ); } - return copied ? copied : ret; + return copied ? (loff_t) copied : ret; } static loff_t