Re: [PATCH V3] binder: ipc namespace support for android binder

2018-11-08 Thread Christian Brauner
On Thu, Nov 08, 2018 at 01:02:32PM +, chouryzhou(周威) wrote: > We are working for running android in container, but we found that binder is > not isolated by ipc namespace. Since binder is a form of IPC and therefore > should > be tied to ipc namespace. With this patch, we can run more than o

Re: [PATCH V4] binder: ipc namespace support for android binder

2018-11-12 Thread Christian Brauner
On November 12, 2018 8:45:07 AM PST, Todd Kjos wrote: >+christ...@brauner.io +Martijn Coenen > >Christian, > >Does this patch work for your container use-cases? If not, please >comment on this thread. Let's discuss at LPC this week. I have not received an answer to my questions in the last versio

Re: [PATCH V4] binder: ipc namespace support for android binder

2018-11-19 Thread Christian Brauner
o provide backwards > compatibility for non-container use-cases. > > The etherpad notes are at [2] (look at "Dynamically Allocated Binder > Devices" section) > > Christian Brauner will be sending out more details. Ok, sorry for the delay I got caught up in other work

[PATCH] binder: implement binderfs

2018-12-04 Thread Christian Brauner
ot;name suffix %d\n", device.major, device.minor, device.suffix); exit(EXIT_SUCCESS); } /* Demo */ A demo of how binderfs works can be found under [2]. [1]: https://goo.gl/JL2tfX [2]: https://asciinema.org/a/zYUCqL7OySASWK9S2yVFq2sxM Cc: Martijn Coenen Cc: Todd Kjos Cc

Re: [PATCH] binder: implement binderfs

2018-12-05 Thread Christian Brauner
On Wed, Dec 05, 2018 at 09:01:45PM +0100, Greg KH wrote: > On Tue, Dec 04, 2018 at 02:12:39PM +0100, Christian Brauner wrote: > > As discussed at Linux Plumbers Conference 2018 in Vancouver [1] this is the > > implementation of binderfs. If you want to skip reading and just see h

Re: [PATCH] binder: implement binderfs

2018-12-06 Thread Christian Brauner
On Thu, Dec 06, 2018 at 03:04:03PM +0100, Greg KH wrote: > On Wed, Dec 05, 2018 at 10:42:06PM +0100, Christian Brauner wrote: > > On Wed, Dec 05, 2018 at 09:01:45PM +0100, Greg KH wrote: > > > > /* binder-control */ > > > > Each new binderfs instance comes with

[PATCH v1] binder: implement binderfs

