Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp201360pxb; Tue, 21 Sep 2021 23:31:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwXESjED4E3Kx8w6Zv7pOfTLWcST9zxN2m/6GCtem1Q0eL7GzAmBlBAD+cwpOMs4vwi6rd X-Received: by 2002:a02:6d10:: with SMTP id m16mr3422254jac.60.1632292288010; Tue, 21 Sep 2021 23:31:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632292288; cv=none; d=google.com; s=arc-20160816; b=OOtJRlYTsqPjAIcBTFHTbO+5CvIPBPTu+UYKVN2WZ9ApAl2p6xSTEkDdt2Z34hfe00 EaZsiCaei0IVyCtArauAyWMYZgdvBLiZ0XE3IGnNhi8L/019l4vpwXbTaoHGArLasQuZ m09yXv+YVWf5xrmL+U9lgV2+DCYEaTPkRPwPl2d8Mvu3BQ/ofDGvew64I5Q2FNHLInYy OTCMb0iLzzjNBvWYE2ZC3aT68mcwWrFNK7cWceHJvV85TcWMKITL882hFE7Rpd9tVELT uhxprwzzYQBRzxvVtkmnOy6WnoT3Ig4AsrYoLWLQXKWg1Vak7sn/CYGWWCRo6GrIVx48 t+hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=YMV0WM2KrQOxLh8C9TQC7GSD4fPut9q6yVFAqEHffJc=; b=L2YoqhFxpkdcac0/kSqDvEs9/OcvqMzo04yjiEXQyJ7KjD/h8VkwsuUn1Y5Yhp0fN7 N++Cg4PSWOv3HJUB1Nklqq3M2bO6nqfz8mibUbGAXkEfCLAwyCCUE4j+LVE+XNRsNoTQ wtUlrRkNruUAYcbC8wib06lgl3MEuUA+wRk+3PB/CihtIt42zi+ntuv3zwXfd9BBuSQc opiXWGrpESWW7Ez0wyMfjBw+/Bl8trJG38PeZ4ssjXEj8BKIQQCC7bmzA2vOn+ZGDTPK rJ+RR5hjo4V75GkumhWsTZlGnY3U/oPeRsegZ/V0HRB87pq1DJR05ZSUwOn6zcP0A70V nz2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=i98tpsJ6; 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 s10si1495711ioo.6.2021.09.21.23.31.15; Tue, 21 Sep 2021 23:31:27 -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=20210112 header.b=i98tpsJ6; 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 S232836AbhIVGbr (ORCPT + 99 others); Wed, 22 Sep 2021 02:31:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232790AbhIVGbq (ORCPT ); Wed, 22 Sep 2021 02:31:46 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D64EC061575 for ; Tue, 21 Sep 2021 23:30:16 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id b15so7593932lfe.7 for ; Tue, 21 Sep 2021 23:30:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=YMV0WM2KrQOxLh8C9TQC7GSD4fPut9q6yVFAqEHffJc=; b=i98tpsJ6L+LDayrM1mpru6+baaJ4hdgKqQsa3GPV7xDnKcxYlLj4Xejha9nhKEv+qD 7FVGAy3eLo8iuXCOvcJmO+qoq5FFEjfDwG71FvoLTPCtxVJu/rL2Y0T9V3wHPUb72taS XBIDngw2MqmQc0BGT1VlMgWvB6CiEzR5GYtE++a0djJQFYdiTz/n3zoVKSCBUcsJYbrP mqC1RFvA07UM+LVfsf5vCyb05XJHIPgA2hlRAc6+IOKgJBl17WTEiqhSu5wgYzAiGb/p zVcMNmFNmgNRC2asTZ7h5cNRUL0rrs30vRQAYKoOz1t4grUQT7rGWAxCCjICpNHa02bn po3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=YMV0WM2KrQOxLh8C9TQC7GSD4fPut9q6yVFAqEHffJc=; b=XXZV5BfAix8WOasXV9t2Vbfbq4fceJL8QLOCyqugsyH7f+PAS3ulHCrRtJ51goz+Rc sH6oOyZIZ6Pc1Ni4y8nO/lMWI/Ck5c8i0VmA3DGuFc8QpPKPmvuMIseaGTkKb1RDvml8 CGCIjKIwakk2EOeaa/n1WozwwdS0P5x46TRNPN/MtP/eI21zWcRdH00HpwxKiqEW0Oeh GHPf2nzlstej0bfB0tkeHNl241tAbjGcH5voPvnwRI+d71eXXooDNnZgXEcxr8Rx+qkZ mib/eSqVtd+PcF1xL/rkTjo6Eb8hTyGPbVxJs6G2v+IuF0MvV51yivxqvy6XwZIXAvZ3 dIHQ== X-Gm-Message-State: AOAM533rmdL6pRZJ30hAX5zQM6U3VYSRooQo8VqPsQNuLDqgD4CGJ7gr ZG42Mv8Rie41M1EJ4sfKWzQ= X-Received: by 2002:a05:6512:2307:: with SMTP id o7mr25780370lfu.183.1632292214812; Tue, 21 Sep 2021 23:30:14 -0700 (PDT) Received: from grain.localdomain ([5.18.253.97]) by smtp.gmail.com with ESMTPSA id r2sm96887lfm.78.2021.09.21.23.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Sep 2021 23:30:13 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id D5E305A001E; Wed, 22 Sep 2021 09:30:12 +0300 (MSK) Date: Wed, 22 Sep 2021 09:30:12 +0300 From: Cyrill Gorcunov To: Peter Collingbourne Cc: Catalin Marinas , Will Deacon , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Thomas Gleixner , Andy Lutomirski , Kees Cook , Andrew Morton , Masahiro Yamada , Sami Tolvanen , YiFei Zhu , Colin Ian King , Mark Rutland , Frederic Weisbecker , Viresh Kumar , Andrey Konovalov , Gabriel Krisman Bertazi , Balbir Singh , Chris Hyser , Daniel Vetter , Chris Wilson , Arnd Bergmann , Dmitry Vyukov , Christian Brauner , "Eric W. Biederman" , Alexey Gladkov , Ran Xiaokai , David Hildenbrand , Xiaofeng Cao , Thomas Cedeno , Marco Elver , Alexander Potapenko , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Evgenii Stepanov Subject: Re: [PATCH] kernel: introduce prctl(PR_LOG_UACCESS) Message-ID: References: <20210922061809.736124-1-pcc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210922061809.736124-1-pcc@google.com> User-Agent: Mutt/2.0.7 (2021-05-04) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 21, 2021 at 11:18:09PM -0700, Peter Collingbourne wrote: > This patch introduces a kernel feature known as uaccess logging. > With uaccess logging, the userspace program passes the address and size > of a so-called uaccess buffer to the kernel via a prctl(). The prctl() > is a request for the kernel to log any uaccesses made during the next > syscall to the uaccess buffer. When the next syscall returns, the address > one past the end of the logged uaccess buffer entries is written to the > location specified by the third argument to the prctl(). In this way, > the userspace program may enumerate the uaccesses logged to the access > buffer to determine which accesses occurred. ... > diff --git a/include/linux/sched.h b/include/linux/sched.h > index e12b524426b0..3fecb0487b97 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -34,6 +34,7 @@ > #include > #include > #include > +#include > #include > > /* task_struct member predeclarations (sorted alphabetically): */ > @@ -1487,6 +1488,8 @@ struct task_struct { > struct callback_head l1d_flush_kill; > #endif > > + struct uaccess_buffer_info uaccess_buffer; > + Hi, Peter! I didn't read the patch carefully yet (will do once time permit) but from a glance should not this member be under #ifdef CONFIG_UACCESS_BUFFER or something? task_struct is already bloated too much :( > + case PR_LOG_UACCESS: > + if (arg5) > + return -EINVAL; > + error = uaccess_buffer_set_logging(arg2, arg3, arg4); > + break; Same here (if only I didn't miss something obvious). If there is no support for CONFIG_UACCESS_BUFFER we should return an error I guess.