Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp391432pxb; Wed, 13 Jan 2021 06:23:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBk3dtL/UcGEC9gwCbT1NFD/uvwI4vpy7DQMVfqtIwVY3lvkzH+a4IZrbNw814rwk/l6UL X-Received: by 2002:a17:906:68d1:: with SMTP id y17mr1694573ejr.293.1610547794729; Wed, 13 Jan 2021 06:23:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610547794; cv=none; d=google.com; s=arc-20160816; b=ojEssqIazyj5qChf2R3zrQbs3Ub+LwHOCFvs88TGoWtZFyHf5Rgf9HaK/EdqVwPny6 9YnN23AhOnqRVEwS5of0GGkG38TcWXPZwZZwCY8XX5rhiOZL7Ag0oiWXhNcZYQoTyEYL CNUbUpnt8Kxp/xEZBKfwIyQ4mg07HvLv1cawo0ijt9xQUFYpZnHYNFuTaScbDQIUCLbg Q1FP00PQO494VW4xHo50RJPYEzPaBn3QSfuRWluCz4rjgUT0RdpFr45omhvoKXEDLDtg 5wACAGrKTQO9QXgKXF6o8X82oPCAZnSDskfdkZ21Wy29/q5vy9TN2WHeR7tfyra7idyE qPiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tzRzrPRO0sG/PZufpslx/p2FJilLPOCaqNLlQqECfqs=; b=b5gmG7lj2mos2/d52Mrm08gxdG522YcPAQXcmmX1XZm3VfAesC1Iu41vB24GAuLPh5 SUWicUDBRY6mC0w1GYfkWoS+5JFSIUVtl0m6LWsqUbt8c2wfBEI1+5WuMFlt6HCmqC0j qCRv+Fj16FRAFNChAw5WHzYzxcW7qj03VWKDoD0cC7Cfv/2fjTWa9KXGM9hVCSNxHeTh K420z6qxJb8UhgaFFzFcsmhl9nR1IL9Gn4KhF2p+TPfvFqUw8ADKbBEXF+LUUvTjFqpD EaPYypdmR0nuq2Xl4Aum8pxH0ZtYeCXLgDfYIcNduHmo0E0lt/clJlOO81snAOf4S68Z cO1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=UvQrTaLu; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p11si963139ejb.434.2021.01.13.06.22.49; Wed, 13 Jan 2021 06:23:14 -0800 (PST) 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=@suse.com header.s=susede1 header.b=UvQrTaLu; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725949AbhAMOUV (ORCPT + 99 others); Wed, 13 Jan 2021 09:20:21 -0500 Received: from mx2.suse.de ([195.135.220.15]:53050 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725772AbhAMOUU (ORCPT ); Wed, 13 Jan 2021 09:20:20 -0500 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=1610547573; 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=tzRzrPRO0sG/PZufpslx/p2FJilLPOCaqNLlQqECfqs=; b=UvQrTaLu7nYoCtIzCLWCIYq3tb6NEJPytiVqqoCEKB62YzAOmeqtN2hegBQiDVO8kuaCpj ED+QEXUULnOJw0Q82GfNp8xuiu14SB0JY4+5rscFK53iM4TdmfsvVpT1nk+psAFQR49KZp YY+qRxJrDbcLR1q+7TtV0AO72OyOZyQ= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 750D1AD19; Wed, 13 Jan 2021 14:19:33 +0000 (UTC) Date: Wed, 13 Jan 2021 15:19:32 +0100 From: Michal Hocko To: Suren Baghdasaryan Cc: 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 , Oleg Nesterov Subject: Re: [PATCH v2 1/1] mm/madvise: replace ptrace attach requirement for process_madvise Message-ID: <20210113141932.GB22493@dhcp22.suse.cz> References: <20210111170622.2613577-1-surenb@google.com> <20210112074629.GG22493@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 12-01-21 10:12:03, Suren Baghdasaryan wrote: > On Mon, Jan 11, 2021 at 11:46 PM Michal Hocko wrote: > > > > On Mon 11-01-21 09:06:22, 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). > > > > Yes it doesn't influence the correctness but it is still a very > > sensitive operation because it can allow a targeted side channel timing > > attacks so we should be really careful. > > Sorry, I missed this comment in my answer. Possibility of affecting > the target's performance including side channel attack is why we > require CAP_SYS_NICE. OK. It would be really good to document that in the man page. From the current wording it seems we already rely on this cap for migration on a remote process which is not the same thing but it roughly falls into the similar category. -- Michal Hocko SUSE Labs