2018-12-07 Thread Christian Brauner
T_FAILURE); } printf("Allocated new binder device with major %d, minor %d, and " "name %s\n", device.major, device.minor, device.name); exit(EXIT_SUCCESS); } /* Demo */ A demo of how binderfs works can be found under [2]. [1

Re: [PATCH v1] binder: implement binderfs(Internet mail)

2018-12-10 Thread Christian Brauner
On Tue, Dec 11, 2018 at 03:44:48AM +, chouryzhou(周威) wrote: > > chouryzhou@, can you confirm that this implementation works for your > > android-in-container use-case? > > > > -Todd > > > We are running Android Pie in container now. If it works for later Android > release, it will works for

Re: [PATCH v3 0/3] Binder: Enable App Freezing Capability

2021-03-17 Thread Christian Brauner
On Mon, Mar 15, 2021 at 06:16:27PM -0700, Li Li wrote: > From: Li Li > > To improve the user experience when switching between recently used > applications, the background applications which are not currently needed > are cached in the memory. Normally, a well designed application will not > cons

Re: [PATCH v3 1/3] binder: BINDER_FREEZE ioctl

2021-03-17 Thread Christian Brauner
On Mon, Mar 15, 2021 at 06:16:28PM -0700, Li Li wrote: > From: Marco Ballesio > > Frozen tasks can't process binder transactions, so a way is required to > inform transmitting ends of communication failures due to the frozen > state of their receiving counterparts. Additionally, races are possibl

Re: [PATCH 0/2] Export receive_fd() to modules and do some cleanups

2021-04-01 Thread Christian Brauner
On Thu, Apr 01, 2021 at 05:09:30PM +0800, Xie Yongji wrote: > This series starts from Christian's comments on the series[1]. > We'd like to export receive_fd() which can not only be used by > our module in the series[1] but also allow further cleanups > like patch 2 does. > > Now this series is ba

Re: [PATCH 2/2] binder: Use receive_fd() to receive file from another process

2021-04-01 Thread Christian Brauner
On Thu, Apr 01, 2021 at 11:54:45AM +0200, Greg KH wrote: > On Thu, Apr 01, 2021 at 05:09:32PM +0800, Xie Yongji wrote: > > Use receive_fd() to receive file from another process instead of > > combination of get_unused_fd_flags() and fd_install(). This simplifies > > the logic and also makes sure we

Re: [PATCH 2/2] binder: Use receive_fd() to receive file from another process

2021-04-16 Thread Christian Brauner
On Fri, Apr 16, 2021 at 05:55:16AM +, Al Viro wrote: > On Fri, Apr 16, 2021 at 05:19:50AM +, Al Viro wrote: > > On Thu, Apr 01, 2021 at 12:40:34PM +0200, Christian Brauner wrote: > > > > and see whether all of them can be switched to simply using > > > re

Re: [PATCH 2/2] binder: Use receive_fd() to receive file from another process

2021-04-16 Thread Christian Brauner
On Fri, Apr 16, 2021 at 02:09:35PM +, Al Viro wrote: > On Fri, Apr 16, 2021 at 03:42:52PM +0200, Christian Brauner wrote: > > > > are drivers/dma-buf/sw_sync.c and drivers/dma-buf/sync_file.c, etc. > > > > > > FWIW, pretty much all ioctls that return

Re: [PATCH 2/2] binder: Use receive_fd() to receive file from another process

2021-04-16 Thread Christian Brauner
On Fri, Apr 16, 2021 at 03:35:59PM +, Al Viro wrote: > On Fri, Apr 16, 2021 at 05:13:10PM +0200, Christian Brauner wrote: > > > My point here was more that the _file_ has already been opened _before_ > > that call to io_uring_add_task_file(). But any potential non-trivial &

Re: [PATCH 2/2] binder: Use receive_fd() to receive file from another process

2021-04-16 Thread Christian Brauner
On Fri, Apr 16, 2021 at 05:58:25PM +0200, Christian Brauner wrote: > On Fri, Apr 16, 2021 at 03:35:59PM +, Al Viro wrote: > > On Fri, Apr 16, 2021 at 05:13:10PM +0200, Christian Brauner wrote: > > > > > My point here was more that the _file_ has already been opened _be

Re: [PATCH] binder: make sure fd closes complete

2021-08-31 Thread Christian Brauner
or the file object may never be > dereferenced -- which can lead to hung processes. > > Force the binder thread back to userspace if an fd is closed during > BC_FREE_BUFFER handling. > > Signed-off-by: Todd Kjos > --- Looks good. Th

Re: [PATCH] binder: don't detect sender/target during buffer cleanup

2021-10-18 Thread Christian Brauner
ow > 'is_failure' can be used to accurately detect this case. > > Fixes: 44d8047f1d87 ("binder: use standard functions to allocate fds") > Signed-off-by: Todd Kjos > --- Looks good to me. Acked-by: Christian Brauner __

Re: [PATCH] binder: fix test regression due to sender_euid change

2021-11-16 Thread Christian Brauner
tigation. It is a partial > reversion because subsequent patches rely on proc->cred. > > Cc: sta...@vger.kernel.org # 4.4+ > Fixes: 29bc22ac5e5b ("binder: use euid from cred instead of using task") > Signed-off-by: Todd Kjos > Change-Id: I9b1769a3510fed250bb

Re: [PATCH v2 2/4] binder: avoid potential data leakage when copying txn

2021-12-01 Thread Christian Brauner
re visible to the > target prior to the fixups. > > Instead of copying all of the data first, copy data only > after any needed fixups have been applied. > > Fixes: 457b9a6f09f0 ("Staging: android: add binder driver") > Reviewed-by: Martijn Coenen > Signed-off-by

Re: [PATCH v2 1/4] binder: fix handling of error during copy

2021-12-01 Thread Christian Brauner
Suggested-by: Dan Carpenter > Signed-off-by: Todd Kjos > --- Looks good. Acked-by: Christian Brauner ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Re: [PATCH v2 3/4] binder: read pre-translated fds from sender buffer

2021-12-01 Thread Christian Brauner
ent checks. Previously the alignment checks would > have been done in a different place, but this lets us print more > useful error messages. > > Reviewed-by: Martijn Coenen > Signed-off-by: Todd Kjos > --- Looks good. Acked-by: Christian Brauner

Re: [PATCH] binder: fix async_free_space accounting for empty parcels

2021-12-23 Thread Christian Brauner
oid: binder: Move buffer out of area shared with > user space") > Signed-off-by: Todd Kjos > --- Looks good. Acked-by: Christian Brauner ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Re: [PATCH][next] binder: remove redundant assignment to pointer n

2020-09-11 Thread Christian Brauner
es-Coverity: ("Unused value") > Signed-off-by: Colin Ian King > --- Thanks! Acked-by: Christian Brauner ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Re: [PATCH -next] binder: simplify the return expression of binder_mmap

2020-09-21 Thread Christian Brauner
On Mon, Sep 21, 2020 at 04:24:23PM +0800, Liu Shixin wrote: > Simplify the return expression. > > Signed-off-by: Liu Shixin > --- Why not is all I can really say. :) But if this is about simplifying you could get rid of the "ret" and "failure string" variables, and the goto in that function comp

Re: [PATCH v3 -next] binder: simplify the return expression of binder_mmap

2020-10-02 Thread Christian Brauner
On Tue, Sep 29, 2020 at 09:52:16AM +0800, Liu Shixin wrote: > Simplify the return expression. > > Signed-off-by: Liu Shixin > --- Thanks! Acked-by: Christian Brauner ___ devel mailing list de...@linuxdriverproj

