Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp641324ybm; Fri, 29 May 2020 08:41:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5ES8ewn5LpUI3u8tkBJRicy8pGQepwidc9jXFqGzSw/IDnKStlXRobYfXtLxmW3UJkdDK X-Received: by 2002:a17:906:6403:: with SMTP id d3mr714631ejm.386.1590766883651; Fri, 29 May 2020 08:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590766883; cv=none; d=google.com; s=arc-20160816; b=0DABFi68yBWAtlTFmqCuglm1KmcnY5oGH3Rp9roMq7roe6GUtf+Lajy4kxg4KuQVty chlG16srpUhlP+4LuvySbxwEXQKysKCUzxC1Xjtpf7ijMwJHxuX0SwGjwfhxJC//mELy 4MPb3odZMGcDvJwoyuVt8UTv+xBDG4+h2CWA4y5JUC00hbCMDECzd6nFbsmk/tYCrQbS aDgs7YsN0nZDhGVDvqAzupJtB9ypGV/LgcWqJUXRUdWjG6UjLaRylOJaTSUovsLMk5SR Pu3AUG8+GbQeqF0x8PR1emfOdDrwPbgbOa+XPFdzTQ9SI7mO1uhlAX2vqNAkuhAdgiaO j+tA== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=1tEbznE7GPyi5vxGkUdkj2fXduM4GFl/YrBsPKCo9CA=; b=MBlyv11Etbbnt/zO618vF0M7CjaZZpNexUGQfKVcyC93QGU8iTPzK/Dn4WcSS2omUH 97IVS0yLP6v76V01Ohoe7ig7750V11wqCT5yDD8TthUtmlqGAm9JYqRaLzeqEA+HNGJd wW7hKhN/nR3jlVfBQFvvPIZzwwc8nzEvTqcXwrxrGek5Cmw3x2GsK0UcO5PeXRrz2gyh fSrnXglMwBEoO2Os3WwapuGLHVPWsX9TSTs/RFAaj8YlKXgk2BcfdnJPLfR7N0KTBcyi LP4s3lWWWRQXJn51j0xREazBNnh7LnzCvjHQZLMFA+IJnaRKsOoX69crhK53x8aCkzDn kgbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TYXSpijQ; 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=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j7si5576002eja.739.2020.05.29.08.41.00; Fri, 29 May 2020 08:41:23 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=TYXSpijQ; 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=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727771AbgE2Piw (ORCPT + 99 others); Fri, 29 May 2020 11:38:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726898AbgE2Piv (ORCPT ); Fri, 29 May 2020 11:38:51 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63CC0C03E969; Fri, 29 May 2020 08:38:51 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id x6so4081070wrm.13; Fri, 29 May 2020 08:38:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=1tEbznE7GPyi5vxGkUdkj2fXduM4GFl/YrBsPKCo9CA=; b=TYXSpijQp6tJoiJdhYEW4Jw3jvpk8DkeMWyyGdINQljk/2dgA76uZ2NP4J8puHM4Ma aFkbcLf9yZOLNbS/2YcCqd+QG7Fv/e9UEFn3IBIPdaeXx6kfMI/gzWgv4tmsU6kkGzND CyrvUnZUtaknH8RNFC1KWKnUgu5nigiIxPU37jGxN9rNha0skrECqjKQnKM7sa/kkxQ8 9j2pgKjj7kqGJeqYO3E4pXhdIk397f7A9nGi0ySqynIZNUxqQvCf2VysJJ0Vul06Spty 8cpGNa6q3HPBnVnB/ejHcKg1wtcdcBAd6AEIrfvAjqIb6E89befpUx5s14fIfkK0ClMu I14g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=1tEbznE7GPyi5vxGkUdkj2fXduM4GFl/YrBsPKCo9CA=; b=cy/5PWjN6kTk+qiYnQHJatDvWYAxTKC2vGWagZQBheGaei9YbGXgzp/NK524ToiglS mV0opzPptVYH3T5oLotCQRI42qHfBvGG+61DrcpewRQnGQSctnkDiLQR0Xin7rnPcZGY DNhkrOYZUZv99SEaxCQNM1dvbJvAN9geolp+jloew59ia9MAliMlrj3X9EPo9gyle33Z 50JJUQhmX2dTmCq16rZGJPK5B37Vvni1FwgmPtrMJjs5etA1KGakwwjHnXhKmjPlXAYP yjXvpPe+wZrQdIglRotb8Ws5nh/l3Q6V/t7MihAIWtlYa6ESd6JqBTnWOP29sKye6qcQ ovKA== X-Gm-Message-State: AOAM530vQ8pCtu04UFYTqfMJblMv2IMziEEw3otsCUCFXXKgJqOjrOVE iPpb/NHH0loEI+CvDncdTmPcSYyEiWPgHq+lBmc= X-Received: by 2002:adf:f552:: with SMTP id j18mr8811605wrp.279.1590766730133; Fri, 29 May 2020 08:38:50 -0700 (PDT) MIME-Version: 1.0 References: <20200529131452.pgj7mx7xaz7n4kz3@linutronix.de> In-Reply-To: <20200529131452.pgj7mx7xaz7n4kz3@linutronix.de> From: Mark Marshall Date: Fri, 29 May 2020 17:38:39 +0200 Message-ID: Subject: Re: Kernel crash due to memory corruption with v5.4.26-rt17 and PowerPC e500 To: Sebastian Andrzej Siewior Cc: linux-rt-users , Mark Marshall , thomas.graziadei@omicronenergy.com, Thomas Gleixner , linux-kernel@vger.kernel.org, rostedt@goodmis.org 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 Hi Sebastian & list, I had assumed that my e-mail had got lost or overlooked, I was meaning to post a follow up message this week... All I could find from the debugging and tracing that we added was that something was going wrong with the mm data structures somewhere in the exec code. In the end I just spent a week or two pouring over the diffs of this code between the versions that I new worked and didn't work. I eventually found the culprit. On the working kernel versions there is a patch called "mm: Protect activate_mm() by preempt_[disable&enable]_rt()"= . This is commit f0b4a9cb253a on the V4.19.82-rt30 branch, for instance. Although the commit message talks about ARM, it seems that we need this for PowerPC too (I guess, any PowerPC with the "nohash" MMU?). Could you please add this commit back to the RT branch? I'm not sure how to find out the history of this commit. For instance, why has it been removed from the RT patchset? How are these things tracked, generally? Best regards, Mark On Fri, 29 May 2020 at 15:14, Sebastian Andrzej Siewior wrote: > > On 2020-05-04 11:40:08 [+0200], Mark Marshall wrote: > > The easiest way we have found to reproduce the crash is to repeatedly > > insert and then remove a module. The crash then appears to be related > > to either paging in the module or in exiting the mdev process. (The > > crash does also happen at other times, but it is hard to reproduce > > reliably then). This simple script will almost always crash: > > > > for i in $(seq 1000) ; do echo $i ; modprobe crc7 ; rmmod crc7 ; don= e > > So I tried that on 5.6.14-rt7 with the qemu version of e500 (the SMP and > UP version). No luck. I don't have anything with real hardware. > Could you share the .config in case this is related? > > > (The crc7 module is chosen as it is small and simple. Any module will > > work / crash). > > > > We have tried kernels v5.0, v5.2 and v5.6. The v5.0 and v5.2 kernels > > do not show the problem. The v5.6 kernel does show the problem. > > Switching of RT fixes the problem. > > > > I have reduced the functionality in the kernel to a bare minimum > > (removing networking, USB and PCI, as we have some out-of-tree patches > > in those areas) and we still get the crash. > =E2=80=A6 > > I have added some debugging code where the mm_struct and > > vma_area_struct have "poision" values at the start and the end, and > > this seems to show that the vma_area_struct is getting corrupted, but > > I'm not able to see where. > > oh. > > > We have switched on all of the debugging that we can, including > > KASAN, and this shows nothing. > > > > > > Can anyone help us? What can we try next? Is anyone using the e500 > > with the RT kernel? Does anyone have any idea how to debug problems > > related to the error message "Bad rss-counter state"? > > > > Any help or advice would be most gratefully received. > > I don't have any ideas. You could try to apply only a part of the RT > patch and see if it problem is still there. If you are lucky you find > the patch that introduces the problem. If not, the problem appears with > the RT switch=E2=80=A6 > > > Many thanks, > > Mark Marshall and Thomas Graziadei > > Sebastian