Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3814870ybi; Mon, 29 Jul 2019 13:09:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqxT/ZPhOoBSh8uk7fiO3m8bcM5cx29zPMwATnOVcQwLbQpu1xRJgAz8sf5C0q5PT26BDULO X-Received: by 2002:a62:1ac9:: with SMTP id a192mr29522405pfa.260.1564430968176; Mon, 29 Jul 2019 13:09:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564430968; cv=none; d=google.com; s=arc-20160816; b=ux1UWD4Qd3ldoerFGoGA+O00Gxe7yVkRMugmk0Hqsa7ZcozkcRGkbgUiNkbS9HVXJ+ thy2tv5cAu6JZnSDjPZ5m3UYro31brRNH5b6+dZ85vXK39Q/94iosOlEvjhP9sSlVq8u g5jcniiwZlmxWOioTcESUkkMRFUc7s7WyOlr/sgWz9GFx3E5RzisNreqQWwOUk60XqQd FPpA9lO6+fnokTYicnWo+Ft3Kh7LxxUBdcX3yHMs541nS8z53lDPYX840NVL7yQb1D8p sDb0o1MPXoalINQJEPKMPQv8IbbiK2rQsG7weGCJe9FLiQIp1vi1AgbhOTWqiT450Csw mMlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3423SIlQfrsADdMLOt1NT8YYRm27c52OEQNtleFDgoo=; b=QwBVMD4HYfYLQG8mjQR7kB7S+yChRzeYXFi5uHIr2bDuSUVARLIMXFL1M7HOlATWRq 7VXSQMUHxVoE8+k96l+hDaBejJ4HCATD6BQG1KJ/8I3+XDhjk3lhvdGKUFc4gjknkz6S 40kh0dtg80XrEJpOX74CcmTnWUeyX39hIfZjOxjgpFde5po8caC85NNi2e9bdk6wP/E+ 9vuBwz7XSHt+sscExcX4EHPrNheZMND4uOGsNh+KyYt0Qzi0uVOt5qQU4N1K8LKAsmiq XcLqSUKx5JQow31tXHiI0q6nR+EKZUsu1OaA3KTuDV/llwwXOVlAj+aNWnnu+ttwf9bY nEfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=osdCOARn; 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 p4si27149875pgh.350.2019.07.29.13.09.12; Mon, 29 Jul 2019 13:09:28 -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; dkim=pass header.i=@kernel.org header.s=default header.b=osdCOARn; 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 S1730166AbfG2UHz (ORCPT + 99 others); Mon, 29 Jul 2019 16:07:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:53332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387731AbfG2TiY (ORCPT ); Mon, 29 Jul 2019 15:38:24 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3928021773; Mon, 29 Jul 2019 19:38:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429103; bh=fjuEbsoJsz/8BtvzJHjIfCmO5QHPJ5no2YLmeQCMmik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=osdCOARnyh2OVsDASTzYyVu1X/Uu9D/eCGwhv8PTNDEPxCoSGg8Y+4thi39BlqiBb /q02j3gzBoahk5+pU+AkVR0PcZz/jzBekW8yil/SM162ooF9AEt0sQmbuaXQwkjUoE DXGuO10M9b1i2tidUGem3FzjN/zV1swAyi+H/6r4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+8b3c354d33c4ac78bfad@syzkaller.appspotmail.com, Hridya Valsaraju , Todd Kjos Subject: [PATCH 4.14 286/293] binder: prevent transactions to context manager from its own process. Date: Mon, 29 Jul 2019 21:22:57 +0200 Message-Id: <20190729190846.170358376@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hridya Valsaraju commit 49ed96943a8e0c62cc5a9b0a6cfc88be87d1fcec upstream. Currently, a transaction to context manager from its own process is prevented by checking if its binder_proc struct is the same as that of the sender. However, this would not catch cases where the process opens the binder device again and uses the new fd to send a transaction to the context manager. Reported-by: syzbot+8b3c354d33c4ac78bfad@syzkaller.appspotmail.com Signed-off-by: Hridya Valsaraju Acked-by: Todd Kjos Cc: stable Link: https://lore.kernel.org/r/20190715191804.112933-1-hridya@google.com Signed-off-by: Greg Kroah-Hartman --- drivers/android/binder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -2785,7 +2785,7 @@ static void binder_transaction(struct bi else return_error = BR_DEAD_REPLY; mutex_unlock(&context->context_mgr_node_lock); - if (target_node && target_proc == proc) { + if (target_node && target_proc->pid == proc->pid) { binder_user_error("%d:%d got transaction to context manager from process owning it\n", proc->pid, thread->pid); return_error = BR_FAILED_REPLY;