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=-9.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 6E8B5C433EF for ; Wed, 22 Sep 2021 06:30:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 528B260EE5 for ; Wed, 22 Sep 2021 06:30:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232859AbhIVGbs (ORCPT ); Wed, 22 Sep 2021 02:31:48 -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-Google-Smtp-Source: ABdhPJxU/GmtyqQeA7AzCSpw22P8Cj47KumZPWLQAIs/dbI5fkip4tPXizOBMdhpYK1VVJcHRfmagw== 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.