Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1091566ybl; Fri, 6 Dec 2019 11:07:13 -0800 (PST) X-Google-Smtp-Source: APXvYqwWnEdffr0xhpbLv7F+DqywGUrveLKkEBTAY+JfQb0YDD7ifLZP3n6w9E64Reuuqxj/YB1b X-Received: by 2002:a9d:6216:: with SMTP id g22mr10988020otj.260.1575659233218; Fri, 06 Dec 2019 11:07:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575659233; cv=none; d=google.com; s=arc-20160816; b=bklHhsqCjXr7eUfZJkV8WkWlxEwCi8yjj6q22J2u8zfh5nxBAs9MAuBGi82zDl1fKY /Px0aHcId0yLbC3w5IpmbEGYnyle0kqWwNpaOBSvQN8RLw5owRgHWAamKkRIybwIJgOc 8YHUQn34WJ1jLNrJ6Cdkt9zFh+XgK5XnHobafadAgUrGrsL5I4C7EVmEZf/vY5yYpCd2 foMb/NFrhJIhd2/g+TKkSkOFeS3nqDDDKn8opj9GeVh1e/O+aUm/jgq4ifQ6Yx0n0a8G SD5jGLgi+4zpq9PES8HIPhxmiLjRNY57s3RNO49dgMN1ohjL92Lm11pVUDW0tjLJexaG eaSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=dCoyUX/5uAtal6ZdIEgcK6WKycD1wXBsD+TcqDOxUhY=; b=AXD0H8eZp5WTpSEy/kBnvsCPQQT0gLcXWjUU+1mlKj1v/GFN+B+36bILUXxhN8M1f4 HFY/yTv5d8Ybz6hysR8qSN+GbkOyIN4674Tk06IsBvoo8VluKRZ6UFyF8Y3zAmuS4GWr JZaKmHW6preW1teeo2AeSMCpa0BuphYWBHXHv1+o8rEO94XvMl+6Bm1sWs4FS4W9NJVW V1MiZ9qtlVQHErM267WEJ71SR1bJB7cjVXsuA4A77wjC/ciuAkCma7FHBIC0nbbg+RM6 dTCGdhX+jHfEf3ECDM00X03fmzADJ4p4bYKud63cDITtZX9tKo8RMGWvEUy+6XO8lV+b bw1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tGna0vMT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id l64si7497909oih.2.2019.12.06.11.07.00; Fri, 06 Dec 2019 11:07:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tGna0vMT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726421AbfLFTG1 (ORCPT + 99 others); Fri, 6 Dec 2019 14:06:27 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:36772 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726336AbfLFTG0 (ORCPT ); Fri, 6 Dec 2019 14:06:26 -0500 Received: by mail-oi1-f194.google.com with SMTP id c16so755091oic.3 for ; Fri, 06 Dec 2019 11:06:26 -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=dCoyUX/5uAtal6ZdIEgcK6WKycD1wXBsD+TcqDOxUhY=; b=tGna0vMTY/fa+Qc8LL2bd+yRBF6a0oSh7cxQKO1GgTha4NjB489UxfAT7ecVTBh2/c Ykjw4+briCdIEQSIm+NkSg5YK/5chS27VUPWc1xiz1cla6LT4OmyvT7datwO/FzuvBcV yBbkGJogk7P0YUFDk1BTSPLLQcbujc+b/m78bCiJGjZ1tN/HoYKzQSm9mFcTZz/hW//Q fUKHHfwbTbea7HberxXWzz0NeX9iDbMzTnzcP1/mUh5EMlFo7nvkOKvjsTMjN/ZCAZG4 QoACZGrEMFHsV/4/XmEgs83tTUzEADDPyJpv2y5ebpeDFUyHSZ9+e95vTEshNK3J2wIf tMRQ== 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=dCoyUX/5uAtal6ZdIEgcK6WKycD1wXBsD+TcqDOxUhY=; b=ephJq++JpEcYndInfFcu8KUDFXoqXKCPD+LOUNQN6L4YOv6oJp0q9H0vNW41rY5z6d go8FjxN52MQ2PVlcIp1iJCVprjEMCs5FReMlO5ZIeR2MhTAqix1vFVJK+O7YtVyKYltU 6LwWjl8+D7hBnSfC7GJTuhZqb8iKmX2nowU5ClyqB5anbbz9e4el0gmv0rwhM+fd5lTq K4xnA4LXCkfg6YxEf2+b8zKev0EzO5r6DxeDHX9wOHYRFpePb6pZX0xEwwPisLsDtD7i AAf0SaM8f4thvOKxGted+N4guZCdqUPeO7QniFQa8zzNEj0ELAGJ93H8M3xF2QTpcIF9 F2eA== X-Gm-Message-State: APjAAAUclILUgz4Vw4Z/rRCAGZAD18SVTXpXHR/Hjx4DU2FRBcOl7nb+ PnZ24kW6CL+GTmPWc1XEtNOHFRaAlU02CSjPeaJ5tw== X-Received: by 2002:aca:4a08:: with SMTP id x8mr14002912oia.39.1575659185815; Fri, 06 Dec 2019 11:06:25 -0800 (PST) MIME-Version: 1.0 References: <20191205234450.GA26369@ircssh-2.c.rugged-nimbus-611.internal> <20191206141045.GA22803@cisco> In-Reply-To: From: Jann Horn Date: Fri, 6 Dec 2019 20:05:59 +0100 Message-ID: Subject: Re: [RFC PATCH] ptrace: add PTRACE_GETFD request To: Sargun Dhillon Cc: Tycho Andersen , LKML , Linux Containers , Linux API Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 6, 2019 at 8:05 PM Jann Horn wrote: > On Fri, Dec 6, 2019 at 8:03 PM Sargun Dhillon wrote: > > On Fri, Dec 6, 2019 at 6:10 AM Tycho Andersen wrote: > > > On Thu, Dec 05, 2019 at 11:44:53PM +0000, Sargun Dhillon wrote: > > > > take action on an FD on behalf of the tracee. For example, this > > > > can be combined with seccomp's user notification feature to extract > > > > a file descriptor and call privileged syscalls, like binding > > > > a socket to a privileged port. > > > > > > This can already be accomplished via injecting parasite code like CRIU > > > does; adding a ptrace() command like this makes it much nicer to be > > > sure, but it is redundant. > > > > > How can you do this if the tracee doesn't have privilege? For example, > > if the tracee doesn't have CAP_SYS_BIND_SERVICE, how could you > > get it to bind to a port that's privileged without taking the file descriptor > > and doing it in a process that does have CAP_SYS_BIND_SERVICE? > > (You can let the parasite send the fd to the tracer via > SCM_CREDENTIALS if you have previously set up a unix domain socket for > this.) Eh, sorry, of course I meant SCM_RIGHTS.