Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3610213pxf; Mon, 22 Mar 2021 10:24:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMKVyseDk2G6CZVPjKt3YilonDj49/r9+PVbut1IvlPoN1KDrDV3IULPG8OigLvOLQP6dF X-Received: by 2002:a05:6402:34d5:: with SMTP id w21mr743242edc.14.1616433870522; Mon, 22 Mar 2021 10:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616433870; cv=none; d=google.com; s=arc-20160816; b=vNjRiZES2zzCbWEn3lAboEHGuVErOeL+Egsnhl1eWZ4lp9ZEXglVdSsLn8dBiUUW3a iCuHCuLN53uWMzyHc2graVPI638txzifGKof/dpiwp0JNRnxkM0CX8Hq7H8gsYIpHjXy dSVmVw/7oooi7W36Nt/VozYI+eM3JbKstILqgzHDcclSCsyj41Vo+rTSxcKflKIrMJ/7 HmDIp0ZG6wd02IUL3gPw6mDTj6y0+i934KVaj9OWT0ut99T0yl0y7TzGxkjMSs+rNZyY 88IHUnDTxjjcrAlu7U+JxB+qCTEYzEptAocGd6J+0CbmodiLTEmzQdSn5xXXfW8HpX+z 8n1w== 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:date; bh=rPmnghON6luU91hxxM1XxmBW0RzUwJyLg6xY4jiye6E=; b=mEAkYtccf4kcr+Hggsr5qo0gYxpqlguR4IsVzZUD2LfZ5Px+nOzzIgm3RUGTqoTIij w11Agux5i3ybzvCnd8jLTa+wdIdxekw39J5NpnAPOSF7NY/LHqR3OwWQy3H+3cYEJoWo QlgLG2N2c/Pp3IHmcIZ8jFw9FgRBQ6vnGVaDoOiV54LNgrxNhFwqrf6hTV333R5fsGe3 QWGMaeEfRPw3ablCrXLl69bauyWk2mHInCcnYoECiOSjuDIFWY1MexjXsAOT9sdmxRTq iUXUxio2grh6riVmSjgNyX78vOFKhCcEs36QLcheMR7C48+GXQW2GhaiOpR7BIxoHx/N Yp7w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y101si12466825ede.101.2021.03.22.10.24.07; Mon, 22 Mar 2021 10:24:30 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231518AbhCVRW5 (ORCPT + 99 others); Mon, 22 Mar 2021 13:22:57 -0400 Received: from foss.arm.com ([217.140.110.172]:35788 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229987AbhCVRWq (ORCPT ); Mon, 22 Mar 2021 13:22:46 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 52A7A1063; Mon, 22 Mar 2021 10:22:46 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.23.154]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 05CB23F719; Mon, 22 Mar 2021 10:22:43 -0700 (PDT) Date: Mon, 22 Mar 2021 17:22:41 +0000 From: Mark Rutland To: Russell King - ARM Linux admin Cc: Dmitry Vyukov , syzbot , Arnd Bergmann , Linux ARM , Alexandre Chartre , LKML , Masami Hiramatsu , Peter Zijlstra , syzkaller-bugs , Thomas Gleixner Subject: Re: [syzbot] upstream boot error: WARNING in __context_tracking_enter Message-ID: <20210322172241.GB80352@C02TD0UTHF1T.local> References: <0000000000004f14c105bde08f75@google.com> <20210319101043.GU1463@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210319101043.GU1463@shell.armlinux.org.uk> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Russell, On Fri, Mar 19, 2021 at 10:10:43AM +0000, Russell King - ARM Linux admin wrote: > On Fri, Mar 19, 2021 at 10:54:48AM +0100, Dmitry Vyukov wrote: > > .On Fri, Mar 19, 2021 at 10:44 AM syzbot > > wrote: > > > syzbot found the following issue on: > > > > > > HEAD commit: 8b12a62a Merge tag 'drm-fixes-2021-03-19' of git://anongit.. > > > git tree: upstream > > > console output: https://syzkaller.appspot.com/x/log.txt?x=17e815aed00000 > > > kernel config: https://syzkaller.appspot.com/x/.config?x=cfeed364fc353c32 > > > dashboard link: https://syzkaller.appspot.com/bug?extid=f09a12b2c77bfbbf51bd > > > userspace arch: arm > > > > > > IMPORTANT: if you fix the issue, please add the following tag to the commit: > > > Reported-by: syzbot+f09a12b2c77bfbbf51bd@syzkaller.appspotmail.com > > > > > > +Mark, arm > > It did not get far with CONFIG_CONTEXT_TRACKING_FORCE (kernel doesn't boot). > > It seems that the path: > > context_tracking_user_enter() > user_enter() > context_tracking_enter() > __context_tracking_enter() > vtime_user_enter() > > expects preemption to be disabled. It effectively is, because local > interrupts are disabled by context_tracking_enter(). > > However, the requirement for preemption to be disabled is not > documented... so shrug. Maybe someone can say what the real requirements > are here. From dealing with this recently on arm64, theis is a bit messy. To handle this robustly we need to do a few things in sequence, including using the *_irqoff() variants of the context_tracking_user_*() functions. I wrote down the constraints in commit: 23529049c6842382 ("arm64: entry: fix non-NMI user<->kernel transitions") For user->kernel transitions, the arch code needs the following sequence before invoking arbitrary kernel C code: lockdep_hardirqs_off(CALLER_ADDR0); user_exit_irqoff(); trace_hardirqs_off_finish(); For kernel->user transitions, the arch code needs the following sequence once it will no longer invoke arbitrary kernel C code, just before returning to userspace: trace_hardirqs_on_prepare(); lockdep_hardirqs_on_prepare(CALLER_ADDR0); user_enter_irqoff(); lockdep_hardirqs_on(CALLER_ADDR0); Thanks, Mark.