Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp307452rwj; Fri, 23 Dec 2022 01:29:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXtTJepq5mVI82lLbI5NT/PhuMkuL2l3zpU50jDnTptUm+WbYUsgoJiL0ima8/UH72Oa6SCk X-Received: by 2002:a05:6a21:6d86:b0:a3:e346:2548 with SMTP id wl6-20020a056a216d8600b000a3e3462548mr13949725pzb.15.1671787762007; Fri, 23 Dec 2022 01:29:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671787761; cv=none; d=google.com; s=arc-20160816; b=xWyoAbrxHeMIjtVJsM5F3lTfuzvSsCZFEmvmSYPPeeVdPsMc2HANtg3zZGfm7qdbwt AjgcR02rodndZDan7lplTfeNKGpohpWrT1gL+W/RkNoUwzGRL8eNl1lFjXxslpw2Ps3g Zh9/5SXloWvszfFDvCafIdVhu69Ni5DeI5pfBlaiP5Tp0jI1+vPLQ/osvagk3b8f5qHE qWlRAJfLDNBhG7QiTYIp/dUEsFx92693Jt6Rn3sn5hYxm/XG9O2ldxCwk7nrDa0A7xMj ZM+7GOlVE8780AkhwT+PSewORAO6uZ+glczu7lzU0Bx8XkNmxWSG1UwzUh04NyBJNf59 nR1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vMKIJQQf6XQ7e0LO/FmODfA1kV8rLyp4SAkApiLqNTw=; b=jhq3RwqmF/vYEhwa5MAweTuls05Xv6Xz3cfHh5+ZMaD4MsowH9q1IA599EN1efCTvX 82KJ1kGaab/ZbVsDtRLR6uqc9/n56bqCNCekE3QOrJwIYbRaeHG8lM8miSOzkVZP7hQh I/CrkCiDH7spmmrvajg+CJPp56JjJBpT77PPsBLWmncGJF7rxODV5qRO8Q8egplAP3na O0tOYFzviWfyJXKqOv3jBHhPIWPzhIU5zyWJVatTNjMbNnCv9PIwrre2L0v5UZm9sckL 8k8gDJAFja+0q3agnBqnQsexp3HclVWYPoaWO1pHgAGU935Abfi5Ig1tkhvKlYSIzh0E 1EOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pdy1zHob; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u9-20020a056a00098900b0057629288720si3358046pfg.176.2022.12.23.01.29.13; Fri, 23 Dec 2022 01:29:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pdy1zHob; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235961AbiLWJE1 (ORCPT + 67 others); Fri, 23 Dec 2022 04:04:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbiLWJEZ (ORCPT ); Fri, 23 Dec 2022 04:04:25 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEB551BEBD; Fri, 23 Dec 2022 01:04:23 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id h16so3976305wrz.12; Fri, 23 Dec 2022 01:04:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=vMKIJQQf6XQ7e0LO/FmODfA1kV8rLyp4SAkApiLqNTw=; b=pdy1zHobnHCTR074QBSTKtI8D32zRfGKcwZYGaOchmrWWHbNccxZS1rb9qDoxeOug+ ofVgoUYG0DzPgB0L4YQ0qDch9Ygro/yYn53NEudzVIyHB+PV941hspLyWbG6hVix+Fgq 1fJO0DN+mjlTca17Ze1KVfGH7GFjAelnMrJ06o0tQpOQwjKIKfx3H4YgosCE8HBjxZFr 1LjN8BR7+IIYCnL/CsL+Zw3TwL93fiB8UEHgjgVyXNDYrcpheyOrcy8IaPGpRMj5KUp5 v2198A7v89s1nr/roRP81GaVyALDF17rTmjNncZX9O7YZ17z1T6pr4wXstVB2WIwt2V7 ZDLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vMKIJQQf6XQ7e0LO/FmODfA1kV8rLyp4SAkApiLqNTw=; b=2OTGlbpF7WfGnPZhTraasqu+hM3uiLJCdzGfyLcPEyR7VLS8XVzVdExd7Ht6pHdkc0 YqKOlTPN/Gj5LxCPkChUJe+gtIJOAVC0cVeSwU2f94pQx0v7K3ne68rQ+v59iNsGYT6V 6ofpooELsA+Y9KcdWHLdNTKrgiM5QtF7+p78Ws+rDPg0zOU5DZISaTS1MG1YCX6+f704 vhkskMic8WvC/qs35iMUzDTV6r6ahkLx62LKwwqfZ9/1OrQMa5aGI4ECziWdeLOxXj0o q2w4FBkhfUY8w8RfTmgPA7JJ3xKb94ZcT1AzhDS55WNoIIGwyjx7wVWTfAz3s1Uok80N XTXA== X-Gm-Message-State: AFqh2kr4n6Xmg2bsKfFCJSJtbjHaLE7Ji8Xljl+yNY2oXkRUJgKkX+9Z jTlcyeNBpDT48aaiFtTZo20= X-Received: by 2002:adf:f54a:0:b0:236:611b:e8eb with SMTP id j10-20020adff54a000000b00236611be8ebmr5690386wrp.37.1671786262402; Fri, 23 Dec 2022 01:04:22 -0800 (PST) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id j11-20020a5d452b000000b0022cc0a2cbecsm2551106wra.15.2022.12.23.01.04.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Dec 2022 01:04:21 -0800 (PST) Date: Fri, 23 Dec 2022 12:04:18 +0300 From: Dan Carpenter To: Prashanth K Cc: David Laight , 'Greg Kroah-Hartman' , "Gustavo A . R . Silva" , Shuah Khan , John Keeping , Pratham Pratap , Vincent Pelletier , Udipto Goswami , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "# 5 . 15" Subject: Re: usb: f_fs: Fix CFI failure in ki_complete Message-ID: References: <1670851464-8106-1-git-send-email-quic_prashk@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 22, 2022 at 06:21:03PM +0530, Prashanth K wrote: > > > On 14-12-22 11:05 pm, David Laight wrote: > > From: Greg Kroah-Hartman > > > Sent: 12 December 2022 13:35 > > > > > > On Mon, Dec 12, 2022 at 06:54:24PM +0530, Prashanth K wrote: > > > > Function pointer ki_complete() expects 'long' as its second > > > > argument, but we pass integer from ffs_user_copy_worker. This > > > > might cause a CFI failure, as ki_complete is an indirect call > > > > with mismatched prototype. Fix this by typecasting the second > > > > argument to long. > > > > > > "might"? Does it or not? If it does, why hasn't this been reported > > > before? > > > > Does the cast even help at all. > Actually I also have these same questions > - why we haven't seen any instances other than this one? > - why its not seen on other indirect function calls? > > Here is the the call stack of the failure that we got. > > [ 323.288681][ T7] Kernel panic - not syncing: CFI failure (target: > 0xffffffe5fc811f98) > [ 323.288710][ T7] CPU: 6 PID: 7 Comm: kworker/u16:0 Tainted: G S W > OE 5.15.41-android13-8-g5ffc5644bd20 #1 > [ 323.288730][ T7] Workqueue: adb ffs_user_copy_worker.cfi_jt > [ 323.288752][ T7] Call trace: > [ 323.288755][ T7] dump_backtrace.cfi_jt+0x0/0x8 > [ 323.288772][ T7] dump_stack_lvl+0x80/0xb8 > [ 323.288785][ T7] panic+0x180/0x444 > [ 323.288797][ T7] find_check_fn+0x0/0x218 > [ 323.288810][ T7] ffs_user_copy_worker+0x1dc/0x204 > [ 323.288822][ T7] kretprobe_trampoline.cfi_jt+0x0/0x8 > [ 323.288837][ T7] worker_thread+0x3ec/0x920 > [ 323.288850][ T7] kthread+0x168/0x1dc > [ 323.288859][ T7] ret_from_fork+0x10/0x20 > [ 323.288866][ T7] SMP: stopping secondary CPUs > > And from address to line translation, we got know the issue is from > ffs_user_copy_worker+0x1dc/0x204 > || > io_data->kiocb->ki_complete(io_data->kiocb, ret); > > And "find_check_fn" was getting invoked from ki_complete. Only thing that I > found suspicious about ki_complete() is its argument types. That's why I > pushed this patch here, so that we can discuss this out here. I think the problem is more likely whatever ->ki_complete() points to but I have no idea what that is on your system. You're using an Android kernel so it could be something out of tree as well... regards, dan carpenter