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=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_PASS 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 9E36BC43381 for ; Mon, 25 Feb 2019 16:48:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6F09020842 for ; Mon, 25 Feb 2019 16:48:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ALZLex/+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728071AbfBYQsu (ORCPT ); Mon, 25 Feb 2019 11:48:50 -0500 Received: from mail-ua1-f65.google.com ([209.85.222.65]:41782 "EHLO mail-ua1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727950AbfBYQst (ORCPT ); Mon, 25 Feb 2019 11:48:49 -0500 Received: by mail-ua1-f65.google.com with SMTP id z24so8959186ual.8 for ; Mon, 25 Feb 2019 08:48:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hvOHXtUgt00mBm+4MIe3X8bSf3BnIl1oM2Qzn8BwD34=; b=ALZLex/+sIl5DKs0M8oEj5J4aAIfIB4+MEE6m4AH76wZWruVO4taEib0qCkVkffraD OpmmQvsu44e1NolR/o9dCJQ7P4e5DW4ceYgGkkWRgEHocxdy+3uimLEBUAn7+ZzdcZNz g1kPv3nCgeGYTN+2/TqysNMXoDGk6bRa0v3W8= 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=hvOHXtUgt00mBm+4MIe3X8bSf3BnIl1oM2Qzn8BwD34=; b=AsiYGtFHEQ/WGESjjxkM2LpGLJu1Ex0nQytljdmoejLT+A8w1BIl/aqH4EVXQJbi/A FrGmY1C4pO0rN+1+MVuJ6kiGCxcgeoFpbUhIRdtSy71F+hgCzKpQcXLrI9DnHjnvLdDt /b7xhrWliei3gCVze39qsIZnIUmXaFGuUI32yOoJPkObQDYnewoaQdWwVArSSig93qdI smN0Az5X61voUqgBlqth4NGw3DvfMx6bVLe+S7X56z0ejiwQVVI142CzuqlM/aDB8H6D /CNM3KZW1CqwsnZL8zBLzJsy2YK8fB2Ix8O9jlGj2shLPTqPwqFf+c9MlRscrX4Ztp8Z RM5g== X-Gm-Message-State: AHQUAuYmUFbbq8e+QXkjrvTiDCCimor2oreQkTdMg4PbijvhapISS9VI P72rn7Xh9T5KkSYvTtmleWEwvfqZZ3c= X-Google-Smtp-Source: AHgI3IYaZWHOL1Oio0sf+Sf/CeI8mQ/fR90mBQxBEbzcevOnK+RN6qN4GrWXJ4ezQQXgdEsSYrkTVw== X-Received: by 2002:ab0:280b:: with SMTP id w11mr9386028uap.84.1551113328135; Mon, 25 Feb 2019 08:48:48 -0800 (PST) Received: from mail-ua1-f49.google.com (mail-ua1-f49.google.com. [209.85.222.49]) by smtp.gmail.com with ESMTPSA id 67sm2152704vkt.35.2019.02.25.08.48.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Feb 2019 08:48:46 -0800 (PST) Received: by mail-ua1-f49.google.com with SMTP id q17so9012976uam.0 for ; Mon, 25 Feb 2019 08:48:46 -0800 (PST) X-Received: by 2002:a67:fa45:: with SMTP id j5mr9959613vsq.48.1551113326187; Mon, 25 Feb 2019 08:48:46 -0800 (PST) MIME-Version: 1.0 References: <20190215174712.372898450@goodmis.org> <20190215174945.557218316@goodmis.org> <20190215171539.4682f0b4@gandalf.local.home> <300C4516-A093-43AE-8707-1C42486807A4@amacapital.net> <20190215191949.04604191@gandalf.local.home> <20190219111802.1d6dbaa3@gandalf.local.home> <20190219140330.5dd9e876@gandalf.local.home> <20190220171019.5e81a4946b56982f324f7c45@kernel.org> <20190220094926.0ab575b3@gandalf.local.home> <20190222172745.2c7205d62003c0a858e33278@kernel.org> <20190222173509.88489b7c5d1bf0e2ec2382ee@kernel.org> <20190223124746.d021973004c7c892c3b3fde1@kernel.org> <20190223194421.725a03fd@oasis.local.home> In-Reply-To: From: Kees Cook Date: Mon, 25 Feb 2019 08:48:34 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2 v2] kprobe: Do not use uaccess functions to access kernel memory that can fault To: Andy Lutomirski Cc: Steven Rostedt , Masami Hiramatsu , Linus Torvalds , Linux List Kernel Mailing , Ingo Molnar , Andrew Morton , stable , Changbin Du , Jann Horn Content-Type: text/plain; charset="UTF-8" Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Sat, Feb 23, 2019 at 8:38 PM Andy Lutomirski wrote: > > On Sat, Feb 23, 2019 at 4:44 PM Steven Rostedt wrote: > > > > On Sat, 23 Feb 2019 12:47:46 +0900 > > Masami Hiramatsu wrote: > > > > > Since kprobes handler runs in IRQ context, we can not use access_ok() in it. > > > (only on x86 + CONFIG_DEBUG_ATOMIC_SLEEP=y) > > > > Is it really IRQ context or exception context? That is, one > > (interrupts) happen for any task, but exceptions happen because of the > > software that is executed (like a breakpoint). Although you can have a > > kprobe trigger in an interrupt handler (where user access wouldn't make > > sense anyway). But there should be no problem with user access from an > > exception handler. > > > > Can we just get rid of this might_sleep()? access_ok() doesn't sleep > as far as I know. We do need to be aware of the userfaultfd case of getting held by userspace in the middle of a copy_*_user()... that's a whole other problem. -- Kees Cook