Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751431AbdISNRS (ORCPT ); Tue, 19 Sep 2017 09:17:18 -0400 Received: from mail-io0-f172.google.com ([209.85.223.172]:44272 "EHLO mail-io0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751227AbdISNRP (ORCPT ); Tue, 19 Sep 2017 09:17:15 -0400 X-Google-Smtp-Source: AOwi7QDLxMDQqrjg4k2PpHhVAYNuFiKne1UCPPLabxIj8y25CKX3yorsWD+IMa6yPrcx33NJ2fpiejTehuEGSR4USYI= MIME-Version: 1.0 In-Reply-To: References: From: Andrey Konovalov Date: Tue, 19 Sep 2017 15:17:13 +0200 Message-ID: Subject: Re: usb/gadget: stalls in dummy_timer To: Alan Stern Cc: Dmitry Torokhov , Henrik Rydberg , "linux-input@vger.kernel.org" , Felipe Balbi , Greg Kroah-Hartman , Johan Hovold , Peter Chen , Yuyang Du , USB list , LKML , Dmitry Vyukov , Kostya Serebryany , syzkaller Content-Type: multipart/mixed; boundary="001a113cf4627b505b05598aad86" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 16614 Lines: 249 --001a113cf4627b505b05598aad86 Content-Type: text/plain; charset="UTF-8" On Fri, Sep 15, 2017 at 8:57 PM, Alan Stern wrote: > On Thu, 14 Sep 2017, Andrey Konovalov wrote: > >> On Thu, Sep 14, 2017 at 7:49 PM, Alan Stern wrote: >> > On Thu, 14 Sep 2017, Andrey Konovalov wrote: >> > >> >> Looked at this a little more. >> >> >> >> dummy_timer() stucks in an infinite loop. It calls >> >> usb_hcd_giveback_urb(), which in turn calls usbtouch_irq(), which >> >> calls usb_submit_urb(), which calls dummy_urb_enqueue() and puts urb >> >> back into dummy urb queue. dummy_timer() then does goto restart, finds >> >> the urb and calls usb_hcd_giveback_urb() again. And this process goes >> >> on again and again. It seems that something should either process the >> >> urb and set urb->status or it should just expire. >> > >> > There is some throttling code, but it applies only to bulk transfers. >> > Probably because the bandwidth limits for other types are slightly >> > different. However, I don't think we need to worry about this level of >> > detail, since the driver makes a number of other approximations anyway. >> > >> > Try the patch below; it should fix the problem. >> >> Hi Alan, >> >> Just tried your patch, my reproducer still hangs the kernel until all >> memory is exhausted. >> >> Thanks! > > Hmmm. Your reproducer doesn't run on my system. The mmap system call > fails, perhaps because this laptop has a 32-bit kernel. So I can't > tell what's going on. > > Can you collect a usbmon trace that shows what happens while the > reproducer runs? If it turns out to be extremely large, just post an > initial portion of it. I've attached the usbmon trace. It's actually quite short, probably due to the fact that the kernel enters infinite loop. I've also attached a reproducer that should compile on a 32 bit system, however I haven't tested whether it reproduces the issue. > > Alan Stern > --001a113cf4627b505b05598aad86 Content-Type: application/octet-stream; name=dummy_timer-stall-usbmon Content-Disposition: attachment; filename=dummy_timer-stall-usbmon Content-Transfer-Encoding: base64 X-Attachment-Id: f_j7rmhlm60 IyBjYXQgL3N5cy9rZXJuZWwvZGVidWcvdXNiL3VzYm1vbi8wdQpmZmZmODgwMDY3N2I4MDAwIDIw NTkyNTM3IFMgQ2k6MTowMDE6MCBzIGEzIDAwIDAwMDAgMDAwMSAwMDA0IDQgPApmZmZmODgwMDY3 N2I4MDAwIDIwNTkyNjk0IEMgQ2k6MTowMDE6MCAwIDQgPSAwMTAxMDEwMApmZmZmODgwMDY3N2I4 MTAwIDIwNTkyNzcyIFMgQ286MTowMDE6MCBzIDIzIDAxIDAwMTAgMDAwMSAwMDAwIDAKZmZmZjg4 MDA2NzdiODEwMCAyMDU5MjgwNCBDIENvOjE6MDAxOjAgMCAwCmZmZmY4ODAwNjc2NjQzMDAgMjA2 OTUxMzcgUyBJaToxOjAwMToxIC0xMTU6MjA0OCA0IDwKZmZmZjg4MDA2NzZlNTQwMCAyMDY5NTIx MSBTIENpOjE6MDAxOjAgcyBhMyAwMCAwMDAwIDAwMDEgMDAwNCA0IDwKZmZmZjg4MDA2NzZlNTQw MCAyMDY5NTI0OCBDIENpOjE6MD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AwNmE5OTFlMDAgMjA5NzQyNDAgUyBDaToxOjAwMjowIHMg ODAgMDYgMDNmZiAwNDA5IDAwZmYgMjU1IDwKZmZmZjg4MDA2YTk5MWUwMCAyMDk3ODA5NSBDIENp OjE6MDAyOjAgMCA0ID0gMDQwMzYxMDAKZmZmZjg4MDA2YTk5MWIwMCAyMDk4NDM5NiBTIENvOjE6 MDAyOjAgcyAwMCAwOSAwMDA4IDAwMDAgMDAwMCAwCmZmZmY4ODAwNmE5OTFiMDAgMjA5ODgwNzEg QyBDbzoxOjAwMjowIDAgMApmZmZmODgwMDZhOTkxNTAwIDIwOTg4MzgyIFMgQ2k6MTowMDI6MCBz IDgwIDA2IDAzMDcgMDQwOSAwMGZmIDI1NSA8CmZmZmY4ODAwNmE5OTE1MDAgMjA5OTIwNDAgQyBD aToxOjAwMjowIDAgNCA9IDA0MDM2MTAwCmZmZmY4ODAwNjY4OTE3MDAgMjA5OTYyNTQgUyBJaTox OjAwMjoxNSAtMTE1OjggOCA8Cg== --001a113cf4627b505b05598aad86 Content-Type: text/x-csrc; charset="US-ASCII"; name="usbtouchscreen-hang-poc-x32.c" Content-Disposition: attachment; filename="usbtouchscreen-hang-poc-x32.c" Content-Transfer-Encoding: base64 X-Attachment-Id: f_j7rmhq0x1 Ly8gYXV0b2dlbmVyYXRlZCBieSBzeXprYWxsZXIgKGh0dHA6Ly9naXRodWIuY29tL2dvb2dsZS9z eXprYWxsZXIpCgojZGVmaW5lIF9HTlVfU09VUkNFCgojaW5jbHVkZSA8YXNzZXJ0Lmg+CiNpbmNs dWRlIDxlcnJuby5oPgojaW5jbHVkZSA8ZmNudGwuaD4KI2luY2x1ZGUgPGxpbnV4L3VzYi9jaDku aD4KI2luY2x1ZGUgPGxpbnV4L3VzYi9nYWRnZXRmcy5oPgojaW5jbHVkZSA8cG9sbC5oPgojaW5j bHVkZSA8c2NoZWQuaD4KI2luY2x1ZGUgPHNpZ25hbC5oPgojaW5jbHVkZSA8c3RkYXJnLmg+Ci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RUX1NUUklORzoKICAgICAgICAgICAgICAgIGJ1ZmZlclswXSA9IDQ7CiAg ICAgICAgICAgICAgICBidWZmZXJbMV0gPSBVU0JfRFRfU1RSSU5HOwogICAgICAgICAgICAgICAg aWYgKChzZXR1cC0+d1ZhbHVlICYgMHgwZmYpID09IDApIHsKICAgICAgICAgICAgICAgICAgICAg ICAgYnVmZmVyWzJdID0gMHgwOTsKICAgICAgICAgICAgICAgICAgICAgICAgYnVmZmVyWzNdID0g MHgwNDsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJ1 ZmZlclsyXSA9IDB4NjE7CiAgICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlclszXSA9IDB4MDA7 CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBydiA9IHdyaXRlKGZkLCAmYnVmZmVy WzBdLCA0KTsKICAgICAgICAgICAgICAgIGlmIChydiAhPSA0KSB7CiAgICAgICAgICAgICAgICAg ICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGJyZWFr OwogICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICAg ICAgcmV0dXJuIDA7Cn0KCnN0YXRpYyBpbnQKZ2ZzX2hhbmRsZV9ldmVudF9zZXR1cF9zZXRfY29u ZmlndXJhdGlvbihpbnQgZmQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgc3RydWN0IHVzYl9jdHJscmVxdWVzdCogc2V0dXApCnsKICAgICAgICBpbnQgcnYgPSByZWFk KGZkLCAmcnYsIDApOwogICAgICAgIGlmIChydiAhPSAwKSB7CiAgICAgICAgICAgICAgICByZXR1 cm4gLTE7CiAgICAgICAgfQogICAgICAgIHJldHVybiAwOwp9CgpzdGF0aWMgaW50IGdmc19oYW5k bGVfZXZlbnRfc2V0dXAoaW50IGZkLCBzdHJ1Y3QgdXNiX2N0cmxyZXF1ZXN0KiBzZXR1cCkKewog ICAgICAgIHN3aXRjaCAoc2V0dXAtPmJSZXF1ZXN0KSB7CiAgICAgICAgY2FzZSBVU0JfUkVRX0dF VF9ERVNDUklQVE9SOgogICAgICAgICAgICAgICAgZ2ZzX2hhbmRsZV9ldmVudF9zZXR1cF9nZXRf ZGVzY3JpcHRvcihmZCwgc2V0dXApOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgY2Fz ZSBVU0JfUkVRX1NFVF9DT05GSUdVUkFUSU9OOgogICAgICAgICAgICAgICAgZ2ZzX2hhbmRsZV9l dmVudF9zZXR1cF9zZXRfY29uZmlndXJhdGlvbihmZCwgc2V0dXApOwogICAgICAgICAgICAgICAg YnJlYWs7CiAgICAgICAgY2FzZSBVU0JfUkVRX0dFVF9JTlRFUkZBQ0U6CiAgICAgICAgICAgICAg ICBicmVhazsKICAgICAgICBjYXNlIFVTQl9SRVFfU0VUX0lOVEVSRkFDRToKICAgICAgICAgICAg ICAgIGJyZWFrOwogICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAg ICB9CiAgICAgICAgcmV0dXJuIDA7Cn0KCnN0YXRpYyBpbnQgZ2ZzX2hhbmRsZV9ldmVudChpbnQg ZmQsIHN0cnVjdCB1c2JfZ2FkZ2V0ZnNfZXZlbnQqIGV2ZW50KQp7CiAgICAgICAgc3dpdGNoIChl dmVudC0+dHlwZSkgewogICAgICAgIGNhc2UgR0FER0VURlNfTk9QOgogICAgICAgICAgICAgICAg YnJlYWs7CiAgICAgICAgY2FzZSBHQURHRVRGU19DT05ORUNUOgogICAgICAgICAgICAgICAgYnJl YWs7CiAgICAgICAgY2FzZSBHQURHRVRGU19TRVRVUDoKICAgICAgICAgICAgICAgIGdmc19oYW5k bGVfZXZlbnRfc2V0dXAoZmQsICZldmVudC0+dS5zZXR1cCk7CiAgICAgICAgICAgICAgICBicmVh azsKICAgICAgICBjYXNlIEdBREdFVEZTX0RJU0NPTk5FQ1Q6CiAgICAgICAgICAgICAgICBicmVh azsKICAgICAgICBjYXNlIEdBREdFVEZTX1NVU1BFTkQ6CiAgICAgICAgICAgICAgICBicmVhazsK ICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgfQogICAgICAg IHJldHVybiAwOwp9CgojZGVmaW5lIEdGU19NQVhfRVZFTlRTIDEKCnN0YXRpYyBpbnQgZ2ZzX2hh bmRsZV9lcDAoaW50IGZkKQp7CiAgICAgICAgc3RydWN0IHBvbGxmZCBwZmQ7CiAgICAgICAgc3Ry dWN0IHVzYl9nYWRnZXRmc19ldmVudCBldmVudHNbR0ZTX01BWF9FVkVOVFNdOwoKICAgICAgICBw ZmQuZmQgPSBmZDsKICAgICAgICBwZmQuZXZlbnRzID0gUE9MTElOIHwgUE9MTE9VVCB8IFBPTExI VVA7CgogICAgICAgIGludCBpOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCAxNTsgaSsrKSB7CiAg ICAgICAgICAgICAgICBpbnQgcnYgPSBwb2xsKCZwZmQsIDEsIDEwMCk7CiAgICAgICAgICAgICAg ICBpZiAocnYgPCAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAg ICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChydiA9PSAwKQogICAgICAgICAgICAgICAg ICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICAgIHJ2ID0gcmVhZChmZCwgJmV2ZW50c1sw XSwgc2l6ZW9mKGV2ZW50cykpOwogICAgICAgICAgICAgICAgaWYgKHJ2IDwgMCkgewogICAgICAg ICAgICAgICAgICAgICAgICByZXR1cm4gLTI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAg ICAgICBpZiAocnYgPT0gMCkKICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAg ICAgICAgICAgICBnZnNfaGFuZGxlX2V2ZW50KGZkLCAmZXZlbnRzWzBdKTsKICAgICAgICB9Cgog ICAgICAgIHJldHVybiAwOwp9CgpzdGF0aWMgdWludHB0cl90IHN5el91c2JfY29uZmlnKHVpbnRw dHJfdCBhMCwgdWludHB0cl90IGExKQp7CiAgICAgICAgaW50IGZkID0gb3BlbigiL2Rldi9nYWRn ZXQvZHVtbXlfdWRjIiwgT19SRFdSKTsKICAgICAgICBpZiAoZmQgPCAwKQogICAgICAgICAgICAg ICAgcmV0dXJuIC0xOwoKICAgICAgICB1c2xlZXAoMzAgKiAxMDAwKTsKCiAgICAgICAgaW50NjRf dCBsZW5ndGggPSBhMDsKICAgICAgICBjaGFyKiBkYXRhID0gKGNoYXIqKWExOwogICAgICAgIGlu dCBydiA9IHdyaXRlKGZkLCBkYXRhLCBsZW5ndGgpOwogICAgICAgIGlmIChydiA8IDApIHsKICAg ICAgICAgICAgICAgIHJldHVybiAtMjsKICAgICAgICB9CgogICAgICAgIGdmc19oYW5kbGVfZXAw KGZkKTsKCiAgICAgICAgcmV0dXJuIGZkOwp9Cgpsb25nIHJbNjZdOwoKdm9pZCBsb29wKCkKewog ICAgICAgIG1lbXNldChyLCAtMSwgc2l6ZW9mKHIpKTsKICAgICAgICByWzBdID0gKGxvbmcpbW1h cCgodm9pZCopMHgyMzAwMHVsLCAweDEwMDB1bCwgMHgzdWwsIDB4MzJ1bCwKICAgICAgICAgICAg ICAgICAgICAgICAweGZmZmZmZmZmdWwsIDB4MHVsKTsKICAgICAgICAqKHVpbnQzMl90KikweDIz MDAwID0gKHVpbnQzMl90KTB4MDsKICAgICAgICAqKHVpbnQ4X3QqKTB4MjMwMDQgPSAodWludDhf dCkweDk7CiAgICAgICAgKih1aW50OF90KikweDIzMDA1ID0gKHVpbnQ4X3QpMHgyOwogICAgICAg ICoodWludDE2X3QqKTB4MjMwMDYgPSAodWludDE2X3QpMHgzNjsKICAgICAgICAqKHVpbnQ4X3Qq KTB4MjMwMDggPSAodWludDhfdCkweDE7CiAgICAgICAgKih1aW50OF90KikweDIzMDA5ID0gKHVp bnQ4X3QpMHg4OwogICAgICAgICoodWludDhfdCopMHgyMzAwYSA9ICh1aW50OF90KTB4NjAwOwog ICAgICAgICoodWludDhfdCopMHgyMzAwYiA9ICh1aW50OF90KTB4ODA7CiAgICAgICAgKih1aW50 OF90KikweDIzMDBjID0gKHVpbnQ4X3QpMHg4OwogICAgICAgICoodWludDhfdCopMHgyMzAwZCA9 ICh1aW50OF90KTB4OTsKICAgICAgICAqKHVpbnQ4X3QqKTB4MjMwMGUgPSAodWludDhfdCkweDQ7 CiAgICAgICAgKih1aW50OF90KikweDIzMDBmID0gKHVpbnQ4X3QpMHgwOwogICAgICAgICoodWlu dDhfdCopMHgyMzAxMCA9ICh1aW50OF90KTB4OTsKICAgICAgICAqKHVpbnQ4X3QqKTB4MjMwMTEg PSAodWludDhfdCkweDQ7CiAgICAgICAgKih1aW50OF90KikweDIzMDEyID0gKHVpbnQ4X3QpMHhm ZjsKICAgICAgICAqKHVpbnQ4X3QqKTB4MjMwMTMgPSAodWludDhfdCkweDM7CiAgICAgICAgKih1 aW50OF90KikweDIzMDE0ID0gKHVpbnQ4X3QpMHgwOwogICAgICAgICoodWludDhfdCopMHgyMzAx NSA9ICh1aW50OF90KTB4NzsKICAgICAgICAqKHVpbnQ4X3QqKTB4MjMwMTYgPSAodWludDhfdCkw eDk7CiAgICAgICAgKih1aW50OF90KikweDIzMDE3ID0gKHVpbnQ4X3QpMHg1OwogICAgICAgICoo dWludDhfdCopMHgyMzAxOCA9ICh1aW50OF90KTB4OTsKICAgICAgICAqKHVpbnQ4X3QqKTB4MjMw MTkgPSAodWludDhfdCkweDEwOwogICAgICAgICoodWludDE2X3QqKTB4MjMwMWEgPSAodWludDE2 X3QpMHgxOwogICAgICAgICoodWludDhfdCopMHgyMzAxYyA9ICh1aW50OF90KTB4NTsKICAgICAg ICAqKHVpbnQ4X3QqKTB4MjMwMWQgPSAodWludDhfdCkweGZmZmZmODAwOwogICAgICAgICoodWlu dDhfdCopMHgyMzAxZSA9ICh1aW50OF90KTB4MmJiYTsKICAgICAgICAqKHVpbnQ4X3QqKTB4MjMw MWYgPSAodWludDhfdCkweDk7CiAgICAgICAgKih1aW50OF90KikweDIzMDIwID0gKHVpbnQ4X3Qp MHg1OwogICAgICAgICoodWludDhfdCopMHgyMzAyMSA9ICh1aW50OF90KTB4ODk4ZjsKICAgICAg ICAqKHVpbnQ4X3QqKTB4MjMwMjIgPSAodWludDhfdCkweDM7CiAgICAgICAgKih1aW50MTZfdCop MHgyMzAyMyA9ICh1aW50MTZfdCkweDdjMTEzMzQ3OwogICAgICAgICoodWludDhfdCopMHgyMzAy NSA9ICh1aW50OF90KTB4MDsKICAgICAgICAqKHVpbnQ4X3QqKTB4MjMwMjYgPSAodWludDhfdCkw eGJjOwogICAgICAgICoodWludDhfdCopMHgyMzAyNyA9ICh1aW50OF90KTB4NTsKICAgICAgICAq KHVpbnQ4X3QqKTB4MjMwMjggPSAodWludDhfdCkweDk7CiAgICAgICAgKih1aW50OF90KikweDIz MDI5ID0gKHVpbnQ4X3QpMHg1OwogICAgICAgICoodWludDhfdCopMHgyMzAyYSA9ICh1aW50OF90 KTB4NzsKICAgICAgICAqKHVpbnQ4X3QqKTB4MjMwMmIgPSAodWludDhfdCkweDE0OwogICAgICAg ICoodWludDE2X3QqKTB4MjMwMmMgPSAodWludDE2X3QpMHg5NzJmOwogICAgICAgICoodWludDhf dCopMHgyMzAyZSA9ICh1aW50OF90KTB4MWY7CiAgICAgICAgKih1aW50OF90KikweDIzMDJmID0g KHVpbnQ4X3QpMHg3OwogICAgICAgICoodWludDhfdCopMHgyMzAzMCA9ICh1aW50OF90KTB4M2Y7 CiAgICAgICAgKih1aW50OF90KikweDIzMDMxID0gKHVpbnQ4X3QpMHg5OwogICAgICAgICoodWlu dDhfdCopMHgyMzAzMiA9ICh1aW50OF90KTB4NTsKICAgICAgICAqKHVpbnQ4X3QqKTB4MjMwMzMg PSAodWludDhfdCkweDg7CiAgICAgICAgKih1aW50OF90KikweDIzMDM0ID0gKHVpbnQ4X3QpMHgw OwogICAgICAgICoodWludDE2X3QqKTB4MjMwMzUgPSAodWludDE2X3QpMHg3OwogICAgICAgICoo dWludDhfdCopMHgyMzAzNyA9ICh1aW50OF90KTB4ODE7CiAgICAgICAgKih1aW50OF90KikweDIz MDM4ID0gKHVpbnQ4X3QpMHg3ZmY7CiAgICAgICAgKih1aW50OF90KikweDIzMDM5ID0gKHVpbnQ4 X3QpMHgyMDA7CiAgICAgICAgKih1aW50OF90KikweDIzMDNhID0gKHVpbnQ4X3QpMHgxMjsKICAg ICAgICAqKHVpbnQ4X3QqKTB4MjMwM2IgPSAodWludDhfdCkweDE7CiAgICAgICAgKih1aW50MTZf dCopMHgyMzAzYyA9ICh1aW50MTZfdCkweGZmZmZmZmZmOwogICAgICAgICoodWludDhfdCopMHgy MzAzZSA9ICh1aW50OF90KTB4N2ZkOwogICAgICAgICoodWludDhfdCopMHgyMzAzZiA9ICh1aW50 OF90KTB4NDsKICAgICAgICAqKHVpbnQ4X3QqKTB4MjMwNDAgPSAodWludDhfdCkweDM7CiAgICAg ICAgKih1aW50OF90KikweDIzMDQxID0gKHVpbnQ4X3QpMHgxMDAwOwogICAgICAgICoodWludDE2 X3QqKTB4MjMwNDIgPSAodWludDE2X3QpMHg0MDM7CiAgICAgICAgKih1aW50MTZfdCopMHgyMzA0 NCA9ICh1aW50MTZfdCkweDEwMDBmOWU5OwogICAgICAgICoodWludDE2X3QqKTB4MjMwNDYgPSAo dWludDE2X3QpMHg0OwogICAgICAgICoodWludDhfdCopMHgyMzA0OCA9ICh1aW50OF90KTB4NDsK ICAgICAgICAqKHVpbnQ4X3QqKTB4MjMwNDkgPSAodWludDhfdCkweDg7CiAgICAgICAgKih1aW50 OF90KikweDIzMDRhID0gKHVpbnQ4X3QpMHg3ZmY7CiAgICAgICAgKih1aW50OF90KikweDIzMDRi ID0gKHVpbnQ4X3QpMHgxOwogICAgICAgIHJbNjVdID0gc3l6X3VzYl9jb25maWcoMHg0Y3VsLCAw eDIzMDAwdWwpOwp9CgppbnQgbWFpbigpCnsKICAgICAgICBnYWRnZXRmc19ta2RpcigpOwogICAg ICAgIGdhZGdldGZzX21vdW50KCk7CiAgICAgICAgbG9vcCgpOwogICAgICAgIHJldHVybiAwOwp9 Cg== --001a113cf4627b505b05598aad86--