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=-7.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 1D635C433B4 for ; Thu, 1 Apr 2021 18:11:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE5426112E for ; Thu, 1 Apr 2021 18:11:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237002AbhDASLn (ORCPT ); Thu, 1 Apr 2021 14:11:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234976AbhDASGn (ORCPT ); Thu, 1 Apr 2021 14:06:43 -0400 Received: from hr2.samba.org (hr2.samba.org [IPv6:2a01:4f8:192:486::2:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A552EC00F7EC for ; Thu, 1 Apr 2021 08:09:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=samba.org; s=42; h=Date:Message-ID:From:Cc:To; bh=fhByhXQt3cgT8dORAyRiRmoTAIsa21eOzx/s/2SElXU=; b=c3K7OiWoAwNPSgTiIaJ7LaaVK+ 7+rpVaPR05N4Bxf9yX5RaUoBmqFQ60XgSYkChDYhGJFs2NDXvcZWXu1FVFZ8/aV8J784vsfJ9nEWp jN0jZ1WX2JpnvoUJZbvof9m5Cu7xkgyOemA1U1drTHf7lxve0f+3dAGghm9h4uu9W0XV6wigv3Vt0 ubM1d09Tt9INx/rci53IqIGABFSj8TDogFxS2HolwDWeH3RsAOX1oM22Y1Kaz+GhGUJ3hvljf60rb WWod9A7uyx3LgUFLinVgHerwUddjSo7fOFSSmm2o5hR99m1DdyvXubQGfz+BGVaNPeiLcRsnusHM8 upuPt4ysdISt3oUzfHgTed+XO6szh+9K+HILjof67U1XD+X1qQ4PmtTq+u5dxJHvKWyrRusf4I0pV JaSqVMA08yIOk6wZdh6i8YtGthhXmCFvci3wWVwFqezRE4vTuYAJ/xjFxupU4VmHvgnSsgETF8cwT ikrl7BAj6fTcSqAaM5ivg68s; Received: from [127.0.0.2] (localhost [127.0.0.1]) by hr2.samba.org with esmtpsa (TLS1.3:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim) id 1lRywi-0007a1-3K; Thu, 01 Apr 2021 15:09:20 +0000 Subject: Re: buffer overflow in io_sq_thread() To: Pavel Begunkov , Alexey Dobriyan , axboe@kernel.dk Cc: io-uring@vger.kernel.org References: <55d32b30-ea39-c8b2-2912-8e7081e0f624@gmail.com> From: Stefan Metzmacher Message-ID: <6a5273f0-e54b-ac4b-21f6-3129aca72ec6@samba.org> Date: Thu, 1 Apr 2021 17:09:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <55d32b30-ea39-c8b2-2912-8e7081e0f624@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Am 01.04.21 um 10:51 schrieb Pavel Begunkov: > On 31/03/2021 21:24, Alexey Dobriyan wrote: >> The code below will overflow because TASK_COMM_LEN is 16 but PID can be >> as large as 1 billion which is 10 digit number. >> >> Currently not even Fedora ships pid_max that large but still... > > And is safer limited in any case. Thanks > >> >> Alexey >> >> static int io_sq_thread(void *data) >> { >> struct io_sq_data *sqd = data; >> struct io_ring_ctx *ctx; >> unsigned long timeout = 0; >> char buf[TASK_COMM_LEN]; >> DEFINE_WAIT(wait); >> >> sprintf(buf, "iou-sqp-%d", sqd->task_pid); I have patches for this see https://lore.kernel.org/io-uring/1213a929-30f2-592d-86a2-ddcf84139940@kernel.dk/T/#m9a9707c76e0ca73b54676b5d0fe198587b36c1b4 As there's no urgent problem in 5.12 I'll repost them for 5.13... metze