Received: by 10.223.185.116 with SMTP id b49csp3813340wrg; Mon, 19 Feb 2018 06:28:45 -0800 (PST) X-Google-Smtp-Source: AH8x227tKQacEm4r9x8M3M5cfo8fGZHNDCWv5+7Gp7pVp8Y/a30qDPRtDdvwhe5XhlEx6aRVs2wI X-Received: by 10.99.122.71 with SMTP id j7mr12323267pgn.151.1519050525135; Mon, 19 Feb 2018 06:28:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519050525; cv=none; d=google.com; s=arc-20160816; b=wGluWIrV3lz9qvvY3TYC4zp2TdolqnSY81AQi7xVLiVzg6Vooqu7ZS9mLMPR8ctcX+ yvYHxOPtKSRpPHL81sxfqpMeM37oqNMo6Bwd3l1nYM0IWtbJ9cql54HYouMlMADclyk1 4Q0VsbOQhtpyjt60U0vrwEQ/Ft4RSkVhD2giFTt8cWvtwET67RtAD3KpKrzDY4KHYdWk 23/eC6+XNcManqbS+u8a/RokMpADdlaxnrH9E5ODKblJ0Y6H1lRcgMka962DHXORq4mc yd4yKq7BhspBrPyJjls9T5SSOc7f2w1UgOcWo4bmuvScdv+bkA9DzbT1cxImW3PEl2Lb Sfhg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=WotMDWRS6Lf74C4PR6OBTGANO5/6xf9AtKaAPfk77NE=; b=gZtG5uuahj06RBjB99ldUBZW/HQQP3Ci3QpXmnNVvLsO2Blao0xvyY9x9NxGRUVf+g hskQ4vHYmxZmuX2BdM5iEpzzvsptDctipaPgOtl+HXljjyXMC72tG987RDifss/hTwRe H/0Cc/vsNjLM5UW8SxE2WQ5iYl2E5SbjRRU3Ka1ZfWpc2gdtvzBWAol7xO/fXWXmS2UL XXzGy7hKjKFmf9LG387qri3MRwvSYQH9uQ113/Bq4ZMevfamUi4wYuNsQ9h0+ITO1hHX 6/qDzR/Vb1Rw95TzLplNkmtJjPOWoYyy9iXovWzqm7zgwmeyjWUDfg+S2Iml42hTOTYO O/2A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u6si861488pfd.236.2018.02.19.06.28.29; Mon, 19 Feb 2018 06:28:45 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752142AbeBSO0Y (ORCPT + 99 others); Mon, 19 Feb 2018 09:26:24 -0500 Received: from wp227.webpack.hosteurope.de ([80.237.132.234]:59464 "EHLO wp227.webpack.hosteurope.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750978AbeBSO0X (ORCPT ); Mon, 19 Feb 2018 09:26:23 -0500 Received: from ip4d15e3ad.dynamic.kabel-deutschland.de ([77.21.227.173] helo=[192.168.66.118]); authenticated by wp227.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1enljz-0007ar-MW; Mon, 19 Feb 2018 14:44:23 +0100 Subject: Re: DM Regression in 4.16-rc1 - read() returns data when it shouldn't To: Milan Broz , NeilBrown , Mike Snitzer , device-mapper development Cc: Linux Kernel Mailing List References: <70cda2a3-f246-d45b-f600-1f9d15ba22ff@gmail.com> From: Thorsten Leemhuis Message-ID: <5fca4e3f-536c-9c52-31bb-927e8ab5b6c8@leemhuis.info> Date: Mon, 19 Feb 2018 14:44:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <70cda2a3-f246-d45b-f600-1f9d15ba22ff@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-MW Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;regressions@leemhuis.info;1519050383;d4a060d7; X-HE-SMSGID: 1enljz-0007ar-MW Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org JFYI: This issues is tracked in the regression reports for Linux 4.16 (http://bit.ly/lnxregrep416 ) with this id: Linux-Regression-ID: lr#9e195f Please include this line in the comment section of patches that are supposed to fix the issue. Please also mention the string once in other mailinglist threads or different bug tracking entries if you or someone else start to discuss the issue there. By including that string you make it a whole lot easier to track where an issue gets discussed and how far patches to fix it have made it. For more details on this please see here: http://bit.ly/lnxregtrackid Thx for your help. Ciao, Thorsten On 14.02.2018 14:02, Milan Broz wrote: > Hi, > > the commit (found by bisect) > > commit 18a25da84354c6bb655320de6072c00eda6eb602 > Author: NeilBrown > Date: Wed Sep 6 09:43:28 2017 +1000 > > dm: ensure bio submission follows a depth-first tree walk > > cause serious regression while reading from DM device. > > The reproducer is below, basically it tries to simulate failure we see in cryptsetup > regression test: we have DM device with error and zero target and try to read > "passphrase" from it (it is test for 64 bit offset error path): > > Test device: > # dmsetup table test > 0 10000000 error > 10000000 1000000 zero > > We try to run this operation: > lseek64(fd, 5119999988, SEEK_CUR); // this should seek to error target sector > read(fd, buf, 13); // this should fail, if we seek to error part of the device > > While on 4.15 the read properly fails: > Seek returned 5119999988. > Read returned -1. > > for 4.16 it actually succeeds returning some random data > (perhaps kernel memory, so this bug is even more dangerous): > Seek returned 5119999988. > Read returned 13. > > Full reproducer below: > > #define _GNU_SOURCE > #define _LARGEFILE64_SOURCE > #include > #include > #include > #include > #include > #include > #include > > int main (int argc, char *argv[]) > { > char buf[13]; > int fd; > //uint64_t offset64 = 5119999999; > uint64_t offset64 = 5119999988; > off64_t r; > ssize_t bytes; > > system("echo -e \'0 10000000 error\'\\\\n\'10000000 1000000 zero\' | dmsetup create test"); > > fd = open("/dev/mapper/test", O_RDONLY); > if (fd == -1) { > printf("open fail\n"); > return 1; > } > > r = lseek64(fd, offset64, SEEK_CUR); > printf("Seek returned %" PRIu64 ".\n", r); > if (r < 0) { > printf("seek fail\n"); > close(fd); > return 2; > } > > bytes = read(fd, buf, 13); > printf("Read returned %d.\n", (int)bytes); > > close(fd); > return 0; > } > > > Please let me know if you need more info to reproduce it. > > Milan > > http://news.gmane.org/find-root.php?message_id=70cda2a3-f246-d45b-f600-1f9d15ba22ff%40gmail.com > http://mid.gmane.org/70cda2a3-f246-d45b-f600-1f9d15ba22ff%40gmail.com >