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,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 C7E1AC433E0 for ; Tue, 12 Jan 2021 17:51:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 411A5222F9 for ; Tue, 12 Jan 2021 17:51:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 411A5222F9 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 96A936B0085; Tue, 12 Jan 2021 12:51:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F1346B0087; Tue, 12 Jan 2021 12:51:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7B8786B0088; Tue, 12 Jan 2021 12:51:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0194.hostedemail.com [216.40.44.194]) by kanga.kvack.org (Postfix) with ESMTP id 5C6126B0085 for ; Tue, 12 Jan 2021 12:51:39 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D2B6F362E for ; Tue, 12 Jan 2021 17:51:37 +0000 (UTC) X-FDA: 77697865434.05.music27_0b10da627517 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 9DB5A180339D5 for ; Tue, 12 Jan 2021 17:51:37 +0000 (UTC) X-HE-Tag: music27_0b10da627517 X-Filterd-Recvd-Size: 4889 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Tue, 12 Jan 2021 17:51:36 +0000 (UTC) Received: by mail-wr1-f45.google.com with SMTP id r3so3452738wrt.2 for ; Tue, 12 Jan 2021 09:51:36 -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=dc9D9kzGZ2ZA5/IGxy9YXdBrDfjCBmJRySfS8jH0QkE=; b=nxSORGEdGJuIC6RLk0S+VmYqG+YT4lluF3NVUR1z++pI98NKE+pXWwDACJZZ2nUvwI I67AS1SNRhL7719zYR/pF2yF3nzxBx6C0WeTJiQvh9HG6EIdZLrNnKow7p/6X7h+nFNC ZSApO2FLIy8W6GSdlvaR2xhcCEdxDfZAoLcRoDHjJZncFmLnv3rT4eqFZ5Y83tP1hmy1 kTzVUAhUtJ0OtwbnMCYtSnzEBOOCDlpqqDtQsOF0Fd/nBPcjsm5jnUZOt4hKcOVXqyOw EadOO9S/jLj1qbBscMSW1rvOUp7/TejOZjuBAUnhsMHid0BQ8/wo+DRMxevlxEDfnF/e ishg== 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=dc9D9kzGZ2ZA5/IGxy9YXdBrDfjCBmJRySfS8jH0QkE=; b=iXHBN4u0ADehDNRpIA+x5UigRs84eG89pKA2irfu0imLdQuwaYXVzO0/ZDFSDLFSzK O//pPIvL59ejIVEPJoretXLF+Sbp1ry72BG05cSlD6iz+uUqX02tkoXDR4o5iFbUA5ys cH96Ho0dWp63S0QXrvHHSl+IKfA4SQ1DXhfo1SSmoOS38FsCYQyzVWUi2AQpqn7GMnoI VrQm2OYXHGVEV3sqAHB1e4Gjl8wu4Y1ag9pQ/3USuV7MRrFKUkaNvfNGFxmn1rSwq/BG Z7jOSaCFRrHdKzRA6ttpBPdsUmoK2A7BsqgBaG8CAgGu/Ff8uhOz0hRZvUi3G8O7bRiS zZ3A== X-Gm-Message-State: AOAM530bsUPhlTyH0amN02vkdFPFO3lX4o1AAcXdEvDv2YG68x3AXkog m4UHII8Tk7MBJp/jsO8hwPM91B0a8c6T/BG79Vfjiw== X-Google-Smtp-Source: ABdhPJzkme70rMBhPR9VaW82DTpFY95K7cDVRzDE3XVA/6rKYEEwL46QI1MREMV9yXBdxUBbkF5ZIioCwWcFrJ4vd8E= X-Received: by 2002:a5d:6a83:: with SMTP id s3mr26097wru.334.1610473895539; Tue, 12 Jan 2021 09:51:35 -0800 (PST) MIME-Version: 1.0 References: <20210111170622.2613577-1-surenb@google.com> <20210112074629.GG22493@dhcp22.suse.cz> <20210112174507.GA23780@redhat.com> In-Reply-To: <20210112174507.GA23780@redhat.com> From: Suren Baghdasaryan Date: Tue, 12 Jan 2021 09:51:24 -0800 Message-ID: Subject: Re: [PATCH v2 1/1] mm/madvise: replace ptrace attach requirement for process_madvise To: Oleg Nesterov Cc: Michal Hocko , Andrew Morton , Jann Horn , Kees Cook , Jeffrey Vander Stoep , Minchan Kim , 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 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. 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. > > Oleg. >