From patchwork Wed Sep 27 19:52:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Harkes X-Patchwork-Id: 9974733 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6D8706037F for ; Wed, 27 Sep 2017 20:25:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FBEF29333 for ; Wed, 27 Sep 2017 20:25:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5495A29336; Wed, 27 Sep 2017 20:25:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBC6929330 for ; Wed, 27 Sep 2017 20:25:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751931AbdI0UX4 (ORCPT ); Wed, 27 Sep 2017 16:23:56 -0400 Received: from hurricane.elijah.cs.cmu.edu ([128.2.209.191]:52732 "EHLO hurricane.elijah.cs.cmu.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751484AbdI0UX4 (ORCPT ); Wed, 27 Sep 2017 16:23:56 -0400 X-Greylist: delayed 1823 seconds by postgrey-1.27 at vger.kernel.org; Wed, 27 Sep 2017 16:23:55 EDT Received: from jaharkes by hurricane.elijah.cs.cmu.edu with local (Exim 4.89) (envelope-from ) id 1dxIOg-00027W-0t; Wed, 27 Sep 2017 15:53:30 -0400 From: Jan Harkes To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, jaharkes@cs.cmu.edu, stable@vger.kernel.org Subject: [PATCH] coda: fix 'kernel memory exposure attempt' in fsync Date: Wed, 27 Sep 2017 15:52:12 -0400 Message-Id: <20170927195212.6851-1-jaharkes@cs.cmu.edu> X-Mailer: git-send-email 2.14.2 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When an application called fsync on a file in Coda a small request with just the file identifier was allocated, but the declared length was set to the size of union of all possible upcall requests. This bug has been around for a very long time and is now caught by the extra checking in usercopy that was introduced in Linux-4.8. The exposure happens when the Coda cache manager process reads the fsync upcall request at which point it is killed. As a result there is nobody servicing any further upcalls, trapping any processes that try to access the mounted Coda filesystem. Cc: stable@vger.kernel.org Signed-off-by: Jan Harkes --- fs/coda/upcall.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c index e82357c89979..8cf16d8c5261 100644 --- a/fs/coda/upcall.c +++ b/fs/coda/upcall.c @@ -446,8 +446,7 @@ int venus_fsync(struct super_block *sb, struct CodaFid *fid) UPARG(CODA_FSYNC); inp->coda_fsync.VFid = *fid; - error = coda_upcall(coda_vcp(sb), sizeof(union inputArgs), - &outsize, inp); + error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); CODA_FREE(inp, insize); return error;