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=-6.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 9DFDFC07E95 for ; Fri, 2 Jul 2021 23:31:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3C9A161422 for ; Fri, 2 Jul 2021 23:31:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C9A161422 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A055C6B0011; Fri, 2 Jul 2021 19:31:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9DBA96B0036; Fri, 2 Jul 2021 19:31:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 87C8B6B006C; Fri, 2 Jul 2021 19:31:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0106.hostedemail.com [216.40.44.106]) by kanga.kvack.org (Postfix) with ESMTP id 6292D6B0011 for ; Fri, 2 Jul 2021 19:31:33 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id F1B4B182A6C9B for ; Fri, 2 Jul 2021 23:31:32 +0000 (UTC) X-FDA: 78319246824.29.FAB88FE Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by imf04.hostedemail.com (Postfix) with ESMTP id A5E5E5000098 for ; Fri, 2 Jul 2021 23:31:30 +0000 (UTC) Received: by mail-pg1-f169.google.com with SMTP id v7so11389636pgl.2 for ; Fri, 02 Jul 2021 16:31:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=4RgxpSUmeNYw37wLP1txgl1j/I61lxg9dBYUCNf/TkY=; b=TCzxWXOta/Z78+kMSBk5ORXKcK5q/EnV0Jm553jkFSytzbo2UWj/b1we+pb6MTX6ZO tYrMaAjtSHOSFfF7ENiKpF5DjHyi4GwfP+iNroIsOZkZhJzPx90f2W4xSSP7Pbk4kGe3 k/ZG6MyaHHHvzvxNhnuL0CPKo97K5IDZkRbGg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=4RgxpSUmeNYw37wLP1txgl1j/I61lxg9dBYUCNf/TkY=; b=rMmCEH7Up40IUVuEFGs16D1TkDsJKrO6bcnPzzWrc/+kJRL3rCjhfw8H8X1MZm7KQW m70X+IJKpHBqpiSuOL1e6fJ5n17ogr8CIkREDb7K/J/qlh7/0bli9TRz8OKTIlZ0WpCc Q5CJwpVn8pIe9u+N4ZKoCFICzP6ue1A/8guIOjfDd0qCOnbDKApO/vcLpQw4oIFWC2tM XsXklr2kjiqokE7oj1FNg+vvUF0QEhEOTFPkP/VSUTvbQoz7rC+EwYyRjb77qpTGqVMa SeU0rHuH+DMAkfDyP1JGAhjm8thqKMqd0NMleJHCROfhTWjMWl7ytmlPrZT67jwP+fNx 1NYA== X-Gm-Message-State: AOAM532ruZBQwtJL8GIkX1WUbXeyVopunzmglXpnoHU2zz6covDWg2HU BBihsbOd22ANmu6c2ijhRqPUJA== X-Google-Smtp-Source: ABdhPJw0TQZJ5BpJHyCRBO8TMGnv404m8Hu8rwVxZMVH+G9biu3SfRgZIrkvPX53nJm4X2JQHvIZMQ== X-Received: by 2002:a63:1a4f:: with SMTP id a15mr2324055pgm.313.1625268688123; Fri, 02 Jul 2021 16:31:28 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d127sm4547508pfc.50.2021.07.02.16.31.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 16:31:27 -0700 (PDT) Date: Fri, 2 Jul 2021 16:31:26 -0700 From: Kees Cook To: "Eric W. Biederman" Cc: Linus Torvalds , Andrew Morton , Alexey Dobriyan , Andrei Vagin , Bernd Edlinger , Christian Brauner , Christian Koenig , Jonathan Corbet , Helge Deller , Alexey Gladkov , hridya@google.com, jamorris@linux.microsoft.com, Jann Horn , Jeff Vander Stoep , Kalesh Singh , Linux-MM , Mauro Carvalho Chehab , Michal Hocko , Minchan Kim , mm-commits@vger.kernel.org, Randy Dunlap , Suren Baghdasaryan , Szabolcs Nagy , Al Viro , Michel Lespinasse , Matthew Wilcox Subject: Re: [patch 142/192] procfs: allow reading fdinfo with PTRACE_MODE_READ Message-ID: <202107021626.913478E@keescook> References: <20210630184624.9ca1937310b0dd5ce66b30e7@linux-foundation.org> <20210701015444.ZOZaFPX0b%akpm@linux-foundation.org> <202107021047.CC57ED634@keescook> <87pmw0ih4e.fsf@disp2133> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87pmw0ih4e.fsf@disp2133> Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=TCzxWXOt; spf=pass (imf04.hostedemail.com: domain of keescook@chromium.org designates 209.85.215.169 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: A5E5E5000098 X-Stat-Signature: ks9h5qpduax59bw99r61jgkrx7tj6deg X-HE-Tag: 1625268690-832279 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 Fri, Jul 02, 2021 at 03:40:49PM -0500, Eric W. Biederman wrote: > Linus Torvalds writes: > > > On Fri, Jul 2, 2021 at 11:43 AM Kees Cook wrote: > >> > >> Uhm, this is only checked in open(), and never again? Is this safe in > >> the face of exec or pid re-use? > > Exec does not change the file descriptor table. Ah yeah, good point. I've been thinking too much about vmas. > The open holds a reference to the proc inode. The proc inode holds the > struct pid of the task and the file descriptor number. References using > struct pid do not suffer from userspace pid rollover issues. Okay, cool. > So the only issue I see is file descriptor reuse after an exec, > that changes the processes struct cred. Right -- the info leak would be snooping on what a privileged process was doing with a given fd? Similar stuff has been used to do typing pattern analysis with login passwords, but that's a stretch here, I think. Hmm. > Assuming we care it would probably be worth a bug fix patch to check > something. Sounds good. -- Kees Cook