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=-3.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 6A691C43457 for ; Thu, 15 Oct 2020 22:03:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B5B3720789 for ; Thu, 15 Oct 2020 22:03:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="bPocx/iv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B5B3720789 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BA1916B005D; Thu, 15 Oct 2020 18:03:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B52716B0068; Thu, 15 Oct 2020 18:03:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F26D6B006E; Thu, 15 Oct 2020 18:03:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0067.hostedemail.com [216.40.44.67]) by kanga.kvack.org (Postfix) with ESMTP id 72C006B005D for ; Thu, 15 Oct 2020 18:03:47 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 02FF71EE6 for ; Thu, 15 Oct 2020 22:03:47 +0000 (UTC) X-FDA: 77375537694.18.stop78_0904c0827217 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id D81631023467B for ; Thu, 15 Oct 2020 22:03:46 +0000 (UTC) X-HE-Tag: stop78_0904c0827217 X-Filterd-Recvd-Size: 4998 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Thu, 15 Oct 2020 22:03:46 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id t18so138632plo.1 for ; Thu, 15 Oct 2020 15:03:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=tX6balWi3xF1R0xBEBJ7Br9SGLdyst5WwjhX9DaAUSw=; b=bPocx/ivNrOzUwfCAeSqdKyrLvYAhK62fL3kdjmfVNF1Bb+bxToGO+GBArR5xQf+MF db9H1aXyQub4Ugfb/JVOdu0qN9Ln3H9utp3jWgzzq7j5vH+im7uIm/YTIJMP3Gu5CX3O ssih9rclSiehki2Ke3psOISIWCUMhjGguJor4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=tX6balWi3xF1R0xBEBJ7Br9SGLdyst5WwjhX9DaAUSw=; b=i8YbsqPuYdbtBh6i39D71VLTw6VSe06Z49E95yvXnxatp9EHengre8PM0USPN460vn NHV2izYbitIBDKpXrwRkR3cnyYSd93ipIcZ8lcpsEwdqtULSeWiLelf2DCxD4inx1gbA vpRFybL0CW1sXGUdq7seQd4ftsB+hNHU9RYC9pV92DKJLLnI/qIg54LFMDf9Aa6ZBuQ3 5v4FYVVtKMFB/29S54ggY+eIl4C7CgtNHYrwWSMtY6LfvjdBt/Ywg93g4F+AdJ1cobdp eC/8gCeLusdwVXPuqYSDRbA5T1O9SM+VFPhn2plP4TPU7cMuNGsuZTInc55kACeKr22G gPpg== X-Gm-Message-State: AOAM530+zKfpJHw7Jq3AYgZE4kdaHWTGo7Agf8RDK2kdDUFGxdUaXJ2H VkdKd1lLuVlaf+Ufb+3SbtCPOw== X-Google-Smtp-Source: ABdhPJw8dCQgBOF92fJvUcvuyhCSRRzgnAoAQXQu74ak3em59f2h6fMejlXmC83RFodfUMkK/TR25Q== X-Received: by 2002:a17:902:7c8d:b029:d2:80bd:2f30 with SMTP id y13-20020a1709027c8db02900d280bd2f30mr632565pll.22.1602799425445; Thu, 15 Oct 2020 15:03:45 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id x10sm257583pfc.88.2020.10.15.15.03.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2020 15:03:44 -0700 (PDT) Date: Thu, 15 Oct 2020 15:03:43 -0700 From: Kees Cook To: Vlastimil Babka Cc: Christopher Lameter , Andrew Morton , Waiman Long , Marco Elver , Pekka Enberg , David Rientjes , Joonsoo Kim , Roman Gushchin , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 0/3] Actually fix freelist pointer vs redzoning Message-ID: <202010151501.C9F9D2ACF@keescook> References: <20201015033712.1491731-1-keescook@chromium.org> <1e43fd23-e9f1-9c5d-3ee2-17171642877f@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1e43fd23-e9f1-9c5d-3ee2-17171642877f@suse.cz> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000018, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Oct 15, 2020 at 11:44:15AM +0200, Vlastimil Babka wrote: > On 10/15/20 10:23 AM, Christopher Lameter wrote: > > On Wed, 14 Oct 2020, Kees Cook wrote: > > > > > Note on patch 2: Christopher NAKed it, but I actually think this is a > > > reasonable thing to add -- the "too small" check is only made when built > > > with CONFIG_DEBUG_VM, so it *is* actually possible for someone to trip > > > over this directly, even if it would never make it into a released > > > kernel. I see no reason to just leave this foot-gun in place, though, so > > > we might as well just fix it too. (Which seems to be what Longman was > > > similarly supporting, IIUC.) > > > > Well then remove the duplication of checks. The NAK was there because it > > seems that you were not aware of the existing checks. > > > > > Anyway, if patch 2 stays NAKed, that's fine. It's entirely separable, > > > and the other 2 can land. :) > > > > Just deal with the old checks too and it will be fine. > > Yeah, the existing check is under CONFIG_DEBUG_VM, which means it's not > active on some configurations. Creating a cache is not exactly fast path > operation, so I would remove this guard. > As for the minimum size check, I would probably remove it (but watch out if > SLAB/SLOB can handle it). It's not effective to use slab cache for 4-byte > objects, but why make it an error. Err, why did the check exist to begin with? If the check isn't wanted, that's one thing, but I was just trying to fix what I saw in the redzone handling. What is preferred here? 1) drop patch 2 2) keep patch 2, but also: a) validate slab/slob can handle < word-sized allocations b) remove check in kmem_cache_sanity_check option 2a seems like it could be fragile if I miss something. I think I'd rather just take option 1. -- Kees Cook