Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7544247imm; Tue, 28 Aug 2018 14:09:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZz+aHCdNY6RyIx17oirPH1D9NDicnjF0JNwJJsUPXIQm9rDFtd3tQJc43F3gr5Af1iNFss X-Received: by 2002:a17:902:8b86:: with SMTP id ay6-v6mr3131893plb.25.1535490556555; Tue, 28 Aug 2018 14:09:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535490556; cv=none; d=google.com; s=arc-20160816; b=ANMRXxL35Zp6G4XRm0baHWEOMpgc2oz3yoMnZHqCrAR6HL2nWig/OQluzdi31to/S9 hX2kSe0UnzsSobfBjhyCSNU1dxBuDr/RhjJto6VIPSZzujOCCfSZjYaS3Fo0ZNw5gRoK aybnPxznESc8NjPsAiZrBkXarPOby1KcgvvChPd0NuWg92u3CR2SPH0xkaYKOE93vwa0 QA/lzlG52UwjmGD/O7axbaxiaropmAQxm6xqQoAO45rMFUKkcqlqOWV1J+AUXZrxXg80 1eo7z7R8ECVYzZ2sdQ2+7BR1tvJmvEbiUInkm6qJiR7oQIQ11ABMWgzYn2Qt/nJByf44 7Lcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=+sPVLmGD9/VM4F0wvUJnflGnaEckbrhad9Mt0mk4VH0=; b=i10dhYYjB6F2vkr3w4nq0yiVN2cJf6BLSMosAsjczQHnHpwF/pjc6ZEMatHjACqFIb to1JvRx+Hgrj9pZpaigGCHuRqdZLVk9trBcXDgdm8WsPKN8AlPeupJi9QSKnrnp2LSSE 5o4e1Qm4X3OMkJAQyQXpZbTWcRrUEjvzj3gfM4JxyFi4grQklUCPFiZxLH9gQxaZGB74 XPTnafiyYRueU1jR6gBk9mA2QY87x2Mq8TtVlASsPNHOWsjCOxCwzDuk+M2qzNENRo+y Rkhq0zmKqhzxDtLmkN39im0dvlr8Vv5dR+yOEvS2V7O5fHIsMiUZlFK7Yi0E4/DXwRqK c2yw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 12-v6si1954893plb.203.2018.08.28.14.09.01; Tue, 28 Aug 2018 14:09:16 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727480AbeH2BBC (ORCPT + 99 others); Tue, 28 Aug 2018 21:01:02 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57032 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbeH2BBC (ORCPT ); Tue, 28 Aug 2018 21:01:02 -0400 Received: from localhost (unknown [104.129.192.188]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C91C192F; Tue, 28 Aug 2018 21:07:35 +0000 (UTC) Date: Tue, 28 Aug 2018 14:07:33 -0700 From: Greg KH To: Todd Kjos Cc: tkjos@google.com, arve@android.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, maco@google.com, christian.brauner@canonical.com, ben@decadent.org.uk Subject: Re: [PATCH v2] binder: use standard functions to allocate fds Message-ID: <20180828210733.GB31143@kroah.com> References: <20180828204625.232573-1-tkjos@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180828204625.232573-1-tkjos@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 28, 2018 at 01:46:25PM -0700, Todd Kjos wrote: > Binder uses internal fs interfaces to allocate and install fds: > > __alloc_fd > __fd_install > __close_fd > get_files_struct > put_files_struct > > These were used to support the passing of fds between processes > as part of a transaction. The actual allocation and installation > of the fds in the target process was handled by the sending > process so the standard functions, alloc_fd() and fd_install() > which assume task==current couldn't be used. > > This patch refactors this mechanism so that the fds are > allocated and installed by the target process allowing the > standard functions to be used. > > The sender now creates a list of fd fixups that contains the > struct *file and the address to fixup with the new fd once > it is allocated. This list is processed by the target process > when the transaction is dequeued. > > A new error case is introduced by this change. If an async > transaction with file descriptors cannot allocate new > fds in the target (probably due to out of file descriptors), > the transaction is discarded with a log message. In the old > implementation this would have been detected in the sender > context and failed prior to sending. > > Signed-off-by: Todd Kjos > --- > v2: use "%zu" printk format for size_t Is this really v3?