Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4408471pxa; Mon, 10 Aug 2020 08:25:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzu3FOQFD1Cs4K6PT3Hw7+j3wZc1vyV3VY5hTLEq5AOFj9UgKtwXeoxArW9FJe9yq1v+o6k X-Received: by 2002:a17:906:3842:: with SMTP id w2mr22474920ejc.273.1597073105299; Mon, 10 Aug 2020 08:25:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597073105; cv=none; d=google.com; s=arc-20160816; b=M4vjIQOo0BbdFwz/Bu5SEeiVgHZ6iOWVaDYsmueiNtO789jFQMJR7QsCrbLPIY8FDd ncFkBr+E2Fpq7QRlFwhGhr7t9fDUkYDdcdcHDl9no/GDf0o0QPKGQ3XmjEATIZbt7Ivx ysfC3+ml9R9oIjLiw3SsH/P7jYQ7f1OVDqQjE93BLUeIHZ3MsT1P8Wo9FJ/STyB5px+V bcsIIRxUo8Ah4RYUy62flkMLz7ohJI8vOnVoFHPPl7Wsj8CjulZMJL0yO5IySwkNI+1e sgmf6+f1ucSb6y0Lq99VxhdiByphVMwAzMVVoMoxE0WPtd23YjeQPmgkfb55HtWBWYVb aAfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Pk3qCquuK8qBNBJkitcf3XLD9EkOQUQ9kahu3PtnxxI=; b=nvLkzhxR9vcM8Np6YpHD5WUmUM3qqxCukATL99+MHdcIRlyt/oF5SxpurDsEkPYo7G qTHUsZlolPWVqNjMfTQj9pLtPRybU1XJl3y+/5QByfus8cNPxmzTBqYcCgCtD+8HlSW2 +G30fuhlvxNgK8bRCmqWrKsiTqhChg23Tkaf3leZSFaR384h48vyPOewehjLM9Ac1b8E oYq+92x+X8PJivWMX28y4tAhy5GKCwUSbCjY+P+d5mm3+IVQRPIUoahvSROvEhOVXM2U 0T4QOeKwaC6r6BYkvRQcdPS5IgVD9YnOzmDgQo5lwDZTSmkcw4UqKW9mIKCTK1XM2zRA QT2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Moq+0hU+; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e8si10459771eja.31.2020.08.10.08.24.42; Mon, 10 Aug 2020 08:25:05 -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=@kernel.org header.s=default header.b=Moq+0hU+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728118AbgHJPVE (ORCPT + 99 others); Mon, 10 Aug 2020 11:21:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:51640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728071AbgHJPU4 (ORCPT ); Mon, 10 Aug 2020 11:20:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8869C20782; Mon, 10 Aug 2020 15:20:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597072856; bh=HcBNhSb0GmByQS2frDJPr/p9ayMXKaZQ4dRvzizDfvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Moq+0hU+GyI4IXSfB+eWpEnCc2az7kBVMuQfabfNZEk6G+WxldifS+EC+NwBX+uzN Co0PQfn0Uq5qp0o7A3tSUldlND/qGyg23GdVYAQ10Qz5BL4wTnuDl1iFzOkNtjrlNO C2Up9vn4n4atu272q6nA33SRsPTMycTR7eJu2WDY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook Subject: [PATCH 5.8 22/38] lkdtm/heap: Avoid edge and middle of slabs Date: Mon, 10 Aug 2020 17:19:12 +0200 Message-Id: <20200810151804.989498491@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200810151803.920113428@linuxfoundation.org> References: <20200810151803.920113428@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kees Cook commit e12145cf1c3a8077e6d9f575711e38dd7d8a3ebc upstream. Har har, after I moved the slab freelist pointer into the middle of the slab, now it looks like the contents are getting poisoned. Adjust the test to avoid the freelist pointer again. Fixes: 3202fa62fb43 ("slub: relocate freelist pointer to middle of object") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20200625203704.317097-3-keescook@chromium.org Signed-off-by: Greg Kroah-Hartman --- drivers/misc/lkdtm/heap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/drivers/misc/lkdtm/heap.c +++ b/drivers/misc/lkdtm/heap.c @@ -58,11 +58,12 @@ void lkdtm_READ_AFTER_FREE(void) int *base, *val, saw; size_t len = 1024; /* - * The slub allocator uses the first word to store the free - * pointer in some configurations. Use the middle of the - * allocation to avoid running into the freelist + * The slub allocator will use the either the first word or + * the middle of the allocation to store the free pointer, + * depending on configurations. Store in the second word to + * avoid running into the freelist. */ - size_t offset = (len / sizeof(*base)) / 2; + size_t offset = sizeof(*base); base = kmalloc(len, GFP_KERNEL); if (!base) {