public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Li Li <dualli@chromium.org>
Cc: "Li Li" <dualli@google.com>,
	"open list:ANDROID DRIVERS" <devel@driverdev.osuosl.org>,
	"Android Kernel Team" <kernel-team@android.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"Joel Fernandes (Google)" <joel@joelfernandes.org>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Martijn Coenen" <maco@google.com>,
	"Hridya Valsaraju" <hridya@google.com>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Christian Brauner" <christian@brauner.io>,
	"Todd Kjos" <tkjos@google.com>
Subject: Re: [PATCH v2 1/1] binder: fix freeze race
Date: Fri, 10 Sep 2021 09:15:00 +0200	[thread overview]
Message-ID: <YTsF9OC4QEMl2wp7@kroah.com> (raw)
In-Reply-To: <CANBPYPgEbFusdyrcV1EqridahQGTH7X=s8ufUA9SMR8SefAO2g@mail.gmail.com>

On Thu, Sep 09, 2021 at 11:17:42PM -0700, Li Li wrote:
> On Thu, Sep 9, 2021 at 10:38 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Thu, Sep 09, 2021 at 08:53:16PM -0700, Li Li wrote:
> > >  struct binder_frozen_status_info {
> > >       __u32            pid;
> > > +
> > > +     /* process received sync transactions since last frozen
> > > +      * bit 0: received sync transaction after being frozen
> > > +      * bit 1: new pending sync transaction during freezing
> > > +      */
> > >       __u32            sync_recv;
> >
> > You just changed a user/kernel api here, did you just break existing
> > userspace applications?  If not, how did that not happen?
> >
> 
> That's a good question. This design does keep backward compatibility.
> 
> The existing userspace applications call ioctl(BINDER_GET_FROZEN_INFO)
> to check if there's sync or async binder transactions sent to a frozen
> process.
> 
> If the existing userspace app runs on a new kernel, a sync binder call
> still sets bit 1 of sync_recv (as it's a bool variable) so the ioctl
> will return the expected value (TRUE). The app just doesn't check bit
> 1 intentionally so it doesn't have the ability to tell if there's a
> race - this behavior is aligned with what happens on an old kernel as
> the old kernel doesn't have bit 1 set at all.
> 
> The bit 1 of sync_recv enables new userspace app the ability to tell
> 1) there's a sync binder transaction happened when being frozen - same
> as before; and 2) if that sync binder transaction happens exactly when
> there's a race - a new information for rollback decision.

Ah, can you add that to the changelog text to make it more obvious?

thanks,

greg k-h

  reply	other threads:[~2021-09-10  7:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10  3:53 [PATCH v2 0/1] binder: fix freeze race Li Li
2021-09-10  3:53 ` [PATCH v2 1/1] " Li Li
2021-09-10  5:37   ` Greg KH
2021-09-10  6:17     ` Li Li
2021-09-10  7:15       ` Greg KH [this message]
2021-09-13 17:18         ` Li Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YTsF9OC4QEMl2wp7@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arve@android.com \
    --cc=christian@brauner.io \
    --cc=devel@driverdev.osuosl.org \
    --cc=dualli@chromium.org \
    --cc=dualli@google.com \
    --cc=hridya@google.com \
    --cc=joel@joelfernandes.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maco@google.com \
    --cc=surenb@google.com \
    --cc=tkjos@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox