Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1092260ybl; Fri, 6 Dec 2019 11:07:52 -0800 (PST) X-Google-Smtp-Source: APXvYqwINWqc/F6LTT6esyS1vTqBq3JFeBxEpMMAXLE7cbFuiz6ZoPLXftM7TnvLn4Fzikkvq2L6 X-Received: by 2002:a9d:154:: with SMTP id 78mr11888264otu.294.1575659272600; Fri, 06 Dec 2019 11:07:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575659272; cv=none; d=google.com; s=arc-20160816; b=K7VuH0CEWj4sKfnhmOMz5BPHDr6wt3Dv7cLKoRrzbgFHKW8KU1mxfkzmBsbc2e2uZ0 wdYxjw2sYIa4u6PFM824vkDYKZDwy2IyVgcKRMxOFfdDtS+HkHWg7znpeqBEN0DKLOVE tOP/dlIFYk1MsReg+hryAC8pXrIWmNT1V+c7Q7KxwAgtlwWX49lwAwk1HwCGF3M6H13X NSTUjO2Br8v2wmkomiZE29WY4vqJkyvwdjyjpDkGIFcGMy3FU0+jFVaf3KBcPjbuUKEE /qxxqR+MoUuhTu3QsmCQdKvQ1Yi7/aUOp7W6BcHNHMN5+I7WkbD01msPPU8x/zw0YUGq hDVw== 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=Hzdm6u920Zu54Rz956W5+h57WY85ZdtVdfqXsUs3cp8=; b=d38lqMKDMbEmcmV4nGZONVvrduF5Wmy1Skko1m4ZTTrwfemDJ4E1fn0WLnd9EPMspg HOSjvB44uDObmgkFeaXL2Ew1SDuEA4yi8PNtS6/7mTcvCaEi7z9J00ApnYU6O46D++CT qd5ffXgaCUdKIIRbcAhdZoaiZebPFMhKR5A1yhqFhORBM2BloIL3Ui4ieSPG5KOoAk/z iCvmAogRUMUza6CeJ9oVUNwp1bgYOc+Uh/TQXXjZtRPBMauj7pG7uFc/TMPe/zE4CVAO FVka04G8TJJKk4icBLUibfZ418krbnKAnZWAzxBNnuqhZnzCjV7NxrLVE2V7t/RCeaAR jVpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=J4JUk+kA; 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 i185si6478854oia.187.2019.12.06.11.07.39; Fri, 06 Dec 2019 11:07:52 -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=J4JUk+kA; 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 S1726377AbfLFTF4 (ORCPT + 99 others); Fri, 6 Dec 2019 14:05:56 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:36363 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726328AbfLFTF4 (ORCPT ); Fri, 6 Dec 2019 14:05:56 -0500 Received: by mail-ot1-f68.google.com with SMTP id i4so6738284otr.3 for ; Fri, 06 Dec 2019 11:05:55 -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=Hzdm6u920Zu54Rz956W5+h57WY85ZdtVdfqXsUs3cp8=; b=J4JUk+kAi6AePh5EdVHtj8RlKN+OE+UFUQe7FYgJcHltk0WRhaTjkhwU0wmPbDnDYT FHN6EPvuf2yqeZgSsN2mcLncQnH+GKBoisvS0RTjO29r/4ZFHaMZW2oAcLb0fFQ9PCYR 3/m6PxAtt0Myu+OkS0UtrNRV2TBUhDx4ZvrAh7GkEZMz0/Qw7KfWmOxsXZBTbTUzp5hu XWOXwZophPiJ/xN0LrLP0vbeWf5BM2qzWJERF76i7s+q0t0Uqe+aSoj6HoHpKxo8Rkvl avIcEBovZU9/+4BAogk9vMAJ31pOIUmps1j6aWPGKdaa79nyj3uXKg3DqUM7ZBfsm916 yDKw== 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=Hzdm6u920Zu54Rz956W5+h57WY85ZdtVdfqXsUs3cp8=; b=rEisooPwT+HF79abEpANRoyYintbvzFKiZNP17BuIH2XWCxU3jsAM/JnyAi53SHllI XFkiefC0NRgRFuFxWZ6IMlC+vhgESLktKvi9jo6Wkca+GGwXJ8H7ZMlJ6wJsM3shwYXw Tr25VkQZyU92vLdsxpEp27PeXN8rOG4gKZHKrDe9mMr8HEd1jiAP96pPpMKzOyC/+LQC HgsyGmWSgkrMBgq/z4hh1clTJARe8jW9zy8SZ5olkqW8NeL2Tvif0/SNClb1Ya8gQsy9 j4lKoW8M+bNdidApGHoZndFaVpuMX54El6HFR22tFzh4CLdf5CUKOfo9/ovGQBcvtRnx cSqQ== X-Gm-Message-State: APjAAAU4bc55pmPpJ6rR+spuI1bMfRS0CokiJwXdeKJEzdu5jgaY9KIG RwkWpTvhrhIJvVl/LGw5patMTdmIZGwgrcSnTUSCgn5v X-Received: by 2002:a9d:3b8:: with SMTP id f53mr12592920otf.180.1575659154739; Fri, 06 Dec 2019 11:05:54 -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:28 +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: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.)