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, 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 2A933C433E0 for ; Wed, 13 Jan 2021 14:22:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9F76B233FB for ; Wed, 13 Jan 2021 14:22:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F76B233FB Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 29E578D005B; Wed, 13 Jan 2021 09:22:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 227878D002E; Wed, 13 Jan 2021 09:22:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 117198D005B; Wed, 13 Jan 2021 09:22:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0152.hostedemail.com [216.40.44.152]) by kanga.kvack.org (Postfix) with ESMTP id E8CD68D002E for ; Wed, 13 Jan 2021 09:22:04 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A672C1EE6 for ; Wed, 13 Jan 2021 14:22:04 +0000 (UTC) X-FDA: 77700966168.09.aunt02_0f07bf42751e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id 8C4E6180AD815 for ; Wed, 13 Jan 2021 14:22:04 +0000 (UTC) X-HE-Tag: aunt02_0f07bf42751e X-Filterd-Recvd-Size: 4240 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Wed, 13 Jan 2021 14:22:03 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1610547723; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YaJyrouPpgNEF+Q5LLB84J7mSoEpwJTbsWHp0jr/WhE=; b=nYxkz9Sq6tjTWZXiRBdUWWSzCCX6BtDKVlPAHOePb5A1L1HZPs7t55Upu+WK3pf4UFzwzb hCGFVYpzluAZT3bz0KONs0OSTUQaoUkunsNqL2ljnKSgfYvpNgZ2IvFKtI2lfR4OZBVAqd BP5XaBj2yUWfuZ3R4CjoSDXcuc9kdmE= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DC4B3B8DA; Wed, 13 Jan 2021 14:22:02 +0000 (UTC) Date: Wed, 13 Jan 2021 15:22:02 +0100 From: Michal Hocko To: Suren Baghdasaryan Cc: Oleg Nesterov , Andrew Morton , Jann Horn , Kees Cook , Jeffrey Vander Stoep , Minchan Kim , Shakeel Butt , David Rientjes , Edgar Arriaga =?iso-8859-1?Q?Garc=EDa?= , Tim Murray , linux-mm , selinux@vger.kernel.org, Linux API , LKML , kernel-team Subject: Re: [PATCH v2 1/1] mm/madvise: replace ptrace attach requirement for process_madvise Message-ID: <20210113142202.GC22493@dhcp22.suse.cz> References: <20210111170622.2613577-1-surenb@google.com> <20210112074629.GG22493@dhcp22.suse.cz> <20210112174507.GA23780@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Tue 12-01-21 09:51:24, Suren Baghdasaryan wrote: > On Tue, Jan 12, 2021 at 9:45 AM Oleg Nesterov wrote: > > > > On 01/12, Michal Hocko wrote: > > > > > > On Mon 11-01-21 09:06:22, Suren Baghdasaryan wrote: > > > > > > > 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. > > > > > > I have to say that ptrace modes are rather obscure to me. So I cannot > > > really judge whether MODE_READ is sufficient. My understanding has > > > always been that this is requred to RO access to the address space. But > > > this operation clearly has a visible side effect. Do we have any actual > > > documentation for the existing modes? > > > > > > I would be really curious to hear from Jann and Oleg (now Cced). > > > > Can't comment, sorry. I never understood these security checks and never tried. > > IIUC only selinux/etc can treat ATTACH/READ differently and I have no idea what > > is the difference. > > I haven't seen a written explanation on ptrace modes but when I > consulted Jann his explanation was: > > PTRACE_MODE_READ means you can inspect metadata about processes with > the specified domain, across UID boundaries. > PTRACE_MODE_ATTACH means you can fully impersonate processes with the > specified domain, across UID boundaries. Maybe this would be a good start to document expectations. Some more practical examples where the difference is visible would be great as well. > He did agree that in this case PTRACE_MODE_ATTACH seems too > restrictive (we do not try to gain full control or impersonate a > process) and PTRACE_MODE_READ is a better choice. All that being said, I am not against the changed behavior but I do not feel competent to give an ack. -- Michal Hocko SUSE Labs