Re: [PATCH v2 07/11] drivers/android/binder: convert stats, transaction_log to counter_atomic32

2020-10-09 Thread Christian Brauner
version doesn't change the overflow wrap around behavior. > > Signed-off-by: Shuah Khan > Reviewed-by: Joel Fernandes (Google) > Reviewed-by: Kees Cook > --- Thanks! Reviewed-by: Christian Brauner ___ devel mailing list de...@lin

Re: [PATCH] binder: fix UAF when releasing todo list

2020-10-13 Thread Christian Brauner
binder_work element > must not be accessed after releasing the inner_proc_lock while > processing the todo list elements since another thread might be > handling a deref on the node containing the binder_work element > leading to the node being freed

Re: [PATCH -next] binder: change error code from postive to negative in binder_transaction

2020-10-29 Thread Christian Brauner
On Mon, Oct 26, 2020 at 07:03:14PM +0800, Zhang Qilong wrote: > Depending on the context, the error return value > here (extra_buffers_size < added_size) should be > negative. > > Signed-off-by: Zhang Qilong > --- Thanks! Acked-

Re: [PATCH v1] binder: implement binderfs

2018-12-12 Thread Christian Brauner
> On Fri, Dec 7, 2018 at 3:26 PM Christian Brauner wrote: > > > > As discussed at Linux Plumbers Conference 2018 in Vancouver [1] this is the > > implementation of binderfs. > > > > binderfs is a backwards-compatible filesystem for Android's binder ipc > &

Re: [PATCH v1] binder: implement binderfs

2018-12-13 Thread Christian Brauner
On Thu, Dec 13, 2018 at 06:56:26PM +0100, Greg Kroah-Hartman wrote: > On Wed, Dec 12, 2018 at 01:51:27PM +0100, Christian Brauner wrote: > > > > Cc: Martijn Coenen > > > > Cc: Todd Kjos > > > > Cc: Greg Kroah-Hartman > > > > Signed-off-by: C

[PATCH v2] binder: implement binderfs

2018-12-13 Thread Christian Brauner
quot;Allocated new binder device with major %d, minor %d, and " "name %s\n", device.major, device.minor, device.name); exit(EXIT_SUCCESS); } Cc: Martijn Coenen Cc: Greg Kroah-Hartman Signed-off-by: Christian Brauner Acked-by: Todd Kjos --- v1:

Re: [PATCH v2] binder: implement binderfs

