Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4891880imm; Tue, 31 Jul 2018 01:46:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdyEviQMjuXQtI4jB2qLRx4GFtBub8l3eiu+EjLhVZf8S03fH0AzMWWVagl7kG/24UxvjbH X-Received: by 2002:a62:51:: with SMTP id 78-v6mr2019578pfa.135.1533026773376; Tue, 31 Jul 2018 01:46:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533026773; cv=none; d=google.com; s=arc-20160816; b=rMNLSId5S10KR5L7FytIzKOEdol48mHcVxRT5sM0kY5f/XTJFfE3gOPOKa1WY9zLCy GfmgmTOKrOeFf4K+/DZGc9+rG3RQbZvft1GLDXzNt9Smny6JhpvbGFVPqnLMlcGotkFG C3FVziz6EMYtPcn2NF+p5MDMMgpH67SkkxGF7WM/xgSUGmYYA2zyeCItTK8KC2HU+Spf 9BSeHb6QljnsHLnEu+r3YjBITUoJ2Fx2wUdjxvslpJDlwjNPXR5NYKf0sPmJ987BV49R ZruUQw3Nz1il44Fhl9ooeLo9d9Dea6pw5h3S1qxKyv2PPpUgkagsjzv250PVNOJebZCF 423w== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=y/S/8t87oaC2EBEMbM45S5rybsFc5/ycCKWIcl6QofU=; b=N3RRAo2Rtt/zimUXFhAp3ldDjg/O5rAblbyGYVE/V95C0wHv56migSB+aEotwSv9mA evHS2wwOA7HY0Q6omccv7b9j733Jz9r+3INpoLSI6GewhStM4QnrgTeC4hHaAnxvdfOC xEBz9BdC3XABhS6dDd+ForxwU1Ks6BUUxw+IJvBMZ9NwIhutn3+VZX5U89lCq9l/gYzs vvVgQwX0w+Qbcq26KTKLxvSzFNn22QNZtfCy08GAkJaM5E68P4CvcalG9KqCruXVy3ec pclxqR+2v+dIHsFrcOAlZOV+HCCs7Uzx8PBVSqTM4ToK0ScHA91ajZ4fzAeQhjkhpgGN P3gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=FZ794N57; 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=NONE sp=NONE dis=NONE) header.from=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w15-v6si11589780plq.455.2018.07.31.01.45.59; Tue, 31 Jul 2018 01:46:13 -0700 (PDT) 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=@android.com header.s=20161025 header.b=FZ794N57; 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=NONE sp=NONE dis=NONE) header.from=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731659AbeGaKXu (ORCPT + 99 others); Tue, 31 Jul 2018 06:23:50 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:37008 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731428AbeGaKXt (ORCPT ); Tue, 31 Jul 2018 06:23:49 -0400 Received: by mail-io0-f195.google.com with SMTP id z19-v6so12285761ioh.4 for ; Tue, 31 Jul 2018 01:44:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=y/S/8t87oaC2EBEMbM45S5rybsFc5/ycCKWIcl6QofU=; b=FZ794N57KPW+MibMDJfuGaObupM2wXWofMViQab5fS1rxPUgbBpPiGGVpYRQsk8olK 5P0aotFOSs7MNH7aclSQr9CZ0NlmQ+DW3KEfje05Eq0lE/1TeOdOI5nisxytn4jc71gl A6DgZvU3JN/3UmvaBiazTleF36lKeDQEVGjeRFn6lrs+pEs36x1QUV+4HpUcJ/sE34wL 8oNNJP9mgbofYDD79S1n4AyshSA995r3GSa6U1m1+oFbGRw/DrXme3PsNGOjBMYnYKH2 /Tydjm7zn7Ba8C56q7gTyaiJLrQiSG+Yrrlu3qxpsWesIAxde85sIMudokTf+2fvIra0 dl8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=y/S/8t87oaC2EBEMbM45S5rybsFc5/ycCKWIcl6QofU=; b=J5F8ro3m9yKAJ5vLF5SYG6RAaUfP0X9Pk1UD3sYqorn0sev+oGAh77teRUyVUbEtgx 1judzLtz/nU9sgH+9SmwWVltWkFG8W/0dfZ9q9sYMb9K6kdOCVGlFfLe6/9LaLZpPyXI NGUWbXOwPL84wMB7tchU1PqJoVtqnlMGJIAUGG8/3ddJr1A4T6jD35yu02+f/oCHYxgD BDzv0nNuJG+XfZdZS6PzTVQdHVAgtGJX3TnmC+OOnXkEmdg7eLc3W0WGyIc8Z3Jjs2Iv xo/rrrKJ8aL5XnaqAWmSorgSe3/mWyp/Cwcqi1gMuUaAm8+I3ZmFRXdQfB5N2j71a6uJ KpSg== X-Gm-Message-State: AOUpUlF0/UDeJBif59TAP0373eN68henldsIg/ah2OxiyzJLJMRuxcD5 EcTnhKSq/yB7fOL8Zy8Sm1bAPZpurA2Nie0iVC8mFw== X-Received: by 2002:a6b:b284:: with SMTP id b126-v6mr16102320iof.201.1533026674026; Tue, 31 Jul 2018 01:44:34 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:bb58:0:0:0:0:0 with HTTP; Tue, 31 Jul 2018 01:44:33 -0700 (PDT) In-Reply-To: <20180730203633.GC12962@bombadil.infradead.org> References: <20180730143710.14413-1-christian@brauner.io> <20180730143710.14413-2-christian@brauner.io> <20180730163155.GA27761@infradead.org> <20180730203633.GC12962@bombadil.infradead.org> From: Martijn Coenen Date: Tue, 31 Jul 2018 10:44:33 +0200 Message-ID: Subject: Re: [PATCH 1/4] file: export __alloc_fd() To: Matthew Wilcox Cc: Christoph Hellwig , Christian Brauner , Al Viro , linux-fsdevel@vger.kernel.org, LKML , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , Todd Kjos , rlove@google.com, ben@decadent.org.uk 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 Mon, Jul 30, 2018 at 10:36 PM, Matthew Wilcox wrote: > I'm not entirely sure I understand the binder code (... does anyone?) > but from what I can see, it intends to open a file descriptor in the > process which is the target of the message being sent. You're right. > That strikes > me as wrong-headed; it should be allocating a struct file and passing > that file to the other process. When that process receives the message, > *it* allocates a file descriptor for itself.ho We're looking into cleaning this up (historically it was done this way because VIVT caches made this not very efficient), and this is indeed a very good candidate for fixing it. > > But I think the binder user-space API relies on this. The userspace API > seems to rely on passing fd numbers around ... but I'm having trouble > figuring most of this user API out. Perhaps Martijn can help here. The UAPI does expect a file descriptor, but we may be able to do the mapping from fd to struct file (and vice-versa) in the kernel driver, so userspace wouldn't notice. Thanks, Martijn