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=-11.9 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 1EA7FC2D0A8 for ; Mon, 28 Sep 2020 20:52:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3B0B2083B for ; Mon, 28 Sep 2020 20:52:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="qhphk1yO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726844AbgI1UwL (ORCPT ); Mon, 28 Sep 2020 16:52:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726393AbgI1UwL (ORCPT ); Mon, 28 Sep 2020 16:52:11 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79E34C061755 for ; Mon, 28 Sep 2020 13:52:11 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id 197so1951613pge.8 for ; Mon, 28 Sep 2020 13:52:11 -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=E18yvgxr+dgDZ8P7S30cmV0usuEJVg+uMENH9hDolXk=; b=qhphk1yOGvZaci0uNcdLhvAY0Nm4YjlOFSTTt4DS11k5JYA/2/MuGen08tFXeptLsI zei1FfvI8M9uRJHfOApRsa4DQDWJxY9UqrTt0Q2l8+rdkA+4U6XFeEieR2QuTYbFMzJv 0Ro8v9FHLQ/cjsnzphEYpQcTDZLz9INdl9XSCklILr/gBpXqcJle7v2XeX7tGVIMZaZ/ BOub9/HvIlNuffP65vMlKGXzS6NrmzQcCGj6KoFRqwfui3iZ30MYxt+QMF6FKFy1WKlK AHcWz5DhYs7KDcu8QoVB0IYVSkXtgFrqmwEAQWr9oW8oz8tRv/LmgUPpVjHx5GK6oCAI EE6w== 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=E18yvgxr+dgDZ8P7S30cmV0usuEJVg+uMENH9hDolXk=; b=tw/dcdunFlN9GC54b6yinrlbmh35rkseDRDgJRTXq4o9bZiZNVLavyht/3iBRnISam 3Zfxx1NBs4xW4Tct5375Q7P+WhY5YC1vUnr98QXNsnaxu7i8KjzimHkoeKKUTy/VmOu2 zWy6JqF1Caw9E6VxcFtzFxVLx3h1DUP4HF/5/sxPhN6WIZ/0vaf2aO6c2MQuP5FL66dN BPhvwaaJ5tVbNiQRigW4eUo58OVIQjO+RPxkt0zQC19kPAA1ZADQlHUG2BjwUXZ/AnSo LU/VxrSsIkij/509K97+6f2Ksx1GnAj3vtIkLQVEdDb/LAJK6zeIgaBNMy/wsO7QF2pC QXAQ== X-Gm-Message-State: AOAM530Hse/q7riFSluHM3AVU+23oalWClMfCTPGtZJfbJUqIRF4mxLN CeBlWnKlhQh/4TTZeG3EuPs4xhY9u/233T2IMiPJnA== X-Google-Smtp-Source: ABdhPJyOpOvP3F8ukyvf3cS1yn54mNQ9MQiMewRhlNJLvUfcEzV4xnS29EQ/UovZfNYpkCNzjcH5Ab//ZMvyhkV3gs8= X-Received: by 2002:a63:28c9:: with SMTP id o192mr617964pgo.381.1601326330804; Mon, 28 Sep 2020 13:52:10 -0700 (PDT) MIME-Version: 1.0 References: <00000000000052569205afa67426@google.com> <20200927145737.GA4746@zn.tnic> <20200928083819.GD1685@zn.tnic> <20200928085401.GE1685@zn.tnic> In-Reply-To: From: Nick Desaulniers Date: Mon, 28 Sep 2020 13:51:58 -0700 Message-ID: Subject: Re: general protection fault in perf_misc_flags To: Dmitry Vyukov Cc: Borislav Petkov , Alexander Potapenko , Marco Elver , syzbot , Arnaldo Carvalho de Melo , Alexander Shishkin , "H. Peter Anvin" , Jiri Olsa , LKML , Mark Rutland , Ingo Molnar , Namhyung Kim , Peter Zijlstra , syzkaller-bugs , Thomas Gleixner , "the arch/x86 maintainers" , clang-built-linux Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 28, 2020 at 3:34 AM 'Dmitry Vyukov' via Clang Built Linux wrote: > > On Mon, Sep 28, 2020 at 10:54 AM Borislav Petkov wrote: > > > > On Mon, Sep 28, 2020 at 10:40:19AM +0200, Dmitry Vyukov wrote: > > > I meant the kernel self-corrupts itself, that just wasn't detected by > > > KASAN, page protections, etc. > > > > Well, Nick already asked this but we're marking all kernel text RO early > > during boot. So it either is happening before that or something else > > altogether is going on. On Sun, Sep 27, 2020 at 11:06 PM 'Dmitry Vyukov' via Clang Built Linux wrote: > > Interestingly there is a new crash, which looks similar: > > general protection fault in map_vdso > https://syzkaller.appspot.com/bug?extid=c2ae01c2b1b385384a06 > > The code is also with 4 0's: > Code: 00 00 00 48 b8 00 00 00 00 00 fc ff df 41 57 49 89 ff 41 56 41 > 55 41 54 55 65 48 8b 2c 25 c0 fe 01 00 48 8d bd 28 04 00 00 53 <48> 00 > 00 00 00 fa 48 83 ec 10 48 c1 ea 03 80 3c 02 00 0f 85 51 02 > > But it happened with gcc. > > Also I found this older one: > general protection fault in map_vdso_randomized > https://syzkaller.appspot.com/bug?id=8366fd024559946137b9db23b26fd2235d43b383 > > which also has code smashed and happened with gcc: > Code: 00 fc ff df 48 89 f9 48 c1 e9 03 80 3c 01 00 0f 85 eb 00 00 00 > 65 48 8b 1c 25 c0 fe 01 00 48 8d bb 28 04 00 00 41 2b 54 24 20 <00> 00 > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 If this is related to vdso's, they seem mapped as `r-xp` (not `w): $ sudo cat /proc/1/maps | grep vdso 7ffc667f5000-7ffc667f7000 r-xp 00000000 00:00 0 [vdso] map_vdso() in arch/x86/entry/vdso/vma.c doesn't map the VMA as writable, but it uses VM_MAYWRITE with a comment about GDB setting breakpoints. So it sounds like the page protections on the vdso can be changed at runtime (via mprotect). Maybe syzkaller is tickling that first? map_vdso_randomized() does call map_vdso(). Maybe if we mprotect the vdso to be writable, it may be easier to spot the write. -- Thanks, ~Nick Desaulniers