Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp222145rwb; Sun, 25 Sep 2022 19:12:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5OhfmJKNouJWB+V/Tg1YwcYGpKqwfRPYO/DyAsfV/F3bIXsjY1wbFWVPeiEZWlrHBqgujh X-Received: by 2002:a17:90b:4d81:b0:202:d535:d324 with SMTP id oj1-20020a17090b4d8100b00202d535d324mr22038718pjb.133.1664158325564; Sun, 25 Sep 2022 19:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664158325; cv=none; d=google.com; s=arc-20160816; b=nZsX/lEzPOvh2vRHq0/dK7DXUuavoaoPDQ2CmI74g4AbpnUupJrr1mqmUpAiQ6EIoi B/WY8BDLz5SX3+N1rs0yudKKdRqJ80MUGTX58Yqo1lGazzgffTAYLNpAXbJAnzJ5bxex ZMEiod9NfUeN27dLDXDYfO8OHho1TGgxyA1OG01tiKh6tTM81Njb0XMAp12BNpHsmSXo ahSPsdjyM3x//lOgnA1nuHp/5vVKXi2gHzDsLRM/0m5FUlh2Up7DlLXCplltJuqlKZWs qvFtDi5REqAPdER8uyGyViZeotPh4pHlbg91s1PEvOGHA4GrfkwkGcs6tD6pVMJPXIzU mIsQ== 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=ZsMZDiPJ05dqPEjOyzQRRCQyAniieUtquk7D7/uc9oo=; b=McrAF6cTHjH2I8aE1wiKWb1FNdpjtX3i6VV5UWgpde4aPp1mShF99v9GYNaLVqj2+V o4B2v7oi7XSiPT5+JAZuqz9PITOVIJb/P1AihIp+5SJRR03tQnRqNehElBYWfnXSuL1g MhafVx/5Kfcfp2UwaO1820mduALOoUVXpl4sW3NAihtD0LZ8zwsiZMs38/bDc4URH/OP QzKQMOfT/em/+FqIluT4RKDP9T10nNRzC4zLnMa88ZPDmAxB1mtFVzii4jVUGrsyEMnL Py9Jd7QsMJZ3u5ABq4Ak+73nzXjJIRroU1UtLQDWD8k109mAbJkJCIMC5XoibIofgL/7 S1CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=EloZHChU; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 196-20020a6300cd000000b0041cb4fd2e4esi16876858pga.793.2022.09.25.19.11.53; Sun, 25 Sep 2022 19:12:05 -0700 (PDT) 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=@chromium.org header.s=google header.b=EloZHChU; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233205AbiIZAjF (ORCPT + 99 others); Sun, 25 Sep 2022 20:39:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233453AbiIZAiw (ORCPT ); Sun, 25 Sep 2022 20:38:52 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA0C72AE24 for ; Sun, 25 Sep 2022 17:38:50 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id c7so5155009pgt.11 for ; Sun, 25 Sep 2022 17:38:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=ZsMZDiPJ05dqPEjOyzQRRCQyAniieUtquk7D7/uc9oo=; b=EloZHChUwOJ+IAK+dqPRjhd24FYS6MkmFqZpedddEJP3NPIP54FWcwg3RKRz6Ai8pZ z2DviABmbm5Ne8x7+vcrgYA1N3bmoOgjdNpOgYz+yaXmcZ9y56Pdoen1P+xANPX4dHu4 HiKqS9DzqPcFKjopFBXMCDEaM898Bv94O7hJQ= 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; bh=ZsMZDiPJ05dqPEjOyzQRRCQyAniieUtquk7D7/uc9oo=; b=VUAn2+4I3i5S4S/7QUR1z+HqTXuDKmYp4ohw24QFgEQ0XXTMkkW6n3iVx2zg7OEFus Mijg84P111R5JazSvJxZjC5IOnaw7hwSTKaGbnl5kGzyjShbXq7we9pcywMExaz+OL8q FXW8fcR6drjDWgrzmzcE+F5Ttr7y4hxEq0ewNsdmIs71XYNYl7N+PGq48EkpbWVankHH ItPFuJm81zB/cK3Hut8hQbCqah7Aar9q5XhnfRO+Mbgpu0qEqIpSrMrrb8wwcdG8vw8h KHP3tk77QPtKJXf7mjZKm2tGX8Iwn64jqmdn7AI2JyHMBJ/WlIYIVQ5zaPuNp3uflbey +SHQ== X-Gm-Message-State: ACrzQf3rhsN45La3GTJ6lCJt2CGQIg127YTzEt3Wz6oMjifV+FEJbOBt tk0dJrp7ymwhszOxPvGgZ8yEVg== X-Received: by 2002:a63:4b1d:0:b0:439:e6a4:e902 with SMTP id y29-20020a634b1d000000b00439e6a4e902mr18048148pga.212.1664152730415; Sun, 25 Sep 2022 17:38:50 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id t11-20020a17090340cb00b00172951ddb12sm9640855pld.42.2022.09.25.17.38.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Sep 2022 17:38:49 -0700 (PDT) Date: Sun, 25 Sep 2022 17:38:48 -0700 From: Kees Cook To: Dmitry Vyukov Cc: Vlastimil Babka , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Vincenzo Frascino , Andrew Morton , kasan-dev@googlegroups.com, linux-mm@kvack.org, "Ruhl, Michael J" , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Greg Kroah-Hartman , Nick Desaulniers , Alex Elder , Josef Bacik , David Sterba , Sumit Semwal , Christian =?iso-8859-1?Q?K=F6nig?= , Jesse Brandeburg , Daniel Micay , Yonghong Song , Marco Elver , Miguel Ojeda , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-fsdevel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, dev@openvswitch.org, x86@kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2 14/16] kasan: Remove ksize()-related tests Message-ID: <202209251738.6A453BC008@keescook> References: <20220923202822.2667581-1-keescook@chromium.org> <20220923202822.2667581-15-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Sat, Sep 24, 2022 at 10:15:18AM +0200, Dmitry Vyukov wrote: > On Fri, 23 Sept 2022 at 22:28, Kees Cook wrote: > > > > In preparation for no longer unpoisoning in ksize(), remove the behavioral > > self-tests for ksize(). > > > > [...] > > -/* Check that ksize() makes the whole object accessible. */ > > -static void ksize_unpoisons_memory(struct kunit *test) > > -{ > > - char *ptr; > > - size_t size = 123, real_size; > > - > > - ptr = kmalloc(size, GFP_KERNEL); > > - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); > > - real_size = ksize(ptr); > > - > > - OPTIMIZER_HIDE_VAR(ptr); > > - > > - /* This access shouldn't trigger a KASAN report. */ > > - ptr[size] = 'x'; > > I would rather keep the tests and update to the new behavior. We had > bugs in ksize, we need test coverage. > I assume ptr[size] access must now produce an error even after ksize. Good point on all these! I'll respin. -- Kees Cook