Received: by 10.192.165.148 with SMTP id m20csp4165793imm; Mon, 30 Apr 2018 13:02:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpBp8yIFE9ks7l4NQIye/YY5VEXb98JW0AMt0e0DyGamqI6at2sEAI5Rop/gYuliTjRaA6j X-Received: by 2002:a65:50c7:: with SMTP id s7-v6mr10804019pgp.192.1525118528259; Mon, 30 Apr 2018 13:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525118528; cv=none; d=google.com; s=arc-20160816; b=akUmFC9dDR+eYnoqruq/olW0S2Rxhat3cJDOaPJ1PDVjOmBL2cAFb+vb9hUMQyK+2N REJ+Aq4YpR+M9Oc2v6gCLqQgnLzpA9Q/xQ5Gqhoifrs8vAUat4UB53cdwl26KlhsfZRT QvmR/Bb6s+JrukNoTfNL/mHmuyK0rhb6K6pnBViG8E0X74ddbOwXbJn6XH4R/y1JNeJP vC408xeOq9fYAzmjWr+yVP28awGz3fkuN+9TLbM9c9hEehuZtgjZ3ihPnAGwR7nsdfCP rxK2bjDCDchxRiezTK1Eno7UmncJpN20LSLauzXw+BapVsgoTDbfsd4GURGu/6esdAHm 9Xzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=BTvgHnWiHcfOpP/OTayW4ZkeAnpNIrNKpqD2akEEqgs=; b=pDaoBBZrbKmKY7aGJ1wEIrl/VFLwxzNLjyl8P9nk36QvMD/jC6eOI0T6JvjbWepsCx l6w3dTYZQS1izLOySLzqX9LUx23xFu93u+d+rG0padaQsI7AZL+FJNaguEyWHASomqq8 LDw+pTgfOhnU6bBh6wHNQkbO3AHxk/0srbM6LCP/Qr45zdhGZluBzkEQu0m+Vr6K5baL 5gC1W8/gwRyW+G6aV7fksq19oD626B+99GKFUHztCNgaTGoNhGf1HyAqhkg3EaaimrbX /3KaAC8mKnLNoyVvf1FAk/27FBG90nL9Pu9XHd4avLbhwkFsd4ls89gGnQiMvCvyaMZK Mucw== ARC-Authentication-Results: i=1; mx.google.com; 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 z21-v6si6745590pgn.570.2018.04.30.13.01.54; Mon, 30 Apr 2018 13:02:08 -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; 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 S1756026AbeD3T1i (ORCPT + 99 others); Mon, 30 Apr 2018 15:27:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:33956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755263AbeD3T11 (ORCPT ); Mon, 30 Apr 2018 15:27:27 -0400 Received: from localhost (unknown [104.132.1.102]) (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 1210522DCC; Mon, 30 Apr 2018 19:27:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1210522DCC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+09e05aba06723a94d43d@syzkaller.appspotmail.com, Martijn Coenen Subject: [PATCH 4.14 59/91] ANDROID: binder: prevent transactions into own process. Date: Mon, 30 Apr 2018 12:24:41 -0700 Message-Id: <20180430184007.246412352@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430184004.216234025@linuxfoundation.org> References: <20180430184004.216234025@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Martijn Coenen commit 7aa135fcf26377f92dc0680a57566b4c7f3e281b upstream. This can't happen with normal nodes (because you can't get a ref to a node you own), but it could happen with the context manager; to make the behavior consistent with regular nodes, reject transactions into the context manager by the process owning it. Reported-by: syzbot+09e05aba06723a94d43d@syzkaller.appspotmail.com Signed-off-by: Martijn Coenen Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/android/binder.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -2785,6 +2785,14 @@ 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) { + binder_user_error("%d:%d got transaction to context manager from process owning it\n", + proc->pid, thread->pid); + return_error = BR_FAILED_REPLY; + return_error_param = -EINVAL; + return_error_line = __LINE__; + goto err_invalid_target_handle; + } } if (!target_node) { /*