From patchwork Tue Jun 8 18:39:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 12307925 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=-11.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 BA26BC4743D for ; Tue, 8 Jun 2021 18:40:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5DC8761430 for ; Tue, 8 Jun 2021 18:40:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DC8761430 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 BD7AC6B006C; Tue, 8 Jun 2021 14:40:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B2AE16B0071; Tue, 8 Jun 2021 14:40:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B3746B006C; Tue, 8 Jun 2021 14:40:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0137.hostedemail.com [216.40.44.137]) by kanga.kvack.org (Postfix) with ESMTP id 631096B006C for ; Tue, 8 Jun 2021 14:40:00 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id EA760180AD817 for ; Tue, 8 Jun 2021 18:39:59 +0000 (UTC) X-FDA: 78231420918.19.8F7C6B2 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by imf07.hostedemail.com (Postfix) with ESMTP id E725BA0001CF for ; Tue, 8 Jun 2021 18:39:55 +0000 (UTC) Received: by mail-pg1-f169.google.com with SMTP id 27so17253828pgy.3 for ; Tue, 08 Jun 2021 11:39:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ggAVsZg/cXVvUqOkLCWYOUQSB2LS7JfS85VC4f/i35Q=; b=A+zfVz8+HcNRW0Fu44E5Rx1laJBsnN/evN5OVcSQxI6o5VY7aMp/wkbk7YZEddRyqf j6V+36FDLYuzRKK0DZJdGdBLB1Y5CRMIUggAtmTOBJhRrwD5l/9iHbx4GyRMeC21ZXxf 5f54CDraX2aeQzPczl3kziJJa3SLjW7q/K6iE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ggAVsZg/cXVvUqOkLCWYOUQSB2LS7JfS85VC4f/i35Q=; b=ood7R85n3twOpz5F8sqoxecArWuwJrkIgtkdzrhwifhgMfoEfP38CZaGyRB6Vgc4Mk 5DvPuChZIIqJbHNa+EQRAeHeiyUhIY1MQWiWszqWUZ7D7VKsQVcOqyKacSrcBX5ij7Cp VQ+ylQ2Hg4E+kCJ0G6ocGbUKKd+33kJe/ntzQRy4oEfOg4MB4Pta5KDrF4POvWG1hxZ5 wDmdyoYF4SBx9Jdcnc2hyY4ql60FoMlzewMugfjTm1FjrdGxf39BSYtQ3udH1VWFI+CY xNVs28UTdA5DASepumMP56zL8H2wASBQDSrzfxcRkYSH5cm+iW9i+O0KXQhjlv4aZ/jT 2M8Q== X-Gm-Message-State: AOAM530a3zzszZt8LdbI6hRQ5CSn3BJkWhep9Bfzcv7QoLla9fjX0YtB O7+1k7kWx71d3HS8g7e7U9KpeQ== X-Google-Smtp-Source: ABdhPJxQcETaq1CxSn2r98DdBqfCgzxobh8dnkqILoMHMZd+vnkG8uyC7KrRE3gaJyWFsbkQFdmt4g== X-Received: by 2002:a63:ee11:: with SMTP id e17mr15958908pgi.323.1623177598571; Tue, 08 Jun 2021 11:39:58 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id f6sm11613587pfb.28.2021.06.08.11.39.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 11:39:57 -0700 (PDT) From: Kees Cook To: Andrew Morton Cc: Kees Cook , Vlastimil Babka , Marco Elver , Christoph Lameter , "Lin, Zhenpeng" , Pekka Enberg , David Rientjes , Joonsoo Kim , Roman Gushchin , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v4 0/3] Actually fix freelist pointer vs redzoning Date: Tue, 8 Jun 2021 11:39:52 -0700 Message-Id: <20210608183955.280836-1-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: E725BA0001CF X-Stat-Signature: uwa4h1n5atb4jf3hethszbe56y9yzrh7 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=A+zfVz8+; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf07.hostedemail.com: domain of keescook@chromium.org designates 209.85.215.169 as permitted sender) smtp.mailfrom=keescook@chromium.org X-HE-Tag: 1623177595-602668 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: v4: - remove redundant size check v3: https://lore.kernel.org/lkml/20201015033712.1491731-1-keescook@chromium.org v2: https://lore.kernel.org/lkml/20201009195411.4018141-1-keescook@chromium.org v1: https://lore.kernel.org/lkml/20201008233443.3335464-1-keescook@chromium.org This fixes redzoning vs the freelist pointer (both for middle-position and very small caches). Both are "theoretical" fixes, in that I see no evidence of such small-sized caches actually be used in the kernel, but that's no reason to let the bugs continue to exist, especially since people doing local development keep tripping over it. :) Thanks! -Kees Kees Cook (3): mm/slub: Clarify verification reporting mm/slub: Fix redzoning for small allocations mm/slub: Actually fix freelist pointer vs redzoning Documentation/vm/slub.rst | 10 +++++----- mm/slab_common.c | 3 +-- mm/slub.c | 36 +++++++++++++++--------------------- 3 files changed, 21 insertions(+), 28 deletions(-)