From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1E90C4338F for ; Tue, 17 Aug 2021 05:58:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 87D6460E52 for ; Tue, 17 Aug 2021 05:58:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234300AbhHQF7X (ORCPT ); Tue, 17 Aug 2021 01:59:23 -0400 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:53379 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233676AbhHQF7W (ORCPT ); Tue, 17 Aug 2021 01:59:22 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=xianting.tian@linux.alibaba.com;NM=1;PH=DS;RN=3;SR=0;TI=SMTPD_---0UjKztuN_1629179928; Received: from B-LB6YLVDL-0141.local(mailfrom:xianting.tian@linux.alibaba.com fp:SMTPD_---0UjKztuN_1629179928) by smtp.aliyun-inc.com(127.0.0.1); Tue, 17 Aug 2021 13:58:48 +0800 Subject: Re: [PATCH] mailbox: fix a UAF bug in msg_submit() To: Jassi Brar Cc: Linux Kernel Mailing List , guoren@kernel.org References: <20210806121521.124365-1-xianting.tian@linux.alibaba.com> From: Xianting TIan Message-ID: <977740a4-c08d-663d-410e-3375d034d2e8@linux.alibaba.com> Date: Tue, 17 Aug 2021 13:58:47 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2021/8/17 下午12:29, Jassi Brar 写道: > On Fri, Aug 6, 2021 at 7:15 AM Xianting Tian > wrote: >> We met a UAF issue during our mailbox testing. >> >> In synchronous mailbox, we use mbox_send_message() to send a message >> and wait for completion. mbox_send_message() calls msg_submit() to >> send the message for the first time, if timeout, it will send the >> message in tx_tick() for the second time. >> > Seems like your controller's .send_data() returns error. Can you > please explain why it does so? Because > send_data() only _accepts_ data for further transmission... which > should seldom be a problem. Thanks for the comments, We developed virtio-mailbox for heterogeneous virtualization system. virtio-mailbox is based on the mialbox framework. In virtio framework, its send func 'virtqueue_add_outbuf()' may return error, which caused .send_data() return error.  And also contains other csenarios. But I think mailbox framework shouldn't depend on .send_data() always return OK,  as .send_data() is implemented by mailbox hardware manufacturer, which is not controlled by mailbox framework itself. You said 'seldom',  but it still possible we can meet such issue.  sucn as flexrm_send_data() of drivers/mailbox/bcm-flexrm-mailbox.c. I think mailbox framework should be work normaly no matter .send_data() returns ok or not ok.  Do you think so? thanks > > thanks.