2018-12-14 Thread Christian Brauner
On Fri, Dec 14, 2018 at 10:11:23AM +0300, Dan Carpenter wrote: > On Thu, Dec 13, 2018 at 10:59:11PM +0100, Christian Brauner wrote: > > +/** > > + * binderfs_new_inode - allocate inode from super block of a binderfs mount > > + * @ref_inode: inode from wich the supe

[PATCH v3] binder: implement binderfs

2018-12-14 Thread Christian Brauner
quot;Allocated new binder device with major %d, minor %d, and " "name %s\n", device.major, device.minor, device.name); exit(EXIT_SUCCESS); } Cc: Martijn Coenen Cc: Greg Kroah-Hartman Signed-off-by: Christian Brauner Acked-by: Todd Kjos --- v3

Re: [PATCH v3] binder: implement binderfs

2018-12-19 Thread Christian Brauner
On Wed, Dec 19, 2018 at 09:47:56AM +0100, Greg KH wrote: > On Fri, Dec 14, 2018 at 01:11:14PM +0100, Christian Brauner wrote: > > As discussed at Linux Plumbers Conference 2018 in Vancouver [1] this is the > > implementation of binderfs. > > > > Looks good to me, th

[PATCH] binderfs: implement sysctls

2018-12-21 Thread Christian Brauner
binderfs mounts. 3. /proc/sys/fs/binder/reserved: Ensure that global root can reserve binder devices for the initial binderfs mount in the initial ipc namespace to prevent DOS attacks. This is equivalent to sysctls of devpts. Signed-off-by: Christian Brauner --- drivers/android/binderfs.c

Re: [PATCH] binderfs: implement sysctls

2018-12-21 Thread Christian Brauner
On Fri, Dec 21, 2018 at 02:55:09PM +0100, Greg KH wrote: > On Fri, Dec 21, 2018 at 02:39:09PM +0100, Christian Brauner wrote: > > This implements three sysctls that have very specific goals: > > Ick, why? > > What are these going to be used for? Who will "control&q

Re: [PATCH] binderfs: implement sysctls

2018-12-21 Thread Christian Brauner
On Fri, Dec 21, 2018 at 04:37:58PM +0100, Greg KH wrote: > On Fri, Dec 21, 2018 at 03:12:42PM +0100, Christian Brauner wrote: > > On Fri, Dec 21, 2018 at 02:55:09PM +0100, Greg KH wrote: > > > On Fri, Dec 21, 2018 at 02:39:09PM +0100, Christian Brauner wrote: > > > >

Re: [PATCH] binderfs: implement sysctls

2018-12-21 Thread Christian Brauner
On Fri, Dec 21, 2018 at 05:33:16PM +0100, Greg KH wrote: > On Fri, Dec 21, 2018 at 04:59:19PM +0100, Christian Brauner wrote: > > On Fri, Dec 21, 2018 at 04:37:58PM +0100, Greg KH wrote: > > > On Fri, Dec 21, 2018 at 03:12:42PM +0100, Christian Brauner wrote: > > > >

[PATCH] binderfs: implement "max" mount option

2018-12-22 Thread Christian Brauner
+gdvw4fkkk8oznair9g5icjlyodo8hykv3o0o1jt...@mail.gmail.com/ [4]: https://lore.kernel.org/lkml/20181221192044.5yvfnuri7gdop...@brauner.io/ Cc: Todd Kjos Cc: Greg Kroah-Hartman Signed-off-by: Christian Brauner --- drivers/android/binderfs.c | 109 +++-- 1 file

Re: [PATCH] binderfs: implement "max" mount option

2018-12-23 Thread Christian Brauner
On Sun, Dec 23, 2018 at 12:29:44PM +0100, Greg KH wrote: > On Sat, Dec 22, 2018 at 10:18:06PM +0100, Christian Brauner wrote: > > Since binderfs can be mounted by userns root in non-initial user namespaces > > some precautions are in order. First, a way to set a maximum on the numbe

Re: [PATCH] binderfs: implement "max" mount option

2018-12-23 Thread Christian Brauner
On Sat, Dec 22, 2018 at 10:18:06PM +0100, Christian Brauner wrote: > Since binderfs can be mounted by userns root in non-initial user namespaces > some precautions are in order. First, a way to set a maximum on the number > of binder devices that can be allocated per binderfs instance a

[PATCH v1 2/2] binderfs: reserve devices for initial mount

2018-12-23 Thread Christian Brauner
ut risking that all minor numbers have already been used up. Cc: Todd Kjos Cc: Greg Kroah-Hartman Signed-off-by: Christian Brauner --- v1: - patch introduced v0: - patch not present --- drivers/android/binderfs.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drive

[PATCH v1 1/2] binderfs: implement "max" mount option

2018-12-23 Thread Christian Brauner
: Greg Kroah-Hartman Signed-off-by: Christian Brauner --- v1: - split reserving devices for the binderfs instance in the initial ipc namespace into a separate patch (cf. [1]) - s/ - use simple int instead of atomic_t for counting devices since we're incrementing and decrementing under a

Re: [PATCH v1 1/2] binderfs: implement "max" mount option

2018-12-24 Thread Christian Brauner
On Sun, Dec 23, 2018 at 03:35:49PM +0100, Christian Brauner wrote: > Since binderfs can be mounted by userns root in non-initial user namespaces > some precautions are in order. First, a way to set a maximum on the number > of binder devices that can be allocated per binderfs instance a

Re: [PATCH v1 1/2] binderfs: implement "max" mount option

2018-12-24 Thread Christian Brauner
On Mon, Dec 24, 2018 at 12:45:59PM +0100, Greg KH wrote: > On Mon, Dec 24, 2018 at 12:09:37PM +0100, Christian Brauner wrote: > > On Sun, Dec 23, 2018 at 03:35:49PM +0100, Christian Brauner wrote: > > > Since binderfs can be mounted by userns root in non-initial user > >

Re: [PATCH v1 1/2] binderfs: implement "max" mount option

2019-01-02 Thread Christian Brauner
On Wed, Jan 02, 2019 at 12:17:31PM +0300, Dan Carpenter wrote: > On Sun, Dec 23, 2018 at 03:35:49PM +0100, Christian Brauner wrote: > > static inline struct binderfs_info *BINDERFS_I(const struct inode *inode) > > @@ -110,10 +132,16 @@ static int binderfs_binder_device_crea

[PATCH v2 1/2] binderfs: implement "max" mount option

2019-01-02 Thread Christian Brauner
: Greg Kroah-Hartman Signed-off-by: Christian Brauner --- v2: - grab mutex to decrement device_count in the one place where it was missing (cf. [changelog-3]). v1: - split reserving devices for the binderfs instance in the initial ipc namespace into a separate patch (cf. [changelog-1]) - s/ - use

[PATCH v2 2/2] binderfs: reserve devices for initial mount

2019-01-02 Thread Christian Brauner
ut risking that all minor numbers have already been used up. Cc: Todd Kjos Cc: Greg Kroah-Hartman Signed-off-by: Christian Brauner --- v2: - patch unchanged v1: - patch introduced v0: - patch not present --- drivers/android/binderfs.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-)

Re: [PATCH v2 1/2] binderfs: implement "max" mount option

2019-01-03 Thread Christian Brauner
On Wed, Jan 2, 2019 at 12:32 PM Christian Brauner wrote: > > Since binderfs can be mounted by userns root in non-initial user namespaces > some precautions are in order. First, a way to set a maximum on the number > of binder devices that can be allocated per binderfs instance and sec

Re: [PATCH v1 2/2] binderfs: reserve devices for initial mount

2019-01-03 Thread Christian Brauner
On Thu, Jan 03, 2019 at 12:25:24PM -0800, Todd Kjos wrote: > On Sun, Dec 23, 2018 at 6:36 AM Christian Brauner > wrote: > > > > The binderfs instance in the initial ipc namespace will always have a > > reserve of 4 binder devices unless explicitly capped by specifying a

Re: [PATCH v1 2/2] binderfs: reserve devices for initial mount

2019-01-03 Thread Christian Brauner
On Thu, Jan 03, 2019 at 01:47:13PM -0800, Todd Kjos wrote: > On Thu, Jan 3, 2019 at 12:34 PM Christian Brauner > wrote: > > > > On Thu, Jan 03, 2019 at 12:25:24PM -0800, Todd Kjos wrote: > > > On Sun, Dec 23, 2018 at 6:36 AM Christian Brauner > > > wrote: &

[PATCH 1/2] binderfs: remove wrong kern_mount() call

2019-01-06 Thread Christian Brauner
The binderfs filesystem never needs to be mounted by the kernel itself. This is conceptually wrong and should never have been done in the first place. Fixes: 3ad20fe393b ("binder: implement binderfs") Signed-off-by: Christian Brauner --- drivers/android/binderfs.c | 10

[PATCH 0/2] binderfs: fixes

2019-01-06 Thread Christian Brauner
More details can be found in the commit message for each patch. Thanks! Christian Christian Brauner (2): binderfs: remove wrong kern_mount() call binderfs: make each binderfs mount a new instance drivers/android/binderfs.c | 51 ++ 1 file changed, 2 inser

[PATCH 2/2] binderfs: make each binderfs mount a new instance

2019-01-06 Thread Christian Brauner
to get a private kdbusfs instance in the same IPC namespace by making each mount of kdbusfs a separate instance. I think that makes a lot of sense. Signed-off-by: Christian Brauner --- drivers/android/binderfs.c | 41 ++ 1 file changed, 2 insertions(+), 39 d

[PATCH] binderfs: rename header to binderfs.h

2019-01-10 Thread Christian Brauner
It doesn't make sense to call the header binder_ctl.h when its sole existence is tied to binderfs. So give it a sensible name. Users will far more easily remember binderfs.h than binder_ctl.h. Signed-off-by: Christian Brauner --- drivers/android/binderfs.c

Re: [PATCH v2 2/2] binderfs: reserve devices for initial mount

2019-01-11 Thread Christian Brauner
On Fri, Jan 11, 2019 at 10:18:18AM +0100, Greg KH wrote: > On Wed, Jan 02, 2019 at 12:32:19PM +0100, Christian Brauner wrote: > > The binderfs instance in the initial ipc namespace will always have a > > reserve of 4 binder devices unless explicitly capped by specifying a lower &g

[RESEND PATCH] binderfs: reserve devices for initial mount

2019-01-11 Thread Christian Brauner
ut risking that all minor numbers have already been used up. Cc: Todd Kjos Cc: Greg Kroah-Hartman Signed-off-by: Christian Brauner --- v2: - patch unchanged v1: - patch introduced v0: - patch not present --- drivers/android/binderfs.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-)

Re: [RESEND PATCH] binderfs: reserve devices for initial mount

2019-01-11 Thread Christian Brauner
On Fri, Jan 11, 2019 at 11:19:40AM +0100, Christian Brauner wrote: > The binderfs instance in the initial ipc namespace will always have a > reserve of 4 binder devices unless explicitly capped by specifying a lower > value via the "max" mount option. > This ensures when bind

[PATCH] binderfs: handle !CONFIG_IPC_NS builds

2019-01-11 Thread Christian Brauner
kbuild reported a build faile in [1]. This is triggered when CONFIG_IPC_NS is not set. So let's make the use of init_ipc_ns conditional on CONFIG_IPC_NS being set. [1]: https://lists.01.org/pipermail/kbuild-all/2019-January/056903.html Signed-off-by: Christian Brauner --- drivers/an

Re: [PATCH -next] binderfs: fix error return code in binderfs_fill_super()

2019-01-15 Thread Christian Brauner
On Wed, Jan 16, 2019 at 03:01:04AM +, Wei Yongjun wrote: > Fix to return a negative error code -ENOMEM from the new_inode() and > d_make_root() error handling cases instead of 0, as done elsewhere in > this function. > > Fixes: 3ad20fe393b3 ("binder: implement binderfs") > Signed-off-by: Wei Y

Re: [PATCH -next] binderfs: fix error return code in binderfs_fill_super()

2019-01-15 Thread Christian Brauner
On Wed, Jan 16, 2019 at 07:25:46AM +0100, Christian Brauner wrote: > On Wed, Jan 16, 2019 at 03:01:04AM +, Wei Yongjun wrote: > > Fix to return a negative error code -ENOMEM from the new_inode() and > > d_make_root() error handling cases instead of 0, as done elsewhere in &g

Re: [PATCH -next v2] binderfs: fix error return code in binderfs_fill_super()

2019-01-16 Thread Christian Brauner
On Wed, Jan 16, 2019 at 08:34:02AM +, Wei Yongjun wrote: > Fix to return a negative error code -ENOMEM from the new_inode() and > d_make_root() error handling cases instead of 0, as done elsewhere in > this function. > > Fixes: 3ad20fe393b3 ("binder: implement binderfs") This should be: Fixe

Re: [PATCH -next v2] binderfs: fix error return code in binderfs_fill_super()

2019-01-16 Thread Christian Brauner
On Wed, Jan 16, 2019 at 09:41:08AM +0100, Christian Brauner wrote: > On Wed, Jan 16, 2019 at 08:34:02AM +, Wei Yongjun wrote: > > Fix to return a negative error code -ENOMEM from the new_inode() and > > d_make_root() error handling cases instead of 0, as done elsewhere in &g

[PATCH] selftests: add binderfs selftests

2019-01-16 Thread Christian Brauner
works Cc: Todd Kjos Signed-off-by: Christian Brauner --- tools/testing/selftests/Makefile | 1 + .../selftests/filesystems/binderfs/.gitignore | 1 + .../selftests/filesystems/binderfs/Makefile | 6 + .../filesystems/binderfs/binderfs_test.c | 120

Re: [PATCH] selftests: add binderfs selftests

2019-01-16 Thread Christian Brauner
On January 16, 2019 5:54:50 PM GMT+02:00, Greg KH wrote: >On Wed, Jan 16, 2019 at 02:19:03PM +0100, Christian Brauner wrote: >> This adds the promised selftest for binderfs. It will verify the >following >> things: >> - binderfs mounting works >> - binder device al

Re: [PATCH] selftests: add binderfs selftests

2019-01-16 Thread Christian Brauner
On January 16, 2019 6:42:20 PM GMT+02:00, Greg KH wrote: >On Wed, Jan 16, 2019 at 06:21:12PM +0200, Christian Brauner wrote: >> On January 16, 2019 5:54:50 PM GMT+02:00, Greg KH > wrote: >> >On Wed, Jan 16, 2019 at 02:19:03PM +0100, Christian Brauner wrote: >> >>

Re: [PATCH] selftests: add binderfs selftests

2019-01-16 Thread Christian Brauner
On Wed, Jan 16, 2019 at 06:57:10PM +0200, Christian Brauner wrote: > On January 16, 2019 6:42:20 PM GMT+02:00, Greg KH > wrote: > >On Wed, Jan 16, 2019 at 06:21:12PM +0200, Christian Brauner wrote: > >> On January 16, 2019 5:54:50 PM GMT+02:00, Greg KH > > wrote: >

[PATCH v1] selftests: add binderfs selftests

2019-01-16 Thread Christian Brauner
works Cc: Todd Kjos Signed-off-by: Christian Brauner --- /* Changelog */ v1: - check for ENODEV on mount failure to detect whether binderfs is available If it is not, skip the test and exit with success. --- tools/testing/selftests/Makefile | 1 + .../selftests/filesystems

