Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3481137pxb; Mon, 4 Apr 2022 18:20:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhXPTA5tZBzGvElHHcjbFvqt8GB3jB+NtN55nP4Vak2la2+8eTT6AA6ZOGBMquyKtVZRKh X-Received: by 2002:a63:5712:0:b0:399:28f1:3c76 with SMTP id l18-20020a635712000000b0039928f13c76mr810300pgb.129.1649121635741; Mon, 04 Apr 2022 18:20:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649121635; cv=none; d=google.com; s=arc-20160816; b=V3TklIsdg9IuCKJGpOvH9qA3rRYhkfc246hB1CBoRpmaMv58I2857DxHw0U7Ovlnlg XZPq45/RxiDB+RTHOGlN9o2y7umBdDRumhRgQCsao59Z/IGroqZ34FEaD0cdMnIqJUwa 5b1cYcntQE66v2gPuW1oaLC3EwbsEkC+QgNTe6ptdnLcSw5gsvTHy2lTVCKnmlbGAJiE x0K01llMh2tjZmDY2NKaCvvts1IPyXH0/yo+5F7Uig9bt6WuYocnsi3i8I3BxI8q14s8 7vqQclqRf7XBwwsPuXQFT7G7ysFsdGCCrYK9d/ZG9eqIm/0xkhV/LRZlIZFnOkjdb9ZI LSvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=ZmUiorrcv4hSBgHHc4SmHe16T+eq+bKCUHOlyXmVWb8=; b=n5+o2kUa/ok6sZfWOFmh9UJK9bf3Y1E+bVuF41+a+4tXKeUHr0J+WB3WJmZTYMaJAW XoUlZy+cLnGhfW28w6hxiKWeKG5mVL2K31rPCjFq5LCS0U+mJe3a2Sqy94bkhpKSFplA O0JCvtVDYDQLrlR3TG7eiH+3hE2lI32Zes8Ul6sSkYM7tRy9PQyXrA0Kc1APZIcEQvyU lAo/cHxeVh9nZxQvL9AS3nYCxEVJ6PVwAyePexP/kzVkznQb4UpeympJ2YHMZfAbiusq OPttqV/ppsqiaKl0kCw4n73tG7SIzcL7jRfB/rykdvnoGmif+9cKOyNvq79XGa9PT1L5 8ENw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=dpDvq+4+; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id f9-20020a056a00228900b004fa3a8dff4esi12365241pfe.5.2022.04.04.18.20.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 18:20:35 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=dpDvq+4+; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 791447B561; Mon, 4 Apr 2022 17:23:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353521AbiDAXpd (ORCPT + 99 others); Fri, 1 Apr 2022 19:45:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353443AbiDAXpQ (ORCPT ); Fri, 1 Apr 2022 19:45:16 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 81F711172; Fri, 1 Apr 2022 16:43:24 -0700 (PDT) Received: from localhost.localdomain (c-73-140-2-214.hsd1.wa.comcast.net [73.140.2.214]) by linux.microsoft.com (Postfix) with ESMTPSA id 2117320DF568; Fri, 1 Apr 2022 16:43:24 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2117320DF568 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1648856604; bh=ZmUiorrcv4hSBgHHc4SmHe16T+eq+bKCUHOlyXmVWb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dpDvq+4+CY5GmL3NVrlrvNev7B+nKiDx7gQvhY9gCVrd4JgoLe2zy24t1EcxAC2wE W9H+0JA8q+miUx9CBntrsAbQGWSJ+6Kdc+dvzxDwHnGxXNDbBUDJ1a6VOeoWSguYdm hq40CEmACxlxkbV6EmCpufylY9CLnhEO16vWKiBM= From: Beau Belgrave To: rostedt@goodmis.org, mhiramat@kernel.org, mathieu.desnoyers@efficios.com Cc: linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, beaub@linux.microsoft.com Subject: [PATCH 3/7] tracing/user_events: Use WRITE instead of READ for io vector import Date: Fri, 1 Apr 2022 16:43:05 -0700 Message-Id: <20220401234309.21252-4-beaub@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220401234309.21252-1-beaub@linux.microsoft.com> References: <20220401234309.21252-1-beaub@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org import_single_range expects the direction/rw to be where it came from, not the protection/limit. Since the import is in a write path use WRITE. Link: https://lore.kernel.org/all/2059213643.196683.1648499088753.JavaMail.zimbra@efficios.com/ Reported-by: Mathieu Desnoyers Signed-off-by: Beau Belgrave --- kernel/trace/trace_events_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c index 075d694d20e3..15edbf6b1e2e 100644 --- a/kernel/trace/trace_events_user.c +++ b/kernel/trace/trace_events_user.c @@ -1245,7 +1245,8 @@ static ssize_t user_events_write(struct file *file, const char __user *ubuf, if (unlikely(*ppos != 0)) return -EFAULT; - if (unlikely(import_single_range(READ, (char *)ubuf, count, &iov, &i))) + if (unlikely(import_single_range(WRITE, (char __user *)ubuf, + count, &iov, &i))) return -EFAULT; return user_events_write_core(file, &i); -- 2.25.1