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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS 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 25555C433E6 for ; Tue, 12 Jan 2021 01:22:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BEB8522EBE for ; Tue, 12 Jan 2021 01:22:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BEB8522EBE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3E88D6B027F; Mon, 11 Jan 2021 20:22:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 399AA6B02A2; Mon, 11 Jan 2021 20:22:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2B0DB6B02A3; Mon, 11 Jan 2021 20:22:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0170.hostedemail.com [216.40.44.170]) by kanga.kvack.org (Postfix) with ESMTP id 17B206B027F for ; Mon, 11 Jan 2021 20:22:16 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id DDFF6362B for ; Tue, 12 Jan 2021 01:22:15 +0000 (UTC) X-FDA: 77695372230.16.trees56_0b0f6f727511 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id C0E29100E6903 for ; Tue, 12 Jan 2021 01:22:15 +0000 (UTC) X-HE-Tag: trees56_0b0f6f727511 X-Filterd-Recvd-Size: 3125 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Tue, 12 Jan 2021 01:22:15 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id D4FD122E02; Tue, 12 Jan 2021 01:22:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1610414534; bh=fLNQgllo3ZCC89DtTE5b6OoK2bTVUyylbTOPyId0eV4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=obUs4N4o5mwnHVY9rYZZwXnXS8Rn/+2bqeLExSBNmLFsy9ruDGHnQziwu81t3OtpB PCgTuMFGUgwQ4wliyDaARt6hTTmnxw/q/pER+IErGNWBm56XeOCFS8usUIIULFFbFS agjczPAoQHs0WnCYRFSNbfsIqDiUY4VZ6Mq3u99c= Date: Mon, 11 Jan 2021 17:22:13 -0800 From: Andrew Morton To: Suren Baghdasaryan Cc: jannh@google.com, keescook@chromium.org, jeffv@google.com, minchan@kernel.org, mhocko@suse.com, shakeelb@google.com, rientjes@google.com, edgararriaga@google.com, timmurray@google.com, linux-mm@kvack.org, selinux@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v2 1/1] mm/madvise: replace ptrace attach requirement for process_madvise Message-Id: <20210111172213.ab4185a1de916c35f3245021@linux-foundation.org> In-Reply-To: <20210111170622.2613577-1-surenb@google.com> References: <20210111170622.2613577-1-surenb@google.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000043, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. Alternatively we could retain PTRACE_MODE_ATTACH's behaviour and add PTRACE_MODE_READ&CAP_SYS_NICE alongside that.