Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp753359pxb; Fri, 3 Sep 2021 12:39:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0C1PeTjjenIJIPlh/kl0qqWnbrpt4LVySSuKUYK50Kd7VdYWJb6KRD/sLktd7SkdvgX2/ X-Received: by 2002:a92:6a06:: with SMTP id f6mr416557ilc.16.1630697982862; Fri, 03 Sep 2021 12:39:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630697982; cv=none; d=google.com; s=arc-20160816; b=nIm0lXnTOVRptEgALbEGLRTGaJjnbBk7UOOnEqVZnCF1RsSV2Li5H9nZ9vMmzu4IM6 YQ8jEaVM1c/Pib9SsGi/NGKPd7wP2FH0v39lUTT0SNHgy9i7XICEwQ8bzS6uuW9oQzN8 hC34S2sD4Vvmie2ANROUZEn+1mfJmUgHIml2DGX278rdxtO4ib1XgMmSvv+PgcutZrr+ UEypn0kGDe+O+qDjuFlvCARl5+gwPaU/Y8OtumkxmKltz0p/YX/Kl86ij0QOQFLoZAcB 3DNaWRPvSRtNj3BwS4RRjFkzCTDRuR2STxxYdQKchwWmj9EFeg1rmZnOxEL1MV/EYFPm 3hKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=CpWTZXeHQgxI0FRIsXgHMKOEiigtxEoeHddO3FWKGkk=; b=x3tZ6Di0DBLKqbw/FFlKAxpBcKP3g6GmWnp44ebcVJNiJri4N1u/5PiAaAcD9MV6eT BuPo2/f0Nt7dok9G6aMOOKZnYqR4JrShobEk/kGnvTXe7LUHXuagKJpgnXE6wVl5dlkB HEs027YIVdtwFG03kI5NrtwHlWePe3Ff337ZS87fn7FGl8tFiReD8qH17g/r9QAJnSMb omfZANHVp9f7hCBRpyWCiq6e8Kb1JYo/xNRmhhIhDUxFcOsoaEcyf4QOkkEGThLbTP7t MaAeA6SweHKpoJSYREiTjp8lmUHIcfoqQs1Cr0i+opiTz4ajaCjE2xTFTFGQOB+s7SfK qC1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=UhpAzgv7; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q186si231328ioq.108.2021.09.03.12.39.30; Fri, 03 Sep 2021 12:39:42 -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=@google.com header.s=20210112 header.b=UhpAzgv7; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235044AbhICTjo (ORCPT + 99 others); Fri, 3 Sep 2021 15:39:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348939AbhICTjk (ORCPT ); Fri, 3 Sep 2021 15:39:40 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DEEDC061757 for ; Fri, 3 Sep 2021 12:38:40 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id f18so344389lfk.12 for ; Fri, 03 Sep 2021 12:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CpWTZXeHQgxI0FRIsXgHMKOEiigtxEoeHddO3FWKGkk=; b=UhpAzgv7FchR19cnMXHoZ7cPsnwbRuML2DSSZEKXlKbP9d7Uh/q51lYN6dicMfTSUV dMV18+ZxBaPhTEDxtpW7QeKdKnIGoeQPq4sChmtUxnlLdNqoFJI2YqFqgG0EvaVH4Khl cQjGnPEclgybXcLpQg8op5cyqaW6q3ph7e4SmGdI2glcrgPorTq5EcfSXhONcxrAT9EV SVUaIelOgjBRpSAzTjutRcpIv1HmjzTs7O/hqvPSmsGQOjEwyuWWlW6theTjv4gHo0vi IINnLytwUQXvyKA3KgzPZHFbroL39slzKCL2Gv5DbeUdMQTO5Hn1r6ANYcmcwc0drL1+ RszA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CpWTZXeHQgxI0FRIsXgHMKOEiigtxEoeHddO3FWKGkk=; b=pNwCGDCyDiCkeISoCcJ6FVs6gIY0VW24xWPTifZDrv3hsR9IJzWS7W1qzzhHuEtvbs Ufrmlnqu4VGjmtOecg8AlG5fvCPmgyMfkeRktjDTiqLcPoYyaKKoW4PScJpo0kQ6f3x2 K7kW9EIAVAh9h+Ry7HKakvRyX0xSU71Apu1LofaCpcin6S38HC/V8onHOmtkNijSVWrP QyhLMFkw4hm76dF6ZiBSZ30YxcRZ/sfj9MQwjIlelq9DHlGIqkzD/EzLPw19oi0FYkwv D/YKtVl3l37RGDCwiuDtzdsRQ1Zm5eDpUwrpXDPU8aCfSbgumos33lQ/VZB7sWHBcVA8 BdgQ== X-Gm-Message-State: AOAM530bI+IVrawul6BiW3yG+7TvqGu4zkHm9zaQ9p11dAPG2BGa/489 2cLhhUfy3ndvp4JuiY+xDiTlD6Mzbo/ylXuylwfKMw== X-Received: by 2002:a05:6512:11e8:: with SMTP id p8mr386145lfs.682.1630697918128; Fri, 03 Sep 2021 12:38:38 -0700 (PDT) MIME-Version: 1.0 References: <20210830195146.587206-1-tkjos@google.com> <20210903080617.GA1957@kadam> In-Reply-To: <20210903080617.GA1957@kadam> From: Todd Kjos Date: Fri, 3 Sep 2021 12:38:26 -0700 Message-ID: Subject: Re: [PATCH] binder: make sure fd closes complete To: Dan Carpenter Cc: Martijn Coenen , "open list:ANDROID DRIVERS" , Greg KH , LKML , stable , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , Martijn Coenen , Joel Fernandes , kernel-team@android.com, Christian Brauner Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 3, 2021 at 1:06 AM Dan Carpenter wrote: > > On Thu, Sep 02, 2021 at 08:35:35AM -0700, Todd Kjos wrote: > > On Tue, Aug 31, 2021 at 12:24 AM Martijn Coenen wrote: > > > > > > On Mon, Aug 30, 2021 at 9:51 PM 'Todd Kjos' via kernel-team > > > wrote: > > > > > > > > During BC_FREE_BUFFER processing, the BINDER_TYPE_FDA object > > > > cleanup may close 1 or more fds. The close operations are > > > > completed using the task work mechanism -- which means the thread > > > > needs to return to userspace 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 > > > Reviewed-by: Martijn Coenen > > > > Please also add to stable releases 5.4 and later. > > It would be better if this had a fixes tag so we knew which is the first > buggy commit. > > There was a long Project Zero article about the Bad Binder exploit > because commit f5cb779ba163 ("ANDROID: binder: remove waitqueue when > thread exits.") was marked as # 4.14 but it didn't have a Fixes tag and > the actual buggy commit was in 4.9. Good point Dan. I should have included a Fixes tag. Here is the tag (issue introduced in 4.20): Fixes: 80cd795630d6 ("binder: fix use-after-free due to ksys_close() during fdget()") Greg- would you like me to send a v2 with the Fixes tag and CC'ing stable appropriately? > > regards, > dan carpenter > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. >