From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com [209.85.219.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48E77101CE; Fri, 7 Jun 2024 17:15:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717780536; cv=none; b=E6FVY6wvkIRuE1jM0eiudf9Y61bHEQ8EyqalIFQ1J/B1tyi5ZGzbRmX3rKpNgSUe1m04MzVxuZRirUgE8UBh3mc2IA5rm0QPQK/u75e+2vIyh4r1gbfpq0KvJdSepm9TMSkPP6CgvYF7PXqoqwzeB5pNTaO6T/uA0dXcUt33jrM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717780536; c=relaxed/simple; bh=76uotXsz0hDirHkDuLKPY3g3IKlitiMFZfZaCkCdpW8=; h=MIME-Version:From:Date:Message-ID:Subject:To:Content-Type; b=b+81/gFxYcOw0VdZY8RJBTYyGAaWjEyXXBfaOP8cPEJ7ojONyIfYrIVkDVdbY5jn1ABOOu+FBAgPZDIrnEZtmGJRcZJUw8BDGNz8s4p3Ut9lEe+Ai0QXmb6gGzu5+IwHLxYK4alVdsS846czZFlSIVK+/yCcaAK+QUwU/lT/tzM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VBQp+ChF; arc=none smtp.client-ip=209.85.219.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VBQp+ChF" Received: by mail-yb1-f169.google.com with SMTP id 3f1490d57ef6-dfb05bcc50dso494950276.0; Fri, 07 Jun 2024 10:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717780534; x=1718385334; darn=vger.kernel.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=/d5F2ogY2I6lkcfFQaYAPyGfMLIkbdCrFTvzog9I67Y=; b=VBQp+ChFpmHOvBXHMvHmXHvNWzxM0rQeBhuDHAPrD08B/CK9h54ecp1WrCW6WfNejw aitFnCVOjyUzHrkz+/yu7S0dgpOJqd3rYG5Jfh+zunj95hv9DCrW2HTBWOZfUiaqO+IB hg7Sw88m/dvFrbNuMkgueUCHW4DM+9CjI+HZpXWMKS7GMs4mEoTCQU0xg3JGt/2ZsBZ9 8QCRRCJfkpwC8GCk2XIYrZ7PpnLDj8brnfG+5TBEaEWG4iyH0S+ram+p9/5OLulG9XQJ c2RDjEWK7rpKxGEdH9rf9rNariZI/1DsEfehqWneIxuGgXqPDaWDYJsmNI+WagkBVjN4 pAtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717780534; x=1718385334; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=/d5F2ogY2I6lkcfFQaYAPyGfMLIkbdCrFTvzog9I67Y=; b=Ozfhsae1H9ZHt06mDx7EAxIUZeNaN4T/Jz9BhLYLFLGYQW218XPRhbz2NnYies+aJr l4nMpt9YCld/a/JMTP1ragBvl7JNTnTA+wjdWFPPil2UPWK5txJKc+QzdLnd5Ma2DcjW L8V4uqiQvEkLJbyqCmmh+DIhG/JD2/wJkG95xZgmCXNDORIrSyLudcLc8ytWuIuqmm08 /vyJKfUfwysPAkHyKhtoGNkUTohtZXIgb9HdQkan8+UeJn2KtqWSQpIt+m4f+lOq4fgk qWBcrlJvS+D7VF6NuDcC7MJcRSwsGa85KkpcIECdPezkM/DLzfiufcrg6a6XFsDZVxIO 5f7A== X-Forwarded-Encrypted: i=1; AJvYcCUDYZVuABTa18VvviaG35o/t2tUxgQGVbFP64js1wRDh8UoD/EvNlQMSqibmGpOGpCQbkq+rrcxDxGDs3aadOfFDdSK8zBxyjixGcWs86GmtfXVZQHlAzUX08UAJ77QNXPuya47rvs= X-Gm-Message-State: AOJu0YxLS0JwjR1QtbdUhVZpyhFKkd3GLde/hjMJ1iIm35gJAawXTNMc /C0NcwoduzR0ZCtrHcwgspJJgq3Znhk+IbIcGurp8PtGyz0zPamrCBT21+BtiLB3VunO40hg3UI lZk/v7TNysddErgHbx2KY7tJp5kM= X-Google-Smtp-Source: AGHT+IERqwGEyI7BP0oSeM9acnMiZMCdgS1UQlYCh1x96nbp61YeMixuUvsCeMdJ6gRGH7Z+lqIxsxH7hfjCYWy/Nts= X-Received: by 2002:a25:ce11:0:b0:df7:8b27:9292 with SMTP id 3f1490d57ef6-dfaf6684c61mr2933634276.42.1717780533942; Fri, 07 Jun 2024 10:15:33 -0700 (PDT) Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: chase xd Date: Fri, 7 Jun 2024 19:15:23 +0200 Message-ID: Subject: [io-uring] WARNING in __put_task_struct To: axboe@kernel.dk, asml.silence@gmail.com, io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: multipart/mixed; boundary="000000000000873698061a4ff267" --000000000000873698061a4ff267 Content-Type: text/plain; charset="UTF-8" Dear Linux kernel maintainers, Syzkaller reports this previously unknown bug on Linux 6.8.0-rc3-00043-ga69d20885494-dirty #4. Seems like the bug was silently or unintendedly fixed in the latest version. I found a similar bug report [here](https://syzkaller.appspot.com/bug?id=ac425cc8dcf667de21cbe25208555a346ab658d0), but I think this should be a different bug? ``` Syzkaller hit 'WARNING in __put_task_struct' bug. ------------[ cut here ]------------ WARNING: CPU: 2 PID: 10662 at kernel/fork.c:967 __put_task_struct+0x290/0x340 kernel/fork.c:967 Modules linked in: CPU: 2 PID: 10662 Comm: syz-executor389 Not tainted 6.8.0-rc3-00043-ga69d20885494-dirty #52 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 RIP: 0010:__put_task_struct+0x290/0x340 kernel/fork.c:967 Code: da ff ff 48 8b 3d b0 28 69 0f 4c 89 e6 e8 88 d2 7b 00 e9 45 ff ff ff be 03 00 00 00 4c 89 e7 e8 46 be c7 02 e9 33 ff ff ff 90 <0f> 0b 90 e9 ac fd ff ff 90 0f 0b 90 e9 e9 fd ff ff 90 0f 0b 90 e9 RSP: 0018:ffffc90017f67b38 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 1ffff92002fecf6f RCX: 1ffff92002fecf36 RDX: 1ffff1100e71a530 RSI: ffffffff8a0bdce0 RDI: ffff8880738d2980 RBP: ffff8880738d2440 R08: 0000000000000000 R09: fffffbfff23d9a15 R10: ffffffff91ecd0af R11: 0000000000000000 R12: ffffffff840b8886 R13: ffff8880738d2468 R14: ffff888024ad7818 R15: ffff8880738d2440 FS: 0000555557445480(0000) GS:ffff8880b9880000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ff010cdf0b0 CR3: 0000000032094000 CR4: 0000000000750ef0 PKRU: 55555554 Call Trace: put_task_struct include/linux/sched/task.h:138 [inline] io_wq_exit_workers io_uring/io-wq.c:1274 [inline] io_wq_put_and_exit+0x765/0x8f0 io_uring/io-wq.c:1296 io_uring_clean_tctx+0x10e/0x190 io_uring/tctx.c:193 io_uring_cancel_generic+0x643/0x7c0 io_uring/io_uring.c:3395 io_uring_files_cancel include/linux/io_uring.h:21 [inline] do_exit+0x4bf/0x25a0 kernel/exit.c:829 do_group_exit+0xb4/0x250 kernel/exit.c:1020 __do_sys_exit_group kernel/exit.c:1031 [inline] __se_sys_exit_group kernel/exit.c:1029 [inline] __x64_sys_exit_group+0x39/0x40 kernel/exit.c:1029 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd8/0x270 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6f/0x77 RIP: 0033:0x7ff010c59031 Code: b8 ff ff ff be e7 00 00 00 ba 3c 00 00 00 eb 16 66 0f 1f 84 00 00 00 00 00 89 d0 0f 05 48 3d 00 f0 ff ff 77 1c f4 89 f0 0f 05 <48> 3d 00 f0 ff ff 76 e7 f7 d8 64 41 89 00 eb df 0f 1f 80 00 00 00 RSP: 002b:00007ffd577fbfb8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 00007ff010cde1f0 RCX: 00007ff010c59031 RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000 RBP: 0000000000000000 R08: ffffffffffffffb8 R09: 000000000000ffff R10: 0000000000000000 R11: 0000000000000246 R12: 00007ff010cde1f0 R13: 0000000000000000 R14: 00007ff010cdec80 R15: 00007ff010c13500 Syzkaller reproducer: # {Threaded:false Repeat:true RepeatTimes:0 Procs:1 Slowdown:1 Sandbox: SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:false HandleSegv:true Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}} r0 = syz_io_uring_setup(0x6e47, &(0x7f0000000000)={0x0, 0x8847, 0x80, 0x4000003, 0x3d6}, &(0x7f0000000080)=0x0, &(0x7f00000000c0)=0x0) open(&(0x7f0000000100)='./file0\x00', 0x2041, 0x8) r3 = open$dir(&(0x7f0000000140)='./file0\x00', 0x680400, 0x104) r4 = socket(0x28, 0x80000, 0x89) epoll_create1(0x80000) eventfd2(0x802, 0x80800) syz_io_uring_submit(r1, r2, &(0x7f0000000340)=@IORING_OP_SEND_ZC={0x2f, 0x1c, 0x1, @sock=r4, &(0x7f0000000240)=@tipc=@name={0x1e, 0x2, 0x1, {{0x41, 0x4}, 0x3}}, &(0x7f00000002c0)=""/82, 0x52, 0x200, 0x1, 0x101, 0x0, {0x100}}) io_uring_enter(r0, 0x1, 0x1, 0x11, &(0x7f0000000380), 0x8) syz_io_uring_complete(r1, &(0x7f0000000400)) io_uring_register$IORING_REGISTER_ENABLE_RINGS(r0, 0xc, 0x0, 0x0) syz_io_uring_submit(r1, r2, &(0x7f0000000180)=@IORING_OP_ASYNC_CANCEL={0xe, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x4, 0x1}) syz_io_uring_submit(r1, r2, 0x0) syz_io_uring_submit(r1, r2, &(0x7f0000000680)=@IORING_OP_UNLINKAT={0x24, 0x50, 0x0, @fd_dir=r3, 0x0, &(0x7f0000000500)='./file0\x00'}) io_uring_enter(r0, 0x3, 0x3, 0xb, 0x0, 0x0) syz_io_uring_complete(r1, 0x0) ``` crepro is in the attachment. Best Regards Xdchase --000000000000873698061a4ff267 Content-Type: application/octet-stream; name="repro.c" Content-Disposition: attachment; filename="repro.c" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lx4y5wi30 Ly8gYXV0b2dlbmVyYXRlZCBieSBzeXprYWxsZXIgKGh0dHBzOi8vZ2l0aHViLmNvbS9nb29nbGUv c3l6a2FsbGVyKQoKI2RlZmluZSBfR05VX1NPVVJDRQoKI2luY2x1ZGUgPGRpcmVudC5oPgojaW5j bHVkZSA8ZW5kaWFuLmg+CiNpbmNsdWRlIDxlcnJuby5oPgojaW5jbHVkZSA8ZmNudGwuaD4KI2lu Y2x1ZGUgPHNldGptcC5oPgojaW5jbHVkZSA8c2lnbmFsLmg+CiNpbmNsdWRlIDxzdGRhcmcuaD4K I2luY2x1ZGUgPHN0ZGJvb2wuaD4KI2luY2x1ZGUgPHN0ZGludC5oPgojaW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IDIw OwogIGludCBza2lwID0gX19hdG9taWNfbG9hZF9uKCZza2lwX3NlZ3YsIF9fQVRPTUlDX1JFTEFY RUQpICE9IDA7CiAgaW50IHZhbGlkID0gYWRkciA8IHByb2dfc3RhcnQgfHwgYWRkciA+IHByb2df ZW5kOwogIGlmIChza2lwICYmIHZhbGlkKSB7CiAgICBfbG9uZ2ptcChzZWd2X2VudiwgMSk7CiAg fQogIGV4aXQoc2lnKTsKfQoKc3RhdGljIHZvaWQgaW5zdGFsbF9zZWd2X2hhbmRsZXIodm9pZCkK ewogIHN0cnVjdCBzaWdhY3Rpb24gc2E7CiAgbWVtc2V0KCZzYSwgMCwgc2l6ZW9mKHNhKSk7CiAg c2Euc2FfaGFuZGxlciA9IFNJR19JR047CiAgc3lzY2FsbChTWVNfcnRfc2lnYWN0aW9uLCAweDIw LCAmc2EsIE5VTEwsIDgpOwogIHN5c2NhbGwoU1lTX3J0X3NpZ2FjdGlvbiwgMHgyMSwgJnNhLCBO VUxMLCA4KTsKICBtZW1zZXQoJnNhLCAwLCBzaXplb2Yoc2EpKTsKICBzYS5zYV9zaWdhY3Rpb24g PSBzZWd2X2hhbmRsZXI7CiAgc2Euc2FfZmxhZ3MgPSBTQV9OT0RFRkVSIHwgU0FfU0lHSU5GTzsK ICBzaWdhY3Rpb24oU0lHU0VHViwgJnNhLCBOVUxMKTsKICBzaWdhY3Rpb24oU0lHQlVTLCAmc2Es IE5VTEwpOwp9CgojZGVmaW5lIE5PTkZBSUxJTkcoLi4uKSAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICh7ICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg XAogICAgaW50IG9rID0gMTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgX19hdG9taWNfZmV0Y2hfYWRkKCZza2lwX3Nl Z3YsIDEsIF9fQVRPTUlDX1NFUV9DU1QpOyAgICAgICAgICAgICAgICAgICAgICAgXAogICAgaWYg KF9zZXRqbXAoc2Vndl9lbnYpID09IDApIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgXAogICAgICBfX1ZBX0FSR1NfXzsgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgfSBlbHNlICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgXAogICAgICBvayA9IDA7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgX19hdG9taWNfZmV0Y2hfc3ViKCZz a2lwX3NlZ3YsIDEsIF9fQVRPTUlDX1NFUV9DU1QpOyAgICAgICAgICAgICAgICAgICAgICAgXAog ICAgb2s7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgXAogIH0pCgpzdGF0aWMgdm9pZCBzbGVlcF9tcyh1aW50NjRf dCBtcykKewogIHVzbGVlcChtcyAqIDEwMDApOwp9CgpzdGF0aWMgdWludDY0X3QgY3VycmVudF90 aW1lX21zKHZvaWQpCnsKICBzdHJ1Y3QgdGltZXNwZWMgdHM7CiAgaWYgKGNsb2NrX2dldHRpbWUo Q0xPQ0tfTU9OT1RPTklDLCAmdHMpKQogICAgZXhpdCgxKTsKICByZXR1cm4gKHVpbnQ2NF90KXRz LnR2X3NlYyAqIDEwMDAgKyAodWludDY0X3QpdHMudHZfbnNlYyAvIDEwMDAwMDA7Cn0KCnN0YXRp YyBib29sIHdyaXRlX2ZpbGUoY29uc3QgY2hhciogZmlsZSwgY29uc3QgY2hhciogd2hhdCwgLi4u KQp7CiAgY2hhciBidWZ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zdCgpOwogICAgICBleGVjdXRlX29uZSgpOwog ICAgICBleGl0KDApOwogICAgfQogICAgaW50IHN0YXR1cyA9IDA7CiAgICB1aW50NjRfdCBzdGFy dCA9IGN1cnJlbnRfdGltZV9tcygpOwogICAgZm9yICg7OykgewogICAgICBpZiAod2FpdHBpZCgt MSwgJnN0YXR1cywgV05PSEFORyB8IFdBSVRfRkxBR1MpID09IHBpZCkKICAgICAgICBicmVhazsK ICAgICAgc2xlZXBfbXMoMSk7CiAgICAgIGlmIChjdXJyZW50X3RpbWVfbXMoKSAtIHN0YXJ0IDwg NTAwMCkKICAgICAgICBjb250aW51ZTsKICAgICAga2lsbF9hbmRfd2FpdChwaWQsICZzdGF0dXMp OwogICAgICBicmVhazsKICAgIH0KICB9Cn0KCnVpbnQ2NF90IHJbNV0gPSB7MHgwLCAweDAsIDB4 MCwgMHhmZmZmZmZmZmZmZmZmZjljLCAweDB9OwoKdm9pZCBleGVjdXRlX29uZSh2b2lkKQp7CiAg aW50cHRyX3QgcmVzID0gMDsKICBOT05GQUlMSU5HKCoodWludDMyX3QqKTB4MjAwMDAwMDQgPSAw eDg4NDcpOwogIE5PTkZBSUxJTkcoKih1aW50MzJfdCopMHgyMDAwMDAwOCA9IDB4ODApOwogIE5P TkZBSUxJTkcoKih1aW50MzJfdCopMHgyMDAwMDAwYyA9IDB4NDAwMDAwMyk7CiAgTk9ORkFJTElO RygqKHVpbnQzMl90KikweDIwMDAwMDEwID0gMHgzZDYpOwogIE5PTkZBSUxJTkcoKih1aW50MzJf dCopMHgyMDAwMDAxOCA9IDApOwogIE5PTkZBSUxJTkcobWVtc2V0KCh2b2lkKikweDIwMDAwMDFj LCAwLCAxMikpOwogIHJlcyA9IC0xOwogIE5PTkZBSUxJTkcocmVzID0gc3l6X2lvX3VyaW5nX3Nl dHVwKC8qZW50cmllcz0qLzB4NmU0NywgLypwYXJhbXM9Ki8weDIwMDAwMDAwLAogICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIC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 X3QqKTB4MjAwMDAxODAgPSAweGUpOwogIE5PTkZBSUxJTkcoKih1aW50OF90KikweDIwMDAwMTgx ID0gMSk7CiAgTk9ORkFJTElORygqKHVpbnQxNl90KikweDIwMDAwMTgyID0gMCk7CiAgTk9ORkFJ TElORygqKHVpbnQzMl90KikweDIwMDAwMTg0ID0gMCk7CiAgTk9ORkFJTElORygqKHVpbnQ2NF90 KikweDIwMDAwMTg4ID0gMCk7CiAgTk9ORkFJTElORygqKHVpbnQ2NF90KikweDIwMDAwMTkwID0g MSk7CiAgTk9ORkFJTElORygqKHVpbnQzMl90KikweDIwMDAwMTk4ID0gMCk7CiAgTk9ORkFJTElO RygqKHVpbnQzMl90KikweDIwMDAwMTljID0gNCk7CiAgTk9ORkFJTElORygqKHVpbnQ2NF90Kikw eDIwMDAwMWEwID0gMSk7CiAgTk9ORkFJTElORygqKHVpbnQxNl90KikweDIwMDAwMWE4ID0gMCk7 CiAgTk9ORkFJTElORygqKHVpbnQxNl90KikweDIwMDAwMWFhID0gMCk7CiAgTk9ORkFJTElORyht ZW1zZXQoKHZvaWQqKTB4MjAwMDAxYWMsIDAsIDQpKTsKICBOT05GQUlMSU5HKG1lbXNldCgodm9p ZCopMHgyMDAwMDFiMCwgMCwgMTYpKTsKICBOT05GQUlMSU5HKHN5el9pb191cmluZ19zdWJtaXQo LypyaW5nX3B0cj0qL3JbMV0sIC8qc3Flc19wdHI9Ki9yWzJdLAogICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAvKnNxZT0qLzB4MjAwMDAxODApKTsKICBOT05GQUlMSU5HKAogICAgICBz eXpfaW9fdXJpbmdfc3VibWl0KC8qcmluZ19wdHI9Ki9yWzFdLCAvKnNxZXNfcHRyPSovclsyXSwg LypzcWU9Ki8wKSk7CiAgTk9ORkFJTElORygqKHVpbnQ4X3QqKTB4MjAwMDA2ODAgPSAweDI0KTsK ICBOT05GQUlMSU5HKCoodWludDhfdCopMHgyMDAwMDY4MSA9IDB4NTApOwogIE5PTkZBSUxJTkco Kih1aW50MTZfdCopMHgyMDAwMDY4MiA9IDApOwogIE5PTkZBSUxJTkcoKih1aW50MzJfdCopMHgy MDAwMDY4NCA9IHJbM10pOwogIE5PTkZBSUxJTkcoKih1aW50NjRfdCopMHgyMDAwMDY4OCA9IDAp OwogIE5PTkZBSUxJTkcoKih1aW50NjRfdCopMHgyMDAwMDY5MCA9IDB4MjAwMDA1MDApOwogIE5P TkZBSUxJTkcobWVtY3B5KCh2b2lkKikweDIwMDAwNTAwLCAiLi9maWxlMFwwMDAiLCA4KSk7CiAg Tk9ORkFJTElORygqKHVpbnQzMl90KikweDIwMDAwNjk4ID0gMCk7CiAgTk9ORkFJTElORygqKHVp bnQzMl90KikweDIwMDAwNjljID0gMCk7CiAgTk9ORkFJTElORygqKHVpbnQ2NF90KikweDIwMDAw NmEwID0gMCk7CiAgTk9ORkFJTElORygqKHVpbnQxNl90KikweDIwMDAwNmE4ID0gMCk7CiAgTk9O RkFJTElORygqKHVpbnQxNl90KikweDIwMDAwNmFhID0gMCk7CiAgTk9ORkFJTElORyhtZW1zZXQo KHZvaWQqKTB4MjAwMDA2YWMsIDAsIDQpKTsKICBOT05GQUlMSU5HKG1lbXNldCgodm9pZCopMHgy MDAwMDZiMCwgMCwgMTYpKTsKICBOT05GQUlMSU5HKHN5el9pb191cmluZ19zdWJtaXQoLypyaW5n X3B0cj0qL3JbMV0sIC8qc3Flc19wdHI9Ki9yWzJdLAogICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAvKnNxZT0qLzB4MjAwMDA2ODApKTsKICBzeXNjYWxsKAogICAgICBfX05SX2lvX3Vy aW5nX2VudGVyLCAvKmZkPSovclswXSwgLyp0b19zdWJtaXQ9Ki8zLCAvKm1pbl9jb21wbGV0ZT0q LzMsCiAgICAgIC8qZmxhZ3M9SU9SSU5HX0VOVEVSX0VYVF9BUkd8SU9SSU5HX0VOVEVSX1NRX1dB S0VVUHxJT1JJTkdfRU5URVJfR0VURVZFTlRT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