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=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=ham 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 B5108C433B4 for ; Tue, 13 Apr 2021 05:14:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B52A613AB for ; Tue, 13 Apr 2021 05:14:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243081AbhDMFOl (ORCPT ); Tue, 13 Apr 2021 01:14:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242475AbhDMFOj (ORCPT ); Tue, 13 Apr 2021 01:14:39 -0400 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7985C061574 for ; Mon, 12 Apr 2021 22:14:19 -0700 (PDT) Received: by mail-qk1-x730.google.com with SMTP id o17so8270152qkl.13 for ; Mon, 12 Apr 2021 22:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=r1MhGHptppR4JfVg5lhSU+kHwLLhNLD9eNv0NPDmNZg=; b=JhmAgg9Wtu/dvfyYZkLeerLWdqYkkkklywFAcaG/TgjLYIZLrtVvli+2MW15yhPyaD s6kf/EhhxePHiIaDal7Nd/9mLKRZbNusK7NKov4tePFr4Ced3EAqWSEd3OA+huC4nCqS +Gw98JOOFXWjnMCNpMfrgdqqLaEFbpc1pOxUCMImYa2uJlpO5DxExs0fG1x7ZGDJhZtq CoZjhcWTjDQHCwxBKhDMjNWZZ3M0f0DGMMbAATpE13bNkwpwjC3kaOUeQyH4dUhqSRlK netSeFHiwmD5dvXK/AMMrSXCK7wS6Crj2G/F0ifavSPNeru39F7uIiI/416bbrHcqfOr no8g== 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; bh=r1MhGHptppR4JfVg5lhSU+kHwLLhNLD9eNv0NPDmNZg=; b=A0Mw/hxDns3Eq5H1FYzztp8VgQ3FfLfF2DhFBfSvSUt3gPUd3pSv7NDHhnoJyAzz86 /2bWj00K+kOmJrYw3wN1xC4ZIsdZcTYuvBz86sH+/2HhGABz1yHEM6tX+/+zaHGzKkxn H2fSeZLMlLV4rIwP8i2oCY/ufSsSGy8t27TSxcF4Uswxy8GA2XtcrRUm9cXISmrcQio9 shkIRUm0rTucbzDaeoQKw84vTi2K8bwFDjagzMS2+M1VL8sWUtO5Yj8fTidw/hGtiyQ8 HHCmfJcZ+a4DQkC62wtmng5OBd6XnYaMbV+/2E9RRAzn6R9IeKvFgVMtAh2rj+nU4Bd4 ELtw== X-Gm-Message-State: AOAM532fxUbHVUdFWDt33sE2YxrQtfvldNXO24DnuYBa90oWo4TbusSt Y/z5molEDIKvKYl4ryDiiIW5rO1Ep2n5KrM0Sh+BBDBDMpesKQ== X-Google-Smtp-Source: ABdhPJxtioOCZAt2nsdSxmRzp5jWFVoslJNTaejpXYmOJC+2NLTdvqdGsNrKbR1CkUzMuNapA7Q+/6oO10Hg10SnSc4= X-Received: by 2002:a05:620a:243:: with SMTP id q3mr11531519qkn.501.1618290858611; Mon, 12 Apr 2021 22:14:18 -0700 (PDT) MIME-Version: 1.0 References: <0000000000004f14c105bde08f75@google.com> <20210319101043.GU1463@shell.armlinux.org.uk> <20210322172241.GB80352@C02TD0UTHF1T.local> In-Reply-To: <20210322172241.GB80352@C02TD0UTHF1T.local> From: Dmitry Vyukov Date: Tue, 13 Apr 2021 07:14:07 +0200 Message-ID: Subject: Re: [syzbot] upstream boot error: WARNING in __context_tracking_enter To: Mark Rutland Cc: Russell King - ARM Linux admin , syzbot , Arnd Bergmann , Linux ARM , Alexandre Chartre , LKML , Masami Hiramatsu , Peter Zijlstra , syzkaller-bugs , Thomas Gleixner Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 22, 2021 at 6:22 PM Mark Rutland wrote: > > 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); Hi Russell, Does Mark's comment make sense to you? lockdep_assert_preemption_disabled() also checks "&& this_cpu_read(hardirqs_enabled)", so is it that we also need hardirq's disabled around user_enter/exit? This issue currently prevents ARM boot on syzbot. 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=-8.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 E7050C433B4 for ; Tue, 13 Apr 2021 05:16:42 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6D8896109E for ; Tue, 13 Apr 2021 05:16:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6D8896109E Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BzgrcN7uZtAmyTHetVGCCO0Rj3vtoWOSrtc/m0maCfo=; b=cfvrhWTXTiKQNMu3MsZOkUSFp y6SmZFj0KGU0bK46TGqbTwNVq4DwDA+7POIl5k1VYo31pccg0AD37J3JG1Z2EkPm2H8VLiwmZXwG5 WzSPAJggshNzkRTBTOtPWgUVlz7UmIo5rPQN/WokLLwWX+XBlu1yYU9SrxB9wsaJguveyQAAwsHuk TDGtHoRD1oVpNtPn0mAb+MgVSmd2T/drT6XCGwC1PsXOIqcGkBtxXGAfI1t4zRswbIttky1sxm7sJ XSpi1XIFCeT2vC6EqNFQLAHFvSc0J5p3PFnCmOI5SWxVWmJWNRfMwfBxlivVp0Q1UcmfKBx7NK3Ob blwDcmxfQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lWBNh-008Heq-7n; Tue, 13 Apr 2021 05:14:33 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWBNZ-008HeP-PF for linux-arm-kernel@desiato.infradead.org; Tue, 13 Apr 2021 05:14:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=r1MhGHptppR4JfVg5lhSU+kHwLLhNLD9eNv0NPDmNZg=; b=tSQyBZ5iRTKVMxtYdUz70Ig1gb UC6Iff26diIR344Dy2YgNTjg/mV//f+xJ98//LMnpZYY+oyPysBhWsWRXq4itjNGWNNfXk8ayo0aT 4K1JQ4ol9E3ID+d1SU3V6vSAIYEJwHFu6nOJ6oM379j1q1ah6S9mTNv/ilTPl4tKzXIsHX1FIrj2W ewJEPzKRumYB9fCS+1Pi/mcIQp9m3ejasrffWflq+YXqXJwXwQw4TptsqRXK7ri/EL1F8ESb9Cnvp IvmKcjChvXujwCLryASUr5MG7FZjq3oELK+ilrHDwk1aZ4NThbvC7/MMEtVu6YvKFywJUeMjrkHhI HxrdwtXg==; Received: from mail-qk1-x72a.google.com ([2607:f8b0:4864:20::72a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWBNW-006jUo-TZ for linux-arm-kernel@lists.infradead.org; Tue, 13 Apr 2021 05:14:24 +0000 Received: by mail-qk1-x72a.google.com with SMTP id q189so6313631qka.8 for ; Mon, 12 Apr 2021 22:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=r1MhGHptppR4JfVg5lhSU+kHwLLhNLD9eNv0NPDmNZg=; b=JhmAgg9Wtu/dvfyYZkLeerLWdqYkkkklywFAcaG/TgjLYIZLrtVvli+2MW15yhPyaD s6kf/EhhxePHiIaDal7Nd/9mLKRZbNusK7NKov4tePFr4Ced3EAqWSEd3OA+huC4nCqS +Gw98JOOFXWjnMCNpMfrgdqqLaEFbpc1pOxUCMImYa2uJlpO5DxExs0fG1x7ZGDJhZtq CoZjhcWTjDQHCwxBKhDMjNWZZ3M0f0DGMMbAATpE13bNkwpwjC3kaOUeQyH4dUhqSRlK netSeFHiwmD5dvXK/AMMrSXCK7wS6Crj2G/F0ifavSPNeru39F7uIiI/416bbrHcqfOr no8g== 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; bh=r1MhGHptppR4JfVg5lhSU+kHwLLhNLD9eNv0NPDmNZg=; b=sxRDNmqYszP1bgNgkCHZ5MmSC2AqS3V1SqzaM4MWU+W3mAm5jNlNS1r3OgA/Kn/QGt SzXH+ZpECQ0LbOttX2LKmqlNtuFRdZLNslGCYoCsQij2gVrTe0nbD9cEUc/ukKu/72zK W0sCj7mDhz2P1Wg2N7cU2iLkXmzIrXvWUUlKabISjOrNekCmJZagJEaVGUX4mLD18qWc wc8F39Tnq3UFImgGJFZ6UgTxOx1HdgVDfq1kXkEZy0cZbRADFe5nipOCZZS0ssp3sXvN wSPDldHX1Bd2gt03t6yymnSMfxNg7wET0m0k8IRwe8mb0MC8pWbQnsXZiS8fk0q6mdVX mB8g== X-Gm-Message-State: AOAM5311nRfYYM2eBUFL5cVbCysqt+0kdBvQ32Nd7qJAT/4qz1BqvGXX jMX5fuNwrC9r8Bpua5Dm48j9KCoOkYmIej5baFhnEA== X-Google-Smtp-Source: ABdhPJxtioOCZAt2nsdSxmRzp5jWFVoslJNTaejpXYmOJC+2NLTdvqdGsNrKbR1CkUzMuNapA7Q+/6oO10Hg10SnSc4= X-Received: by 2002:a05:620a:243:: with SMTP id q3mr11531519qkn.501.1618290858611; Mon, 12 Apr 2021 22:14:18 -0700 (PDT) MIME-Version: 1.0 References: <0000000000004f14c105bde08f75@google.com> <20210319101043.GU1463@shell.armlinux.org.uk> <20210322172241.GB80352@C02TD0UTHF1T.local> In-Reply-To: <20210322172241.GB80352@C02TD0UTHF1T.local> From: Dmitry Vyukov Date: Tue, 13 Apr 2021 07:14:07 +0200 Message-ID: Subject: Re: [syzbot] upstream boot error: WARNING in __context_tracking_enter To: Mark Rutland Cc: Russell King - ARM Linux admin , syzbot , Arnd Bergmann , Linux ARM , Alexandre Chartre , LKML , Masami Hiramatsu , Peter Zijlstra , syzkaller-bugs , Thomas Gleixner X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_221422_996393_CC5EC7AA X-CRM114-Status: GOOD ( 25.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Mar 22, 2021 at 6:22 PM Mark Rutland wrote: > > 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); Hi Russell, Does Mark's comment make sense to you? lockdep_assert_preemption_disabled() also checks "&& this_cpu_read(hardirqs_enabled)", so is it that we also need hardirq's disabled around user_enter/exit? This issue currently prevents ARM boot on syzbot. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel