From patchwork Thu Feb 23 16:43:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 5799 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp420061wrd; Thu, 23 Feb 2023 09:03:50 -0800 (PST) X-Google-Smtp-Source: AK7set/k7i7pMPRl8qPGhJQoo1X5Z1wUEsHopyksFObHOMdhJjdRCX+ZjVGlHrLHExgB8M3sI8Lk X-Received: by 2002:a17:906:196:b0:88f:1255:59c with SMTP id 22-20020a170906019600b0088f1255059cmr18450175ejb.1.1677171829989; Thu, 23 Feb 2023 09:03:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677171829; cv=none; d=google.com; s=arc-20160816; b=cFAlmn9TekDjOROh/8RXRyLGqNx+MpG+ePblDgz9I3/CSgBPWqmJR+Ra8UsUygQMpv VNIm7Bt1gg38geI6olBeA1IFgifu4kJyODuwoJHyEbFoT9wyiIYBS0lNSC/JS8kIFDQ7 46Zrl40lN5O0T2P4ppl7BnO06rr1yiSNgs8+9Sj53ywkXY4Rbg0fnnYJpNNylXgjs2FU DzjQ0ArF9D3/4ejpnWMRsH5HiziNJCMlVPfeK2/DtEHwf+2/GACCQE/nH55dqn5BiGyn F0mCTq4GzXb4Berz1ZA/Y8JhCTFQxBWKB/L8gSbuhV9Rba53nAKkVfOsWLF+ORW8m6uj eyZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=eruQWB2/18nDotnnWoGStXzb4aFnYUrYHZ3mQIMO230=; b=Q8kMDcDolyPHu7HxZBHbkoCenKNQkaKd4CP2IooThIbRrwNMzhrb9RagT8zd9hVN5d O9I91VnKTUt3NGnv2VW7vwVg5S8cpu/j3UvT0c3feYSx+5r9ETJ7s8xkHv1usIg5QzXO 1a2eSSxDDc0SyJTnaVbFUAiZ3do2Wv1Y0UY/lo/psLcLdLbz1Ib6OgZI8c9VFvA/ymwn wlvN1Z6nwvR9WDllOCTgtS9o3TCByt7Rt5/1jg7LjK6KOUY0Cy6KZEussEFkisBGprfd 9qso6tcxUmqHR9f9R97QU4zd1HqaPenF33+PJ9jXtDam+B4T47PcXzCFWOCBa5nrdGiq M5JQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fl18-20020a1709072a9200b008b2d8733a50si18074951ejc.297.2023.02.23.09.03.25; Thu, 23 Feb 2023 09:03:49 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234636AbjBWQoY (ORCPT + 99 others); Thu, 23 Feb 2023 11:44:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232923AbjBWQoW (ORCPT ); Thu, 23 Feb 2023 11:44:22 -0500 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5AD414EAB; Thu, 23 Feb 2023 08:44:20 -0800 (PST) Received: by mail-wm1-f50.google.com with SMTP id l7-20020a05600c4f0700b003e79fa98ce1so6818742wmq.2; Thu, 23 Feb 2023 08:44:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=eruQWB2/18nDotnnWoGStXzb4aFnYUrYHZ3mQIMO230=; b=QuyPSrLGWROMJuZb1HAn3ZGgmbOJpN2xa73jfdZ7EJKAfQU7VGI0aST583uzA+3Wo5 0qz8g/ecB64R2KzmZYgQ8N5++ulSe4z5otpHQI9FOyyQsyeG+6rxy2m3RR6P6k+y9pNR QY1/iAhBXe03mTYz6YRMZU1HVRppLECBakeVA8105aLOqJ0yRWm9I10JbvfGLjWzp4WB 54C8URzCyfKCWP5/zF6uc9CBnKI5lIZE2ciXGBJc8Q2x8NekfhA4KNxSn2Vjd7vwwvoK zQgtrsHrlqZ+HQAS8uN8zd0FQOtwyESYky7vYmrQv7IXs2XThC6C9uju4UCT8BFkPwD5 jTMw== X-Gm-Message-State: AO0yUKWPCBrzKIkHEZ+vRehFO9A5h61Q/QfJVSHugeW23gq7jKvDvEsU xY8Ru1a4UuM/Bgy0lzdGGH4= X-Received: by 2002:a05:600c:331b:b0:3dc:4318:d00d with SMTP id q27-20020a05600c331b00b003dc4318d00dmr9262047wmp.11.1677170659002; Thu, 23 Feb 2023 08:44:19 -0800 (PST) Received: from localhost (fwdproxy-cln-013.fbsv.net. [2a03:2880:31ff:d::face:b00c]) by smtp.gmail.com with ESMTPSA id m6-20020a05600c4f4600b003df245cd853sm14739855wmq.44.2023.02.23.08.44.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 08:44:18 -0800 (PST) From: Breno Leitao To: axboe@kernel.dk, asml.silence@gmail.com, io-uring@vger.kernel.org Cc: linux-kernel@vger.kernel.org, gustavold@meta.com, leit@meta.com, kasan-dev@googlegroups.com Subject: [PATCH v3 0/2] io_uring: Add KASAN support for alloc caches Date: Thu, 23 Feb 2023 08:43:51 -0800 Message-Id: <20230223164353.2839177-1-leitao@debian.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758642128574281230?= X-GMAIL-MSGID: =?utf-8?q?1758642128574281230?= This patchset enables KASAN for alloc cache buffers. These buffers are used by apoll and netmsg code path. These buffers will now be poisoned when not used, so, if randomly touched, a KASAN warning will pop up. This patchset moves the alloc_cache from using double linked list to single linked list, so, we do not need to touch the poisoned node when adding or deleting a sibling node. Changes from v1 to v2: * Get rid of an extra "struct io_wq_work_node" variable in io_alloc_cache_get() (suggested by Pavel Begunkov) * Removing assignement during "if" checks (suggested by Pavel Begunkov and Jens Axboe) * Do not use network structs if CONFIG_NET is disabled (as reported by kernel test robot) Changes from v2 to v3: * Store elem_size in the io_alloc_cache, so, we don't need to pass the size when getting the cache element. Breno Leitao (2): io_uring: Move from hlist to io_wq_work_node io_uring: Add KASAN support for alloc_caches include/linux/io_uring_types.h | 3 ++- io_uring/alloc_cache.h | 30 ++++++++++++++++++------------ io_uring/io_uring.c | 4 ++-- io_uring/net.h | 5 ++++- 4 files changed, 26 insertions(+), 16 deletions(-)