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=-0.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 053B1C54FCB for ; Sun, 26 Apr 2020 00:07:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9EA8B20706 for ; Sun, 26 Apr 2020 00:07:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cp6OCDY+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9EA8B20706 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4B69D8E0005; Sat, 25 Apr 2020 20:07:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 467CC8E0003; Sat, 25 Apr 2020 20:07:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 37D718E0005; Sat, 25 Apr 2020 20:07:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id 242478E0003 for ; Sat, 25 Apr 2020 20:07:38 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id DACFB8248047 for ; Sun, 26 Apr 2020 00:07:37 +0000 (UTC) X-FDA: 76748067354.30.rat91_5fb273b56c35b X-HE-Tag: rat91_5fb273b56c35b X-Filterd-Recvd-Size: 4394 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Sun, 26 Apr 2020 00:07:37 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id q18so6677958pgm.11 for ; Sat, 25 Apr 2020 17:07:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=YzMxlvsZdY3F2jNP3M1a1yilRwL8c1I8SUF9ftDT+UY=; b=cp6OCDY+S7VRLhztJuHqgoNFhYIeXviwHtgxUOsIWNXgyb7fGVgCAL2gh6A4gTqqI9 asa8exs/QR2SJABOZVusPpmCpgjvSZQHwczndTzNXO8LZKYrbfStGYswukuMG3pRVJtX W/t5k36Ps5TucWvy8DmTiHBqsdeWlAOqima0gQ+abAklDC0fb1IVC6tBtd8tWAdMxn86 RwkRHycg4HrMyhuv8M+Bx3V2qtv0xc9a0MjL5gaKX1LUw4Gh1156QxTE8hamJcMXVnl9 f/9SOLuHqEEdQ4qa0C8B9CrcGQ5m1MesyiTFD8pW7L+x0NkPeOp24BYBGy92XOdWe+8b alaA== 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=YzMxlvsZdY3F2jNP3M1a1yilRwL8c1I8SUF9ftDT+UY=; b=ZXTNGxTY7gEk3GAU0zSArqiH7+wE2+D/rhp1SkV/i3w9WYaESFQIdzYoQr840G5QmE /cfMXEaZRY0oIDzwJQLNKPL7VqwWaXmgJopPdLJpjmUQJkLcpAW1cOn31K3LDEws49cA X6/uxsJI+tvxQ2aixu/G7OXD4Fw5Bp63a1HF0mSmjSquiH9GeHwFT6Fr+kDWTF33vzzF t0108nLVOVGWWOx1G1cO/E4Muo710cMcSthXElWjvg2SdSr9RPZwvb/kS5YU18K0rw90 c7yGykip4fqmYfkW2PCG1ZXv0PYsggV47fEttUlvLz++IPrEgKfNu+KPE9oGEvroJVDl Mavw== X-Gm-Message-State: AGi0PuYqg11DRneYTD8sfvcey4Rkh3BiAweP1w6Xut4NlrzXJ+e3l6SC E6uUcr0wAlo+49DmlJtb/RA= X-Google-Smtp-Source: APiQypKAsuFitmtwBwKxE3b9+iCnvPp7RR6x1GEzjuAnZGh4D4bTC7dGmBdoZP+Jm2BF7waQ1AxRmQ== X-Received: by 2002:a63:7c4:: with SMTP id 187mr5984692pgh.59.1587859656609; Sat, 25 Apr 2020 17:07:36 -0700 (PDT) Received: from mail.google.com ([149.248.10.52]) by smtp.gmail.com with ESMTPSA id t188sm7747502pgc.3.2020.04.25.17.07.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Apr 2020 17:07:35 -0700 (PDT) Date: Sun, 26 Apr 2020 08:07:27 +0800 From: Changbin Du To: Kees Cook Cc: Changbin Du , Andrew Morton , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/slub: do not place freelist pointer to middle of object if redzone is on Message-ID: <20200426000727.u2gfxwfsrvme3a6b@mail.google.com> References: <20200425091338.24283-1-changbin.du@gmail.com> <202004251547.0F8E6856B@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202004251547.0F8E6856B@keescook> 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: Hi Kees, On Sat, Apr 25, 2020 at 03:48:31PM -0700, Kees Cook wrote: > On Sat, Apr 25, 2020 at 05:13:38PM +0800, Changbin Du wrote: > > The recent kernel fails to boot when slub redzone is turned on. This is > > caused by commit 3202fa62fb ("slub: relocate freelist pointer to middle of > > object") which relocates freelist pointer to middle of object. In this > > case, get_track() gets a wrong address and then the redzone is overwritten. > > Hi! A fix for this is already in -next: > > https://www.ozlabs.org/~akpm/mmotm/broken-out/slub-avoid-redzone-when-choosing-freepointer-location.patch > > the above doesn't disable the mitigation when using redzones, so I > prefer that to this suggested solution. > Glade to see it's been reported. But I am sorry that your patch cannot fix it. With your fix, I suppose the layout of slub is: |obj-fp-obj|redzone|track|... While get_track(): p = object + s->offset + sizeof(void *); Then we still get a wrong location. I just tested linux-next and the problem is still there. Is the right and left redzone good enough to protect the freepointer? If not, I will send a patch to fix get_track() along with your patch. > -- > Kees Cook -- Cheers, Changbin Du