Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3305623pxk; Mon, 28 Sep 2020 13:53:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGX9GedBpw7xzwhhu4nEWKRYK3z4BWDK7xqqpPAa1dhtu3p+bxrITnJFRVvzBMyi2FqyEw X-Received: by 2002:a05:6402:17b6:: with SMTP id j22mr3716372edy.377.1601326424442; Mon, 28 Sep 2020 13:53:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601326424; cv=none; d=google.com; s=arc-20160816; b=0/TiedhxTnXRaUfYlFw8XkT5mfcIKJE4SJbP3o2V7RPXmKy0HEAxa5KrB1Uu1+aY7X 6ecID22CZseSEgTc1aULV7Q7PS40RXGAsbjBfAWRx05zSfZXtys7LjxkzZkuKSwvrvDV CWIV9swfY+DALw5gW6gZtd2Lj//PwtQ6Zj6O/fXPck9vz70PiO9UrIa4boxMT7WUW35/ iCu7ez2GraOEu7nGXzW+sxfmAZkCvsCdQwSmIQTlyBuHQyi+/GVQFbQx3mLW3lo9rrBy lXLCrNRGV6VKeXgK7KTUxShXIEZguXvfKigxAxWY4A0HvPfRcQaQ2zm3bMy4p8x4WeTp RG3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=E18yvgxr+dgDZ8P7S30cmV0usuEJVg+uMENH9hDolXk=; b=ScQNqa+bzfLTkwAHr/a1MShMUogvas8baym/BswhSPZWCDAI2Urb8bGJJGpp1wb3Jz KzuhFvHRMiRVhm6cHyvj7JNqbQBNmSevf9f2aXmReQV4uJjj0/com2kco1k3zUoh6pFU gPAS1J7v43JOK34dj/+RVgZar9VeqFsMi6w8O8X0M2RlJKDjWzg5kKubWa0DhMJUwAQg iyV/C4jDh0scIuPKsG+XvqgR8+lPl5Udc23hiVZgvLtp5JP5hN5ddzGBZbyppnpF34Mh F5pzM1bi6i4FFdY6Tdjd5djSeZjAYt22qwUixrzen0wmgbrGwbtPG9/87h9UbT+CINWr QgUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qhphk1yO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c24si1319397eja.263.2020.09.28.13.53.21; Mon, 28 Sep 2020 13:53:44 -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=@google.com header.s=20161025 header.b=qhphk1yO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726827AbgI1UwL (ORCPT + 99 others); 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-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