Re: [PATCH v1] selftests: add binderfs selftests

2019-01-16 Thread Christian Brauner
On Wed, Jan 16, 2019 at 11:40:50PM +0100, Greg KH wrote: > On Wed, Jan 16, 2019 at 11:27:45PM +0100, Christian Brauner wrote: > > This adds the promised selftest for binderfs. It will verify the following > > things: > > - binderfs mounting works > > - bin

Re: [PATCH v1] selftests: add binderfs selftests

2019-01-17 Thread Christian Brauner
On Wed, Jan 16, 2019 at 04:11:55PM -0700, shuah wrote: > Hi Christian, > > On 1/16/19 3:27 PM, Christian Brauner wrote: > > This adds the promised selftest for binderfs. It will verify the following > > things: > > - binderfs mounting works > > - binder device al

[PATCH v2] selftests: add binderfs selftests

2019-01-17 Thread Christian Brauner
works The tests are performed both privileged and unprivileged. The latter verifies that binderfs behaves correctly in user namespaces. Cc: Todd Kjos Signed-off-by: Christian Brauner --- /* Changelog */ v2: - make failure to create /dev/binderfs directory fatal in all circumstances - make tests run

Re: [PATCH v2] selftests: add binderfs selftests

2019-01-17 Thread Christian Brauner
On Thu, Jan 17, 2019 at 11:55:49AM +0100, Greg KH wrote: > On Thu, Jan 17, 2019 at 11:28:21AM +0100, Christian Brauner wrote: > > This adds the promised selftest for binderfs. It will verify the following > > things: > > - binderfs mounting works > > - bin

