Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2419282pxb; Mon, 11 Jan 2021 09:09:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJzYZRVC2KHxlHwT0FNDE6zgnLzWDB9LedvCOHhczFrnENgcuaeYruxqkLqeH4+IHAPd0zky X-Received: by 2002:a17:906:56ca:: with SMTP id an10mr319621ejc.498.1610384960133; Mon, 11 Jan 2021 09:09:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610384960; cv=none; d=google.com; s=arc-20160816; b=E3AdUKkpuAMwXZ13V2IFNXYKKH6HYGsfo4Qteav6kE7Bx+Vc5GYkj5KMwm+ulC1ilP LmEh+HYpyvOhDIzgHR6n9F0yGRNfil4dkLhW5rAxN7r8IPLJwTk9AsSGIqZVNAodYFc9 4sKNEGkaBInFd3JGUUexc4TRnQaqskHw5N3Ist17qStB90hGyXILbJ7rCWZD6fx/yV+K 6erHJdXt2mD+TZJpwzi6qCbiEFZ/Q5FSlmGYAYpgIxA6VKSnuOvc1/oWhp29FNoKEIwA AbPFZcYKt/9A3RJgw6eSjh1wqe7za0a4d48xCcGtn7RBvgrKv2rwZ1pYRQV0ZbGCgYGf qdXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=zHu1ckVRAMWx4RepAlDhc0i4dSbBejVwjp9wkCsGwWQ=; b=UkAGcRifJJ0sXNOAeJtxVqJ3jgZIZKFY1VMKoRrbViuN8q4p/6ttsbB+p7w5YQRLZS HvK9NgwUGPCLj/aOeTODqhMgurVNMRYUgTyhnxWbIKqZ86CWNStmB0OHoiyjkPCLtZQR 2cTBlaM8y+j9Wk4VhkfE6WhbL5Yr6Z9Mt2uXkOytRZhs3cXWc2nxWFYDtUIdxljWTlgn hSgXztev9utaokSw1mrgnSKhJn0QV3z3h26mCo2EM1+Oerj7OhjG5GKWgDyzf+LFggHG H0Llrls7KfWUHHjxw5hv7gNs9yap5SxQadUg7votvtkfV7dD+dH1lAiYkx/uq5A3AYEz TyjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=U8DCHxOZ; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id si7si30366ejb.5.2021.01.11.09.08.56; Mon, 11 Jan 2021 09:09:20 -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=@google.com header.s=20161025 header.b=U8DCHxOZ; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389052AbhAKRGb (ORCPT + 99 others); Mon, 11 Jan 2021 12:06:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730342AbhAKRGa (ORCPT ); Mon, 11 Jan 2021 12:06:30 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A0D7C061795 for ; Mon, 11 Jan 2021 09:05:50 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id c133so439744wme.4 for ; Mon, 11 Jan 2021 09:05:50 -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=zHu1ckVRAMWx4RepAlDhc0i4dSbBejVwjp9wkCsGwWQ=; b=U8DCHxOZsNnXyHsqGt/aEYsvKCWeeNiemmjB41i5nfiN+qhhV7UhvWucy4ZZ50W9ya zKysXo93jowfFFeokf0s7lG6rUakqE5kd4+DIk3XeUI36UidX0kc5ti1qRvvCgO9UO2x hVPp85Jhh4Gm7ZelMM25WPtS/jQSC3s95fnmdSfFQMjFuZEKGaO5AO9uEASvwk/Xfn8z +VjqUJXYp3t6IpE1sBc3MFGU/NsX2HFZL0Ff9MqF+LiUYQp2t9JXTlbkYyYTvEB/OzhZ mpPlpyGqFACMFjZgtADlHwln/yvk6eFkGGVyuPBvaBIlfDJo8hEO+EtFZ6IJVKxpdUye t33A== 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=zHu1ckVRAMWx4RepAlDhc0i4dSbBejVwjp9wkCsGwWQ=; b=cmADLkEqq7V++a97j+LooT8uYctLAJR2/zkxrNzxEh8WxZnLM4LwcbzegjOZhFrI0Y afp5NUPkzO1rpesfj9PhqAxjbMhuBBiPOx3xL1gJHfsfntnC4w+T8bLeYq2AeMXRm+jM /wtlwASNOlURxBO76i/DrvIHiA67GgRENDxfjas0mBe56N2DZzvas9v1sPGTEkRYF1LE jKfm7f8e86pLUIl+t09ud53SXyYexZ3GlvduRtWnlEpmvpUofDXAB916gIP8s1injxHg oGhWmfkylGoolu5CJ6B2YNPFLqLZcddBRj2vZjdoik/7AqXC62tzXLnwYihLbs7y6vBE CIZw== X-Gm-Message-State: AOAM531BR9mAIbBgdiiAIwliA/v38ttSvad9BhuDrsBbCTrUDFPndK9U WEGXmcvXabWExQggsBBLPKOAIS/nEdsdM4oMayzfUQ== X-Received: by 2002:a7b:cc94:: with SMTP id p20mr612383wma.22.1610384748638; Mon, 11 Jan 2021 09:05:48 -0800 (PST) MIME-Version: 1.0 References: <20210108205857.1471269-1-surenb@google.com> <875z43rd0u.fsf@oldenburg2.str.redhat.com> In-Reply-To: <875z43rd0u.fsf@oldenburg2.str.redhat.com> From: Suren Baghdasaryan Date: Mon, 11 Jan 2021 09:05:37 -0800 Message-ID: Subject: Re: [PATCH 1/1] mm/madvise: replace ptrace attach requirement for process_madvise To: Florian Weimer Cc: Andrew Morton , 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 11, 2021 at 2:20 AM Florian Weimer wrote: > > * Suren Baghdasaryan: > > > diff --git a/mm/madvise.c b/mm/madvise.c > > index 6a660858784b..c2d600386902 100644 > > --- a/mm/madvise.c > > +++ b/mm/madvise.c > > @@ -1197,12 +1197,22 @@ SYSCALL_DEFINE5(process_madvise, int, pidfd, const struct iovec __user *, vec, > > goto release_task; > > } > > > > - mm = mm_access(task, PTRACE_MODE_ATTACH_FSCREDS); > > + /* Require PTRACE_MODE_READ to avoid leaking ASLR metadata. */ > > + mm = mm_access(task, PTRACE_MODE_READ_FSCREDS); > > if (IS_ERR_OR_NULL(mm)) { > > ret = IS_ERR(mm) ? PTR_ERR(mm) : -ESRCH; > > goto release_task; > > } > > Shouldn't this depend on the requested behavior? Several operations > directly result in observable changes, and go beyond performance tuning. Thanks for the comment Florian. process_madvise supports only MADV_COLD and MADV_PAGEOUT hints which are both non-destructive (see process_madvise_behavior_valid() function). Maybe you meant something else by "observable changes", if so please clarify. Thanks, Suren. > > Thanks, > Florian > -- > Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn, > Commercial register: Amtsgericht Muenchen, HRB 153243, > Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. >