Received: by 10.192.165.148 with SMTP id m20csp4149767imm; Mon, 30 Apr 2018 12:42:10 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpKNvPE8OQTkE3uZVrGb8xRSlsURIEyL0bhHOD6/UFq3NjP2TWoRkDDWB+SNZJdH3QMvgQF X-Received: by 2002:a17:902:7841:: with SMTP id e1-v6mr13773286pln.197.1525117330459; Mon, 30 Apr 2018 12:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525117330; cv=none; d=google.com; s=arc-20160816; b=rBp0UzvbEyLmombLT2a12KfRKDUCJmCZl8Y44j+GPh5T5UzTJoN8rRhHSpvdqHCNM3 e4x8imqgWWJXc1io2/o9rZpnthDgTHrJfiGThHj8AEaTRYaFYh77i3OoofsXoqQpat4y DhtjBE0mpLk8BsVpNgjDXGdLksKAVhAXhn9Vv8jNmcBPX+WbAZNJTm/I2IEKmVjJyR7B FpmtyeZArZEgvIn8eEJ4AuZBsez+0KlMjDJanp9mUSn56PsmvurMJH/OOlCSbsloVXB8 c/AGiKSpWNVITE53RTIUH2NuZ4S+3ruF6dyC87yur3+gxVKpBO1WeJohp94pUVxr8kLG sQdQ== 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=s/gL8QYpANeaKNHNs9yofZCbkqN/85IOaB3J3NapQbc=; b=pUIEZVC1ghQ22LI/rZpaR6a2Ymt7GvFgm+K2H3zPqC/HcYg6Qs+QTgx+lAqze4oWVQ PQbWkmJB+2kda/jDBDgwz3LWIjfX8ENpsHYNirzFqSbegKouUQnabfbkdsGFQkn18g+T n8wV0j4NEsH22Zn8LNUNw91jqLYxxxirXNkFq1tSjOrRfYAcn2t9bOR1vqF2CSz3WJED Q9EkYMpwVv3ESgZsNENhQYx/xSPo1anw4NeyBjJ/SfPeQ2MP0qd20K/+3iJoxfMk3ie1 gbcUlN1kfNsg0H5UOTIK1lII6gdysoh48ym6pWzXmsuwJkg8lZEU693y1F5Q6OMRf4E2 EF8g== 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 q80si7993511pfi.109.2018.04.30.12.41.56; Mon, 30 Apr 2018 12:42:10 -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 S932216AbeD3Tll (ORCPT + 99 others); Mon, 30 Apr 2018 15:41:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:36276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755266AbeD3T2a (ORCPT ); Mon, 30 Apr 2018 15:28:30 -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 08F3422DAC; Mon, 30 Apr 2018 19:28:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 08F3422DAC 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.16 068/113] ANDROID: binder: prevent transactions into own process. Date: Mon, 30 Apr 2018 12:24:39 -0700 Message-Id: <20180430184018.103018616@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430184015.043892819@linuxfoundation.org> References: <20180430184015.043892819@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.16-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 @@ -2839,6 +2839,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) { /*