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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93AB0C6FA82 for ; Mon, 26 Sep 2022 00:39:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233133AbiIZAjD (ORCPT ); Sun, 25 Sep 2022 20:39:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233443AbiIZAiw (ORCPT ); Sun, 25 Sep 2022 20:38:52 -0400 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9A6C2AE20 for ; Sun, 25 Sep 2022 17:38:50 -0700 (PDT) Received: by mail-pg1-x531.google.com with SMTP id 3so5196585pga.1 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=RC92EvQgP5n8o/MIMqH3iTfAYY3iRq84nqI18dwuYk4RTRIFZbqZ5CBuv7/6GMIsX5 5V4wqtpEckeMkbMe+C5lpM0GFUeTdym7mSV0cc/kKyX3DTjeVW1Dt4jy5oCTfs0lL6g1 IXXyRii0JejIzsq7DUguEXgdTUqG9wMDPiLLfpOnBrdmZ0kdHsajGU+lBZkAKwATr2lK o9veqbdGd8kwIjE91SI1cuJIsrII38wpyraHR661ddKvx8LdvR9neELSadkPLR1xcXWT 4oS30wfAj1SB2W2bb2Y2rRq1qCov5G0LV8jNj38mkC+HqkTsoOwJY+mF3M4d7bDqqG4W PswQ== X-Gm-Message-State: ACrzQf3LfBH63/V0bPDRsSp17hRMvlxXL1/znldd08H+a0tYrXFKETLI jSTNuGkohZETrxs9OrwMnyv0TsOuaFdWiQ== X-Google-Smtp-Source: AMsMyM7j48vn8CX614C8f5vlUd1g6FcIEIYyyHHTpwyTo0bx6Hew8gRK92T2JHXk4G8JNUKlDJxOQQ== 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: Precedence: bulk List-ID: X-Mailing-List: linux-hardening@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