[PATCH v3] selftests: add binderfs selftests

2019-01-17 Thread Christian Brauner
works The tests are performed both privileged and unprivileged. The latter verifies that binderfs behaves correctly in user namespaces. Cc: Todd Kjos Signed-off-by: Christian Brauner --- /* Changelog */ v3: - s/printf/ksft_print_msg/g - do not report misleading errno on short write v2: - make

[PATCH 2/5] binderfs: prevent renaming the control dentry

2019-01-18 Thread Christian Brauner
arate helper is_binderfs_control_device() since it's now used in two places. Additionally, replace the custom rename dance we did with call to simple_rename(). Suggested-by: Al Viro Signed-off-by: Christian Brauner --- drivers/android/binderfs.c | 33 - 1 file c

[PATCH 0/5] binderfs: debug galore

2019-01-18 Thread Christian Brauner
stian Christian Brauner (5): binderfs: remove outdated comment binderfs: prevent renaming the control dentry binderfs: rework binderfs_fill_super() binderfs: kill_litter_super() before cleanup binderfs: drop lock in binderfs_binder_ctl_create drivers/android/binderfs.c

[PATCH 3/5] binderfs: rework binderfs_fill_super()

2019-01-18 Thread Christian Brauner
up on error. Suggested-by: Al Viro Signed-off-by: Christian Brauner --- drivers/android/binderfs.c | 35 +-- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index 02c96b5edfa9..c0fa495ee994 100644

