Received: by 10.192.165.148 with SMTP id m20csp74239imm; Fri, 4 May 2018 06:57:24 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq0hHxiCEio9COZvfchqn3X1Ei7cmENsXXuAKhMCPDO0VFnF2oI2ExBLevR8Tq78Zp/gXSJ X-Received: by 2002:a65:4102:: with SMTP id w2-v6mr21603857pgp.31.1525442244713; Fri, 04 May 2018 06:57:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525442244; cv=none; d=google.com; s=arc-20160816; b=MFMiPXiZYjbrasr0gDlsW6Bu7pbqHgEi6JL1l6EfoOdGdjRVmqvK8k0SZ8WHh1dlyv GSmOeS8NuOi7DFFZ/dmslvuz1VotpATgVA8a/8goS5MxubW+gS+hEYIvR/zbMMIwrwn3 1sOPnXCLWFSlSKD5j6iZFHHReY4Y1SDhDWcQvqSyP24i7cfwXYayoMrKZLsL1Y9bMpYe u5QM3cGq5t9K5dOiNyXRQVOnLEBSzYCnxNrNI01hNDfJEHOHoE8zkfMSkQz5owgTxNO9 CqpO2aMwCmxxX2j0d4xZSR02gofd/aWW2jlUWxD8Ymb5331CJ5764vquGkbwFb8EGcal NJ9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=a5EtxHNSCgWuxrCL2DJswFu2gGw1D0NJlPnPda6NZxI=; b=s12HWJgc/GjZlXYKz86tp89c2V6gWWidCm7VZDyHT/ydT9gPQxJc/GqmZ2MwHH1NK2 P1vBlNoTwbkRxjglvn7SfEsZNnME6GGsDK2ury6lSyYtThtsF3rikDtUMTPWjqMb3VDm 970OL0m03D/h5VaEz6VRk16cggNEAs5voae8s0SMSwagJzrKCBaLJQsIBhDgA96LE0fM Jke3LYQMCQk5+npUMZOeXPmHZWvcCZedjDnHHHTDZIEMJ4LtN6yenV6yREFxnXzdldV0 rzNDCG2yqbw/Vzpd7ts2KSULNwSDJ0eAB2p67+eizSbpfzJLDZVzZW5a7EZg5+ei+JU5 U+IQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q28si16443708pfl.317.2018.05.04.06.57.10; Fri, 04 May 2018 06:57:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751901AbeEDNzn (ORCPT + 99 others); Fri, 4 May 2018 09:55:43 -0400 Received: from foss.arm.com ([217.140.101.70]:53632 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751573AbeEDNzl (ORCPT ); Fri, 4 May 2018 09:55:41 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 56FC81435; Fri, 4 May 2018 06:55:41 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EB0F53F487; Fri, 4 May 2018 06:55:39 -0700 (PDT) From: Mark Rutland To: linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, aryabinin@virtuozzo.com, dvyukov@google.com, mark.rutland@arm.com, mingo@redhat.com, peterz@infradead.org Subject: [PATCH 0/3] kcov: fix unexpected faults Date: Fri, 4 May 2018 14:55:32 +0100 Message-Id: <20180504135535.53744-1-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, These patches fix a few issues where KCOV code could trigger recursive faults, discovered while debugging a patch enabling KCOV for arch/arm: * On CONFIG_PREEMPT kernels, there's a small race window where __sanitizer_cov_trace_pc() can see a bogus kcov_area. * Lazy faulting of the vmalloc area can cause mutual recursion between fault handling code and __sanitizer_cov_trace_pc(). * During the context switch, switching the mm can cause the kcov_area to be transiently unmapped. These are prerequisites for enabling KCOV on arm, but the issues themsevles are generic -- we just happen to avoid them by chance rather than design on x86-64 and arm64. I've tested this on arm atop of v4.17-rc3, with KCOV enabled. Thanks, Mark. Mark Rutland (3): kcov: ensure irq code sees a valid area kcov: prefault the kcov_area sched/core / kcov: avoid kcov_area during task switch include/linux/kcov.h | 14 ++++++++++++++ include/linux/sched.h | 2 +- kernel/kcov.c | 17 +++++++++++++++-- kernel/sched/core.c | 4 ++++ 4 files changed, 34 insertions(+), 3 deletions(-) -- 2.11.0