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=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no 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 B4D14C433DB for ; Tue, 12 Jan 2021 17:36:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4EEFD2311D for ; Tue, 12 Jan 2021 17:36:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4EEFD2311D Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9BBBC6B007D; Tue, 12 Jan 2021 12:36:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 96C926B007E; Tue, 12 Jan 2021 12:36:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 835606B0080; Tue, 12 Jan 2021 12:36:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0145.hostedemail.com [216.40.44.145]) by kanga.kvack.org (Postfix) with ESMTP id 6F2FD6B007D for ; Tue, 12 Jan 2021 12:36:32 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 33DB9180AD81D for ; Tue, 12 Jan 2021 17:36:32 +0000 (UTC) X-FDA: 77697827424.14.sack43_3f004e727517 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id 05157182299BB for ; Tue, 12 Jan 2021 17:36:32 +0000 (UTC) X-HE-Tag: sack43_3f004e727517 X-Filterd-Recvd-Size: 4975 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Tue, 12 Jan 2021 17:36:31 +0000 (UTC) Received: by mail-wr1-f52.google.com with SMTP id m4so2011811wrx.9 for ; Tue, 12 Jan 2021 09:36:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wfBdHlbPhe9JJVFJ53u2WB3aTeFtdCK9M9opKH7jl0E=; b=r+hFbctf7X7hHlEJB3cUCjzH8j2xrYepKGUGArG/haPmHg3VEsQqEoP+bjyfE+JUV4 7fNlBjtiSaVAjnlZ8OaToJ9zft6m1wHPMAvTu/fKvVnerheKqOs0WRIVdNMN12Jw7COZ FVQMfPoZ0h5x0cFG0Z9WY0uT5Hp0zqIxpVoCNdwBTExy689NFmyPnNG3yNlT+FuggQJY PcUzwOPS1IslA3+lNcHct75qRyTW9ivKIgWwcPwxQoEltGGD4o6tV3kE9jPcvQfhuuXA O6Owucb4wqQ+RuictebWz50p1Hg4HXq7M3petBX90hlXHPZpAra0SIB2ZVih0uotmjgi REWg== 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=wfBdHlbPhe9JJVFJ53u2WB3aTeFtdCK9M9opKH7jl0E=; b=okNNOdfXgXFY73b5q4FHU6AiFgY3OJ5dwI4Sbj76ettzEFsCsCwZ4GPNB3909E6Elr hGNHLeLO8nE1mLj9HLgUKaC4TiWnaC0qsJFKVMDDsTTfKcDaLOjmK9gSzEvS2Nh7ULVL ZV90CXp7uhksNmlHV+832IdWrFK+p03dtLwFPA/yx4dzl21B4ZzDvXnTiVIB0RztSEii cWfmcvRyMVZx6TxWeBp6cGkoPrGCMYZk6yYGF7oqGJb1yWzHDwp8wqePtw+zY3CZn1Jg j5LsdFoFFDhQ8iOl7M5JKhvRFjPZaqL1K2EXrQ1e/Ik0BsnoSlHgLZR07hb05jCL02fG yd4Q== X-Gm-Message-State: AOAM530gyZIKw/nI6zkc0kSTEpqrBr7HD2JD2z2cQ4YLEUmYgLGp/VWC 2shrEXw3ypVcr3k+eRnTNbafola7pu9Dq9saVdfZ9A== X-Google-Smtp-Source: ABdhPJw1Jgdy43yhmaRwTd0pdcF+MsZsBqxx4SqJd+UJxoXstrUpJMKOObpVqUZhNvBXniG6D6ajQpMGbSb4nXVH30o= X-Received: by 2002:adf:f0d0:: with SMTP id x16mr5603702wro.162.1610472990153; Tue, 12 Jan 2021 09:36:30 -0800 (PST) MIME-Version: 1.0 References: <20210111170622.2613577-1-surenb@google.com> <20210111172213.ab4185a1de916c35f3245021@linux-foundation.org> In-Reply-To: <20210111172213.ab4185a1de916c35f3245021@linux-foundation.org> From: Suren Baghdasaryan Date: Tue, 12 Jan 2021 09:36:18 -0800 Message-ID: Subject: Re: [PATCH v2 1/1] mm/madvise: replace ptrace attach requirement for process_madvise To: Andrew Morton Cc: Jann Horn , Kees Cook , Jeffrey Vander Stoep , Minchan Kim , Michal Hocko , Shakeel Butt , David Rientjes , =?UTF-8?Q?Edgar_Arriaga_Garc=C3=ADa?= , Tim Murray , linux-mm , selinux@vger.kernel.org, Linux API , LKML , kernel-team Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jan 11, 2021 at 5:22 PM Andrew Morton wrote: > > On Mon, 11 Jan 2021 09:06:22 -0800 Suren Baghdasaryan wrote: > > > process_madvise currently requires ptrace attach capability. > > PTRACE_MODE_ATTACH gives one process complete control over another > > process. It effectively removes the security boundary between the > > two processes (in one direction). Granting ptrace attach capability > > even to a system process is considered dangerous since it creates an > > attack surface. This severely limits the usage of this API. > > The operations process_madvise can perform do not affect the correctness > > of the operation of the target process; they only affect where the data > > is physically located (and therefore, how fast it can be accessed). > > What we want is the ability for one process to influence another process > > in order to optimize performance across the entire system while leaving > > the security boundary intact. > > Replace PTRACE_MODE_ATTACH with a combination of PTRACE_MODE_READ > > and CAP_SYS_NICE. PTRACE_MODE_READ to prevent leaking ASLR metadata > > and CAP_SYS_NICE for influencing process performance. > > It would be useful to see the proposed manpage update. > > process_madvise() was released in 5.10, so this is a > non-backward-compatible change to a released kernel. > > I think it would be OK at this stage to feed this into 5.10.x with a > cc:stable and suitable words in the changelog explaining why we're > doing this. Sure, I will post another patchset that will include manpage update and will CC:stable. That's of course after Michal's concerns are addressed. Thanks! > > Alternatively we could retain PTRACE_MODE_ATTACH's behaviour and add > PTRACE_MODE_READ&CAP_SYS_NICE alongside that.