[PATCH 5/5] binderfs: drop lock in binderfs_binder_ctl_create

2019-01-18 Thread Christian Brauner
The binderfs_binder_ctl_create() call is a no-op on subsequent calls and the first call is done before we unlock the suberblock. Hence, there is no need to take inode_lock() in there. Let's remove it. Suggested-by: Al Viro Signed-off-by: Christian Brauner --- Note, that fs/de

[PATCH 1/5] binderfs: remove outdated comment

2019-01-18 Thread Christian Brauner
The comment stems from an early version of that patchset and is just confusing now. Cc: Al Viro Signed-off-by: Christian Brauner --- drivers/android/binderfs.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index e4ff4c3fa371

[PATCH 4/5] binderfs: kill_litter_super() before cleanup

2019-01-18 Thread Christian Brauner
Al pointed out that first calling kill_litter_super() before cleaning up info is more correct since destroying info doesn't depend on the state of the dentries and inodes. That the opposite remains true is not guaranteed. Suggested-by: Al Viro Signed-off-by: Christian Brauner --- dr

Re: [PATCH 2/5] binderfs: prevent renaming the control dentry

2019-01-19 Thread Christian Brauner
On Fri, Jan 18, 2019 at 10:55:52PM +, Al Viro wrote: > On Fri, Jan 18, 2019 at 03:53:41PM +0100, Christian Brauner wrote: > > We don't allow to unlink it since it is crucial for binderfs to be useable > > but if we allow to rename it we make the unlink trivial to by

Re: [PATCH 3/5] binderfs: rework binderfs_fill_super()

