Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2046492pxu; Tue, 24 Nov 2020 15:46:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJykLyG888GKb/u6cU6rNCmHVA7E8/9ikagkU/nZp0TOb+kMaQmGYGMGvMOmJ2L+xPh00utO X-Received: by 2002:a50:9fe6:: with SMTP id c93mr991812edf.30.1606261565385; Tue, 24 Nov 2020 15:46:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606261565; cv=none; d=google.com; s=arc-20160816; b=Zz5wEBEj88tkkrxf9gz2brR6tBqnw9X39lfDn3iNXFdaPMCkdWw74CKyj6scLns9oS Roull7WiUEjvEv65rH0JruxDMo9YKl0cfU8QrUaq7OCCruKWxTzyM0JJWtsQSCYWxaVJ HqRgdUw+6SP5YX5y+tmXmFxM77jvJRC2QGOIrSRhGTIkIUTOjnWnhawfIvta+XSVq0ai p/y7JKHdqeC0mVJ2tw86iWw39kr7+0NKQ1u5DkJVnGPZjq/MYjOXyA8246196Ybw7AFs ApW+Q6EEPbOSTysQMVWbo+nmEUNCns570Arwr0bTkNZtNGUUfCsfaGjxaxSfhj7vsrU/ pU4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=21CneeHv4WjigQFLsDRnBPjDyqomDe8iqs+F8eXUq54=; b=TlkvO1je3TlfxAMeM6MLeDYtc5RvdHkCBI8PoTanH3k2LcHcMo0nYYygprmIRPAXtB GPgbqlfeBU4kSa4ZTfNfXnM7ViqkR5LTYjr897hUzadL3CU+thLwIGCLy0aG2GfV93jt gLv/JBAbsF22HDSuUT68WBxLTMKfeC3/sckoijxIpC3LJfJeEVgC0VHQIqajbx/kEj9D X5AwbJjOxVtUWbzRvc2eH2g84s9dr2bhcWG3hZcMcxE5OUfVUdcq9TZW9XqteyACzPKh feLvduxnDbQZODGBoQxlHJrOvNtDL5HOv47p0NjChJZm4rGhxa08I/HwwYQETnnUrQ0I 7Vwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=YNuNJPCq; dkim=neutral (no key) header.i=@linutronix.de header.b=5oMOmvZi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j11si150309edy.158.2020.11.24.15.45.42; Tue, 24 Nov 2020 15:46:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=YNuNJPCq; dkim=neutral (no key) header.i=@linutronix.de header.b=5oMOmvZi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390594AbgKXRQd (ORCPT + 99 others); Tue, 24 Nov 2020 12:16:33 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:44554 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728342AbgKXRQd (ORCPT ); Tue, 24 Nov 2020 12:16:33 -0500 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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