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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 B12F6C63777 for ; Tue, 24 Nov 2020 17:18:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0C1CE20637 for ; Tue, 24 Nov 2020 17:18:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="YNuNJPCq"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="5oMOmvZi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C1CE20637 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2C2A36B0070; Tue, 24 Nov 2020 12:18:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 273FE6B0071; Tue, 24 Nov 2020 12:18:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18A7A6B0073; Tue, 24 Nov 2020 12:18:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0230.hostedemail.com [216.40.44.230]) by kanga.kvack.org (Postfix) with ESMTP id 01E766B0070 for ; Tue, 24 Nov 2020 12:18:14 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id AF9311EE6 for ; Tue, 24 Nov 2020 17:18:14 +0000 (UTC) X-FDA: 77519970108.12.loss13_09123cc2736f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 76F8E1802AD42 for ; Tue, 24 Nov 2020 17:16:46 +0000 (UTC) X-HE-Tag: loss13_09123cc2736f X-Filterd-Recvd-Size: 4573 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Nov 2020 17:16:37 +0000 (UTC) Date: Tue, 24 Nov 2020 18:16:28 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1606238190; 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: in-reply-to:in-reply-to:references:references; bh=21CneeHv4WjigQFLsDRnBPjDyqomDe8iqs+F8eXUq54=; b=YNuNJPCqi1woBBDIVq9RGDhGKE6iS0zVkDg/F+0aJMJ0GY5xTotuc0YTbaaoOBOj4GJ55+ Gq+cffSqonZhuVk0cyn+hqZxeb1PQNAscVhFfR13mG0F6nBjyzWpwWcGWgM9+2bDYlgKGM 8aYGROcTmFdhOjzOxKT9NhzhHZiPQkH6B6T04lOXv3sdkt0zcQ1SreZRl4z/KoxQw8DIXw 4jJhy4udc8nLLigI1DXPlSR8/lNCeRoSYVRKXLqsfAqELDICFn6jaZvr9MnqvgiGIi6j1b 6v0XS65uq0uQUjbeoaKovB4FmWzoCzg3CLVwOdWv9adlVMvh0zcyRqzP3NsM9w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1606238190; 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: in-reply-to:in-reply-to:references:references; bh=21CneeHv4WjigQFLsDRnBPjDyqomDe8iqs+F8eXUq54=; b=5oMOmvZiz3+HJ0TFxE+1+ihsPdEcvXf76vE9EuoLCpFxRMC2ycJ9jAKLjiw2kZYcDmtSfZ 4t6U78aUx76DFyCQ== From: Sebastian Andrzej Siewior To: Naresh Kamboju Cc: open list , Linux-Next Mailing List , linux-mm , lkft-triage@lists.linaro.org, LTP List , "Matthew Wilcox (Oracle)" , Andrew Morton , torvalds@linuxfoundation.org, Yang Shi , Jan Kara , Michal Hocko , Thomas Gleixner , Mel Gorman , Song Liu , Zi Yan , vtolkm@googlemail.com, Marek Szyprowski , Arnd Bergmann Subject: Re: kernel BUG at mm/highmem.c:417! invalid opcode: 0000 EIP: zero_user_segments Message-ID: <20201124171628.dk6tle5lh3sx2jxg@linutronix.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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 2020-11-24 18:52:44 [+0530], Naresh Kamboju wrote: > While running LTP test case access01 the following kernel BUG > noticed on linux next 20201124 tag kernel on i386. > > git short log: > ---------------- > git log --oneline next-20201120..next-20201124 -- mm/highmem.c > d9927d46febf Merge branch 'akpm-current/current' > 72d22a0d0e86 mm: support THPs in zero_user_segments > 2a656cad337e mm/highmem: Take kmap_high_get() properly into account > > Please find these easy steps to reproduce the kernel build and boot. This BUG_ON() is in zero_user_segments() which ash been added in commit 72d22a0d0e86 mm: support THPs in zero_user_segments > [ 50.852189] kernel BUG at mm/highmem.c:417! I managed to capture one invocation with: zero_user_segments(0xd4367a90, 0x1000, 0x1000, 0x0, 0x50) page_compound() -> 1 page_size() -> 4096 And at the end it BUGs because end2 is still 0x50. because: | for (i = 0; i < compound_nr(page); i++) { | void *kaddr; | unsigned this_end; | | if (end1 == 0 && start2 >= PAGE_SIZE) { | start2 -= PAGE_SIZE; | end2 -= PAGE_SIZE; | continue; | } | | if (start1 >= PAGE_SIZE) { start1 0x1000 is >= PAGE_SIZE. | start1 -= PAGE_SIZE; | end1 -= PAGE_SIZE; | if (start2) { start2 is 0. | start2 -= PAGE_SIZE; | end2 -= PAGE_SIZE; | } | continue; | } I don't know why the logic for start1/end1 and start2/end2 is coupled here. Based on how __block_write_begin_int() invokes it seems to zero two independent blocks (or it is a bug in caller). The generic implementation would do nothing for start1/end1 and for second part if would memset(page + 0, 0, 0x50 - 0). Sebastian