2019-01-19 Thread Christian Brauner
On Fri, Jan 18, 2019 at 11:03:54PM +, Al Viro wrote: > On Fri, Jan 18, 2019 at 03:53:42PM +0100, Christian Brauner wrote: > > static int binderfs_fill_super(struct super_block *sb, void *data, int > > silent) > > { > > + int ret; > > struct bin

Re: [PATCH 0/5] binderfs: debug galore

2019-01-19 Thread Christian Brauner
On Fri, Jan 18, 2019 at 11:26:34PM +, Al Viro wrote: > On Fri, Jan 18, 2019 at 03:53:39PM +0100, Christian Brauner wrote: > > Hey everyone, > > > > Al gave me a really helpful review of binderfs and pointed out a range > > of bugs. The most obvious and serious on

[PATCH v1 0/7] binderfs: debug galore

2019-01-21 Thread Christian Brauner
Christian Christian Brauner (7): binderfs: remove outdated comment binderfs: prevent renaming the control dentry binderfs: rework binderfs_fill_super() binderfs: rework binderfs_binder_device_create() binderfs: kill_litter_super() before cleanup binderfs: drop lock in binderfs_binder_

[PATCH v1 1/7] binderfs: remove outdated comment

2019-01-21 Thread Christian Brauner
The comment stems from an early version of that patchset and is just confusing now. Cc: Al Viro Signed-off-by: Christian Brauner --- /* Changelog */ v1: - patch unchanged --- drivers/android/binderfs.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/android/binderfs.c b/drivers

[PATCH v1 3/7] binderfs: rework binderfs_fill_super()

2019-01-21 Thread Christian Brauner
up on error. Suggested-by: Al Viro Signed-off-by: Christian Brauner --- /* Changelog */ v1: - correctly grab and stash a reference to task's ipc_ns to prevent leaks - replace d_alloc_name() + d_lookup() combination with lookup_one_len() - replace kmalloc() + strscpy() with kmemdup() --- drive

[PATCH v1 7/7] binderfs: switch from d_add() to d_instantiate()

2019-01-21 Thread Christian Brauner
1 R14: ff9c R15: 00c0bc60 Cc: Al Viro Signed-off-by: Christian Brauner --- /* Changelog */ v1: - patch introduced --- drivers/android/binderfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/android/binderfs.c b/drivers/android

[PATCH v1 2/7] binderfs: prevent renaming the control dentry

2019-01-21 Thread Christian Brauner
ction down to first check whether we're trying to rename the control dentry. If we do EPERM the caller and if not call simple_rename(). Suggested-by: Al Viro Signed-off-by: Christian Brauner --- /* Changelog */ v1: - simplify is_binderfs_control_device() to only take a dentry argument in

[PATCH v1 6/7] binderfs: drop lock in binderfs_binder_ctl_create

2019-01-21 Thread Christian Brauner
The binderfs_binder_ctl_create() call is a no-op on subsequent calls and the first call is done before we unlock the suberblock. Hence, there is no need to take inode_lock() in there. Let's remove it. Suggested-by: Al Viro Signed-off-by: Christian Brauner --- Note, that fs/de

[PATCH v1 5/7] binderfs: kill_litter_super() before cleanup

2019-01-21 Thread Christian Brauner
Al pointed out that first calling kill_litter_super() before cleaning up info is more correct since destroying info doesn't depend on the state of the dentries and inodes. That the opposite remains true is not guaranteed. Suggested-by: Al Viro Signed-off-by: Christian Brauner --- /* Chan

[PATCH v1 4/7] binderfs: rework binderfs_binder_device_create()

2019-01-21 Thread Christian Brauner
eturn the existing dentry or a new one. - switch from kmalloc() + strscpy() to kmemdup(): Use a more idiomatic way to copy the name for the new dentry that userspace gave us. Suggested-by: Al Viro Signed-off-by: Christian Brauner --- /* Changelog */ v1: - patch introduced --- drivers/an

[PATCH 2/2] binderfs: use __u32 for device numbers

2019-01-21 Thread Christian Brauner
We allow more then 255 binderfs binder devices to be created since there are workloads that require more than that. If we use __u8 we'll overflow after 255. So let's use a __u32. Note that there's no released kernel with binderfs out there so this is not a regression. Signed-of

[PATCH 1/2] binderfs: use correct include guards in header

2019-01-21 Thread Christian Brauner
When we switched over from binder_ctl.h to binderfs.h we forgot to change the include guards. It's minor but it's obviously correct. Signed-off-by: Christian Brauner --- include/uapi/linux/android/binderfs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/in

Re: [PATCH v3] selftests: add binderfs selftests

2019-01-23 Thread Christian Brauner
On Thu, Jan 17, 2019 at 12:48:54PM +0100, Christian Brauner wrote: > This adds the promised selftest for binderfs. It will verify the following > things: > - binderfs mounting works > - binder device allocation works > - performing a binder ioctl() request through a binder

[PATCH 1/2] binderfs: respect limit on binder control creation

2019-01-23 Thread Christian Brauner
binderfs_binder_ctl_create() that we perform in binderfs_binder_device_create(). Fixes: 36bdf3cae09d ("binderfs: reserve devices for initial mount") Signed-off-by: Christian Brauner --- drivers/android/binderfs.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git

[PATCH 2/2] binderfs: remove separate device_initcall()

2019-01-23 Thread Christian Brauner
="". When CONFIG_ANDROID_BINDERFS=n then this always succeeds so there's no regression potential for legacy workloads. Signed-off-by: Christian Brauner --- drivers/android/binder.c | 4 drivers/android/binder_internal.h | 9 + drivers/android/binderfs.c|

Re: [PATCH v3] selftests: add binderfs selftests

2019-01-23 Thread Christian Brauner
On Wed, Jan 23, 2019 at 07:15:01AM -0700, shuah wrote: > On 1/23/19 4:00 AM, Greg KH wrote: > > On Wed, Jan 23, 2019 at 11:54:58AM +0100, Christian Brauner wrote: > > > On Thu, Jan 17, 2019 at 12:48:54PM +0100, Christian Brauner wrote: > > > > This adds the promised

[PATCH] binder: fix CONFIG_ANDROID_BINDER_DEVICES

2019-01-26 Thread Christian Brauner
R15: 55b629ebec60 So check for the empty string since strsep() will otherwise return the emtpy string which will cause kobject_add_internal() to panic when trying to add a kobject with an emtpy name. Fixes: ac4812c5ffbb ("binder: Support multiple /dev instances") Cc: Martij

Re: [PATCH 2/2] binderfs: remove separate device_initcall()

2019-01-30 Thread Christian Brauner
On Wed, Jan 30, 2019 at 03:24:12PM +0100, Greg KH wrote: > On Wed, Jan 23, 2019 at 12:41:16PM +0100, Christian Brauner wrote: > > binderfs should not have a separate device_initcall(). When a kernel is > > compiled with CONFIG_ANDROID_BINDERFS register the files

[PATCH v1] binderfs: remove separate device_initcall()

2019-01-30 Thread Christian Brauner
="". When CONFIG_ANDROID_BINDERFS=n then this always succeeds so there's no regression potential for legacy workloads. Signed-off-by: Christian Brauner --- /* Changelog */ - ensure that device_name is set to NULL so kfree() doesn't freak out --- drivers/android/binder.c

  1   2   >