Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp5714752pxv; Wed, 7 Jul 2021 10:03:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPWewS/jVFURQ1mIkX/71ZnyFIkQQTD7NbZ64A4GtpQQdvZqNuy+BW+9GWnvjMcMPESuzO X-Received: by 2002:a17:907:608c:: with SMTP id ht12mr9601696ejc.12.1625677393323; Wed, 07 Jul 2021 10:03:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625677393; cv=none; d=google.com; s=arc-20160816; b=XkPndsAAZCeb9N/Sa7ItrhbKNV8JCc+G8VFlnuIu9BZk0HYKSDvlSJKNXAX5H0dXfS bnsYbsdaeSt+ohPOsj0Ahacsq5I/na651xkv5QgsVhrcdt7vyeT5T6mKPVk2kdGQ7L11 +IQfoh95ehzhq0MbDjsM/+dARxfL+/geU1PBMhXdJg3NOwILJohzgA/blKCKjedCeawm /B2mZb5gpgSvnNnu5XIlNNc7EmDQJNGp17NGzTUGCgfGFCbiuew3kWf8W0EeYpbEvpkF 1Z4P10JfjbwYTrk2SelSQh/M21m1O/JdD2CJDhZX8s3t44BjHuYgNogS8/Jnw8xJJjHy hQmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1FgxZUvSRRZqC2uDoYLASHigaeaeUnpS4mdboU3aAaw=; b=WYfinbpLLGpXrNv+/pmTEE9f4DNHUzObVaYWfLj846LV9+lersT7xw1OIu54hBe4ou F1ZeetInvsxohlAcuGcdj+OK9qsGGQTqBaSgjnIBr+R6Ow2xudne1XneHhhygzDxdZXn poDVA6KhjOgTDGksQgxZaE80Pmr3hxOaYuW3h2bhumdKW+eHsGh9a9ZLGnpHGdVwv7hN 0a/gZlOipNP2W0KTIRyDiJfsgy9obqa/68jY1LTkOGzAkmeAGrtSbGzE0C88dxCmmtwf u6zfpbDl53ede5PGcmbqecwPSlhK5HWDqu/HCNQrbWbX1WRxf4t7+1TSzsG1oKvzipo8 XJew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d3gXr1iD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ca9si17446045edb.172.2021.07.07.10.02.49; Wed, 07 Jul 2021 10:03:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d3gXr1iD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230262AbhGGRCd (ORCPT + 99 others); Wed, 7 Jul 2021 13:02:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:39458 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230109AbhGGRCa (ORCPT ); Wed, 7 Jul 2021 13:02:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B675061C60; Wed, 7 Jul 2021 16:59:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1625677189; bh=qn7Eyj9XNAOP0U0oSFE2xt0Kb26qGji0dRrK9Ip4e5I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=d3gXr1iDVZxDA44YdE9RPogIGqKBOIX8xYywK93divX8W3Xo0t1NuPIEwQ8Zv+R7M uPyt9h2oIDHVgArGI7BzWaQbVank9hA+OWTz8Tq6u1jW3u3E0d3Y4fxeiw4d8GI42+ YQnrh15EsjFf9cpZSFhefk/mB1EVcA4sDJ+cEh0s= Date: Wed, 7 Jul 2021 18:59:46 +0200 From: Greg Kroah-Hartman To: Carlos Llamas Cc: Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Christian Brauner , Joel Fernandes , Steven Moreland , kernel-team@android.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ANDROID: binderfs: add capabilities support Message-ID: References: <20210707162419.15510-1-cmllamas@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210707162419.15510-1-cmllamas@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 07, 2021 at 04:24:19PM +0000, Carlos Llamas wrote: > Provide userspace with a mechanism to discover binder driver > capabilities to refrain from using these unsupported features > in the first place. Note that older capabilities are assumed > to be supported and only new ones will be added. What defines "new" vs. "old"? Where was the line drawn? > Signed-off-by: Carlos Llamas > --- > drivers/android/binderfs.c | 45 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 45 insertions(+) > > diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c > index e80ba93c62a9..f793887f6dc8 100644 > --- a/drivers/android/binderfs.c > +++ b/drivers/android/binderfs.c > @@ -58,6 +58,10 @@ enum binderfs_stats_mode { > binderfs_stats_mode_global, > }; > > +struct binder_capabilities { > + bool oneway_spam; > +}; > + > static const struct constant_table binderfs_param_stats[] = { > { "global", binderfs_stats_mode_global }, > {} > @@ -69,6 +73,10 @@ static const struct fs_parameter_spec binderfs_fs_parameters[] = { > {} > }; > > +static struct binder_capabilities binder_caps = { > + .oneway_spam = true, > +}; > + > static inline struct binderfs_info *BINDERFS_SB(const struct super_block *sb) > { > return sb->s_fs_info; > @@ -583,6 +591,39 @@ static struct dentry *binderfs_create_dir(struct dentry *parent, > return dentry; > } > > +static int binder_caps_show(struct seq_file *m, void *unused) > +{ > + bool *cap = m->private; > + > + seq_printf(m, "%d\n", *cap); > + > + return 0; > +} > +DEFINE_SHOW_ATTRIBUTE(binder_caps); > + > +static int init_binder_caps(struct super_block *sb) > +{ > + struct dentry *dentry, *root; > + int ret = 0; > + > + root = binderfs_create_dir(sb->s_root, "caps"); > + if (IS_ERR(root)) { > + ret = PTR_ERR(root); > + goto out; > + } > + > + dentry = binderfs_create_file(root, "oneway_spam", > + &binder_caps_fops, > + &binder_caps.oneway_spam); > + if (IS_ERR(dentry)) { > + ret = PTR_ERR(dentry); > + goto out; If this fails, you still report that an error happened, yet you do not remove the directory? Is that intended? And where is this new file documented? Where are the existing binderfs files documented? thanks, greg k-h