Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1352560ybz; Sat, 25 Apr 2020 17:10:10 -0700 (PDT) X-Google-Smtp-Source: APiQypKTCEI1Ew0XsdqD2SisIXd/t4/4ptt7Gg550Z8bcATJcNgi9hKx7dkoMYmS5oMeJnelPyG/ X-Received: by 2002:aa7:d653:: with SMTP id v19mr13158297edr.383.1587859810039; Sat, 25 Apr 2020 17:10:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587859810; cv=none; d=google.com; s=arc-20160816; b=oGSTaHtRbfqJfRwq3Yc1mmMjuvqvWYZlkypacsXM4HCxIm2bpTYgVHwYs6ItZX/EIm dcxxY4hAxepnVK0iDDwuDGi9Qs9p9M99NdiKXjecVWYEDd0Du9VsASPex3Re2ZlCur+b V7EqQYPHw2GXutcchN1eisbwuxjYNs/35qoY6PJtmoCGmZGimO2Yu9rAtDg9ECZUWJyg VJCk4r6PoPMI4ZOW5vML4pRvNKDE0uQDSFkJJ+KbVd9li0RBy7renfwyIvD2yD6tE6ld OxA4/BWzsPDzpsUR8IzK4O6kXA/EU1Q3H8KZ2QPKHxZ2ZttclNIyj6A/XfwtaCz1DYvc pmPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=YzMxlvsZdY3F2jNP3M1a1yilRwL8c1I8SUF9ftDT+UY=; b=Iayonn1D7ND+J2U5HXQi5Pp9mXNJPMFkgmiVNpOVvUvPp2udo7BBAssdkZ39lfBY23 G3y91neQIFSbRCIdjrEH9nHJ1LMhVPtRkTgVJ38HPGPJtkfasgbQGtMQF921kZtcdtHg fiGp+sl+KzXbJ+6PIAGMoLrBPsOjz5W/ZIf7KLFuLT+43LycUpKr8YR2sTPtiGorKePy uJE7UwlCFXsGfYlpIfdnhu2OIy0pk2NN0n1TaVs413h5RT7E8woga+a4OWYnfxDG77bO FhSla0d09RPU3V4tNXJeS0RtnJQ2vuAuIzFXEtIwp8g7LENUscZU1cxq5m/B/qyNKPl3 BrSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cp6OCDY+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f14si4450059edm.161.2020.04.25.17.09.34; Sat, 25 Apr 2020 17:10:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cp6OCDY+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726100AbgDZAHi (ORCPT + 99 others); Sat, 25 Apr 2020 20:07:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726070AbgDZAHh (ORCPT ); Sat, 25 Apr 2020 20:07:37 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B116C061A0C for ; Sat, 25 Apr 2020 17:07:37 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id o185so6702965pgo.3 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=jzg5qj1bAOm4PU7abk5LUjs3RJY1P+j4sGl7BjiaqHbkuqnBvTsFPZXdM6Y5Yt9fMC MUbwZOt8EEWAAhpj0l+pKeXQDhu+6lwAQxfnWGzE7NAZUAkuX2XzAaOC6IdhKxR9cqwT MVkzBC+rdQ7mPpo82lbiDKj40uJbkNWluemfd8DL0HjbMKgMctUNOCwlj/USU+vfplwQ FMCEG3G/T+M6ate80QC4xI5rNMC5cLwXMobDQ2qbf2SpS97EVzK1ZYQNYmoBGPLW9YD6 KD831HHD472c/0MkZk6t+KHy56j8vOZH14Eo0+6MCg95S4rrMsX7eQKlIe4HegsI7S1u YyVg== X-Gm-Message-State: AGi0PuZDNHIbl7N9NbWjviXOAmzc8Rah75Y24JClB/1NWuYfRK39bKou /2drKB8kvQ+IAvni/kiJGDpjYrTp 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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