Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1174876pxj; Sat, 29 May 2021 05:38:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQc2rMKdCkqX/3hpkOUH/JtRUM1C+0te2f7zGs4xVV5aV8kMCEJ2PX5IxGOUZ/36EQ7cH4 X-Received: by 2002:a5d:8516:: with SMTP id q22mr10806906ion.173.1622291883255; Sat, 29 May 2021 05:38:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622291883; cv=none; d=google.com; s=arc-20160816; b=tHgIGa8chs5bD0IkwHi2dcExnVj4wewAkhLdCZuiezcsbm1gL+KfI7659dGLyqM3gE AQufYoZkJRzCQAGahm1avqpnuG8AWaapgO3/KXlxJcPgixVkaaRH1voRdmQwYi8r8L12 GX7oCDbot6tVuG7EScrNhChg+wXMFjc/pG0ztQqQhDA9QVHQt2s4s60wHW1piNk69AYm CO9XjO2QwcHiiGT6sQszGlk/P4bii1a65yx4Awu4NxuoXlqyDVzDuyHCuVfD8quzgjoQ gydqvcRue17+qvOtbGeer1xmz/FiP6la5x1oL0UN64RLM1B06+o81me/VkKtLiXa3T3V pRvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to:dkim-signature; bh=pMPRFMOuX1S89zAsds2EsZdaJitjmQv9CpOdt5WE62Q=; b=XTyJk8bZEPPW6kpME31ABjGCLAZciCO60N2W76KzOHs6ikbZJvIwj/2jr1Hs7fNf8p 8JU2Lu0MpzjBR6YlNnYd/2ptyMxQbTqqa8lr4dE9v30l5ryvG/Ki+hiCmn81Cx94qNd2 ECuVujnQ8BhmGIBwQr6lf4ICMKzGCdHpK4OqDhdUGX55hI7XDGeopK+h54LdOW6XopLt h1l0dBLA/8qq0VigV7o3dtTc4ywCejo7CPPQtQTVQ0TozbiJcOI1ltaPumCNDAhTxjfq 33rWvw7CdNAeLSK2hy/S1HbCL8FWiq3OPbpWUY3mVbvAhdeVd+e2iafLyiKuJMnIruUm pFmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=n5EQefLh; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u9si10109692jat.83.2021.05.29.05.37.35; Sat, 29 May 2021 05:38:03 -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=@gmail.com header.s=20161025 header.b=n5EQefLh; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229681AbhE2McU (ORCPT + 99 others); Sat, 29 May 2021 08:32:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbhE2McU (ORCPT ); Sat, 29 May 2021 08:32:20 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26859C061574; Sat, 29 May 2021 05:30:42 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id r10so5839849wrj.11; Sat, 29 May 2021 05:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:references:from:subject:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=pMPRFMOuX1S89zAsds2EsZdaJitjmQv9CpOdt5WE62Q=; b=n5EQefLhrZ+Afr1G8DiDRslG95cp1VRPNpzYUtFeiqbDnB7IhwbF4lwma3r3Zlt1Zo FWoxv619QG0WL6AapGcTmvzzd72cObU/uB45Do7pTDuBrII+W5ZMCqY+6/14e7wGgpwA fbZlzK42R48S4ElVTFrSSSyseumPvzhcroHHYsVJvqs3Hkt5A3d+gmJGAGcfYYH6KtuJ srwRVIejWO2b9tdU4U4I4/8VLcAh1/Phkq0GwymNqlnpUoCKw+gkSgHhzwoFL2We1975 BY2XIIlbua2zv0LlOQKeLNxfP/6i+wnO4rvL9OZpyydRvM4+V0RcS6hGlMBU547r0NnN rkxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=pMPRFMOuX1S89zAsds2EsZdaJitjmQv9CpOdt5WE62Q=; b=Mt0uyPkBAKk+8ipJ64CNDBL+6S1xeI53vZK8lXK+NGg7VKVXqJjS6jJQV2Efhpc0o7 Szt4zA6pie1k9Eym87ZaiBmQI8VIqG2SOL7+27kBLm/hv2/NsiPj4SVyiD15o1LPypIt Gs08QO5KIU3w5H6nR1cV6xDUl51myaF3Ip43wWCzEL6u3YMzuzmug3nqbGh1boXIVEAx n3e4rVp3mV+qP3hO0YwF9lWfCa04uaeBLgQALFVCL8c2QvwwdJtemL/O0gHW0WCl1r/y VC7ZRdgbkGvRlq0lRnLu8lJXdvsRx+ZeZOGAfsHyHL0YjzBxEmcOyGhfzQHX6me0i1uz pH2g== X-Gm-Message-State: AOAM5334/2MWK4A1hmTCIBqSbNiqpS8HAuzTB9pRuOCBO4LXi6g1CrRd zEsUwdznB4lAiXCngyHrm+Zd9VWmOr0= X-Received: by 2002:adf:fa46:: with SMTP id y6mr5098661wrr.194.1622291440090; Sat, 29 May 2021 05:30:40 -0700 (PDT) Received: from [192.168.8.197] ([148.252.129.19]) by smtp.gmail.com with ESMTPSA id z135sm3929333wmc.26.2021.05.29.05.30.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 29 May 2021 05:30:39 -0700 (PDT) To: Steven Rostedt , Olivier Langlois Cc: Stefan Metzmacher , Jens Axboe , Ingo Molnar , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org References: <60ac946e.1c69fb81.5efc2.65deSMTPIN_ADDED_MISSING@mx.google.com> <439a2ab8-765d-9a77-5dfd-dde2bd6884c4@gmail.com> <9a8abcc9-8f7a-8350-cf34-f86e4ac13f5c@samba.org> <9505850ae4c203f6b8f056265eddbffaae501806.camel@trillion01.com> <20210528184248.46926090@gandalf.local.home> From: Pavel Begunkov Subject: Re: [PATCH] io_uring: Add to traces the req pointer when available Message-ID: <6fd74635-d3a8-7319-bcc6-c2c1de9c87ee@gmail.com> Date: Sat, 29 May 2021 13:30:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210528184248.46926090@gandalf.local.home> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/28/21 11:42 PM, Steven Rostedt wrote: > On Wed, 26 May 2021 12:18:37 -0400 > Olivier Langlois wrote: > >>> If that gets changed, could be also include the personality id and >>> flags here, >>> and maybe also translated the opcode and flags to human readable >>> strings? >>> >> If Jens and Pavel agrees that they would like to see this info in the >> traces, I have no objection adding it. >> >> Still waiting input from Steven Rostedt which I believe is the trace >> system maintainer concerning the hash-ptr situation. >> >> I did receive an auto-respond from him saying that he was in vacation >> until May 28th... > > Yep, I'm back now. > > Here's how it works using your patch as an example: > >> TP_fast_assign( >> __entry->ctx = ctx; >> + __entry->req = req; > > The "__entry" is a structure defined by TP_STRUCT__entry() that is located > on the ring buffer that can be read directly by user space (aka trace-cmd). > So yes, that value is never hashed, and one of the reasons that tracefs > requires root privilege to read it. > >> __entry->opcode = opcode; >> __entry->user_data = user_data; >> __entry->force_nonblock = force_nonblock; >> __entry->sq_thread = sq_thread; >> ), >> >> - TP_printk("ring %p, op %d, data 0x%llx, non block %d, sq_thread %d", >> - __entry->ctx, __entry->opcode, >> - (unsigned long long) __entry->user_data, >> - __entry->force_nonblock, __entry->sq_thread) >> + TP_printk("ring %p, req %p, op %d, data 0x%llx, non block %d, " >> + "sq_thread %d", __entry->ctx, __entry->req, >> + __entry->opcode, (unsigned long long)__entry->user_data, >> + __entry->force_nonblock, __entry->sq_thread) >> ); > > The TP_printk() macro *is* used when reading the "trace" or "trace_pipe" > file, and that uses vsnprintf() to process it. Which will hash the values > for %p (by default, because that's what it always did when vsnprintf() > started hashing values). > > Masami Hiramatsu added the hash-ptr option (which I told him to be the > default as that was the behavior before that option was created), where the > use could turn off the hashing. > > There's lots of trace events that expose the raw pointers when hash-ptr is > off or if the ring buffers are read via the trace_pip_raw interface. > > What's special about these pointers to hash them before they are recorded? io_uring offers all different operations and has internal request/memory recycling, so it may be an easy vector of attack in case of some vulnerabilities found, but nothing special. As that's the status quo, I wouldn't care, let's put aside my concerns and print them raw. -- Pavel Begunkov