Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1942115pxk; Sat, 26 Sep 2020 10:19:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgMMaCqf6QYY/bE0SDndr8ZWwU43ftcBZJKUqG0UtxiASc4JEcTb2MGIuCNMsk2CCw8xeL X-Received: by 2002:a17:906:cc99:: with SMTP id oq25mr8367454ejb.292.1601140753827; Sat, 26 Sep 2020 10:19:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601140753; cv=none; d=google.com; s=arc-20160816; b=ve7HVeia9rRV0fF2MWEKPJSN+wi2hPBpxuiEidPdwsuSusPBJvgoOD5bRM+3NotRJK vVMqn5TLOPS9HccELk1d1/LGIO2qQmbhNrTmMKJKSbqLqTpVDOkQ4AnO6eV7AN/r2LO9 mClGFMeWzfV9ic10Tw42GTaxa7ullXNvPNG80nq1P3w/Wl7PfVGHl1xWjvAY2qO3PKVl uKGEV5j3FoWzdSXsgLhW4M5EY2KGLyOFwOycvQuj6NXKFqgTtV3aDV9/45eMien19gDF COqLq+radcfOLoJB+fQsQbnY67l1ZshSdDBW0BVwydu4AVwalVJ+A9rd/z6HT3Z/1v70 Vb8A== 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:dkim-signature; bh=FRmt1ZU323p3kg9TO7fbBge69StpQX8q8Foc3zlvE2s=; b=h9uOzpKLCFC1ERJiETFpWO1XEZYWHb4a0YOz6pfxWIVGf0NTLfjxjmk1ih9LLmdVin SeXw5JJsknAhY12n8/N6XJg/jtAEv0NW/wHuvOF1FxuQL5ODyXwXelDqjzAUwnc8rrW4 5Xp0PNr/xGM5c/mxoGc7piw3Fz+63lNxXBs/dsjXEzYhh+dXzfy6Z6kglEUlN2f0ZtL9 aiQu1rTRyo4yNssoahug0cAj0DVT0aTccrdEc2TntpI32wAr1d5ZfA6a/MrQBl8PV2sJ QA6aZGv9J2yAS/X/JZxrSCXjDCxYeILFVz6LN24Ogyg3SZ4iFnGtVkXqJbmAPY3XEuCk 8GBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=aIHN0152; 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=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n11si4439777edt.479.2020.09.26.10.18.51; Sat, 26 Sep 2020 10:19:13 -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=@alien8.de header.s=dkim header.b=aIHN0152; 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=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728017AbgIZRO5 (ORCPT + 99 others); Sat, 26 Sep 2020 13:14:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726239AbgIZRO4 (ORCPT ); Sat, 26 Sep 2020 13:14:56 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93BACC0613CE for ; Sat, 26 Sep 2020 10:14:56 -0700 (PDT) Received: from zn.tnic (p200300ec2f1c25001c55400185a26885.dip0.t-ipconnect.de [IPv6:2003:ec:2f1c:2500:1c55:4001:85a2:6885]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id EB5C31EC03EA; Sat, 26 Sep 2020 19:14:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1601140493; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=FRmt1ZU323p3kg9TO7fbBge69StpQX8q8Foc3zlvE2s=; b=aIHN0152CmLZsWu2iozBNysrRKNTdF6YDMpRt6q0ui+4bF8LTMKwskGMQ7ViSwQmkMqAtv MVXcqTc89G6OUmKeRdTFIETBv5kXpcYhluoSww+A7/JzJlG2vvhygmTTYdZw8gRLgEXf34 0bFMOAwS5Uob0+Nm6gwewS6r+A26kVg= Date: Sat, 26 Sep 2020 19:14:51 +0200 From: Borislav Petkov To: Nick Desaulniers Cc: Dmitry Vyukov , Josh Poimboeuf , 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 Subject: Re: general protection fault in perf_misc_flags Message-ID: <20200926171451.GB22089@zn.tnic> References: <20200921221336.GN5901@zn.tnic> <20200923090336.GD28545@zn.tnic> <20200923103431.GF28545@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 25, 2020 at 05:32:14PM -0700, Nick Desaulniers wrote: > Boris, one question I have. Doesn't the kernel mark pages backing > executable code as read only at some point? Yes, I added some debug output: [ 562.959995][ T1] Freeing unused kernel image (initmem) memory: 2548K [ 563.672645][ T1] Write protecting the kernel read-only data: 137216k [0xffffffff81000000:0xffffffff89600000] and perf_misc_flags() is well within that range: ffffffff810118e0 : [ 566.076923][ T1] unused kernel image (text/rodata gap): [0xffffffff88608000:0xffffffff88800000] [ 567.039076][ T1] unused kernel image (rodata/data gap): [0xffffffff8941d000:0xffffffff89600000] [ 568.205550][ T1] Freeing unused kernel image (text/rodata gap) memory: 2016K [ 569.277742][ T1] Freeing unused kernel image (rodata/data gap) memory: 1932K We also have this debug option which I enabled: [ 570.598533][ T1] x86/mm: Checked W+X mappings: passed, no W+X pages found. so that looks ok too. > If that were the case, then I don't see how the instruction stream > could be modified. I guess static key patching would have to undo that > permission mapping before patching. Yap, and I still have no clue about the mechanism which would lead to this corruption. > You're right about the length shorter than what I would have expected > from static key patching. That could very well be a write through > dangling int pointer... Right. Lemme try to setup one of my test boxes to run syzkaller and see how far I can get. But don't hold your breath... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette