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=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 BD5DAC10DCE for ; Sun, 15 Mar 2020 14:11:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9A975205ED for ; Sun, 15 Mar 2020 14:11:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728230AbgCOOLj (ORCPT ); Sun, 15 Mar 2020 10:11:39 -0400 Received: from gentwo.org ([3.19.106.255]:43644 "EHLO gentwo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727778AbgCOOLj (ORCPT ); Sun, 15 Mar 2020 10:11:39 -0400 Received: by gentwo.org (Postfix, from userid 1002) id 8C64E3F7A9; Sun, 15 Mar 2020 14:11:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 8B71A3F6EC; Sun, 15 Mar 2020 14:11:38 +0000 (UTC) Date: Sun, 15 Mar 2020 14:11:38 +0000 (UTC) From: Christopher Lameter X-X-Sender: cl@www.lameter.com To: Kees Cook cc: David Laight , Andrew Morton , Pekka Enberg , David Rientjes , Joonsoo Kim , Daniel Micay , Vitaly Nikolenko , Silvio Cesare , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] slub: Relocate freelist pointer to middle of object In-Reply-To: <202003111039.24B8A0B@keescook> Message-ID: References: <202003051624.AAAC9AECC@keescook> <6fbf67b5936a44feaf9ad5b58d39082b@AcuMS.aculab.com> <202003111039.24B8A0B@keescook> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 11 Mar 2020, Kees Cook wrote: > > Sounds good. You could even randomize the position to avoid attacks on via > > the freelist pointer. > > That's a good point. "offset" is just calculated once, and for many > slabs, the available space is quite large. I wonder what the best Correct. > practice might be for how far from the edge to stay. Hmmm. Maybe simply > carve it into thirds, and randomize the offset within the middle third? Take off the first and last word and randomize within the space that is left? 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=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 DF838C10DCE for ; Sun, 15 Mar 2020 14:33:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 88B7A20637 for ; Sun, 15 Mar 2020 14:33:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 88B7A20637 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E42196B0003; Sun, 15 Mar 2020 10:33:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF2236B0006; Sun, 15 Mar 2020 10:33:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D07CA6B0007; Sun, 15 Mar 2020 10:33:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0060.hostedemail.com [216.40.44.60]) by kanga.kvack.org (Postfix) with ESMTP id B52986B0003 for ; Sun, 15 Mar 2020 10:33:32 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id AB8AB246E for ; Sun, 15 Mar 2020 14:33:32 +0000 (UTC) X-FDA: 76597839864.14.page73_48aafba4ea83a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id AB885180BBFE4 for ; Sun, 15 Mar 2020 14:11:39 +0000 (UTC) X-HE-Tag: page73_48aafba4ea83a X-Filterd-Recvd-Size: 2059 Received: from gentwo.org (gentwo.org [3.19.106.255]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Sun, 15 Mar 2020 14:11:39 +0000 (UTC) Received: by gentwo.org (Postfix, from userid 1002) id 8C64E3F7A9; Sun, 15 Mar 2020 14:11:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 8B71A3F6EC; Sun, 15 Mar 2020 14:11:38 +0000 (UTC) Date: Sun, 15 Mar 2020 14:11:38 +0000 (UTC) From: Christopher Lameter X-X-Sender: cl@www.lameter.com To: Kees Cook cc: David Laight , Andrew Morton , Pekka Enberg , David Rientjes , Joonsoo Kim , Daniel Micay , Vitaly Nikolenko , Silvio Cesare , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] slub: Relocate freelist pointer to middle of object In-Reply-To: <202003111039.24B8A0B@keescook> Message-ID: References: <202003051624.AAAC9AECC@keescook> <6fbf67b5936a44feaf9ad5b58d39082b@AcuMS.aculab.com> <202003111039.24B8A0B@keescook> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Bogosity: Ham, tests=bogofilter, spamicity=0.004134, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, 11 Mar 2020, Kees Cook wrote: > > Sounds good. You could even randomize the position to avoid attacks on via > > the freelist pointer. > > That's a good point. "offset" is just calculated once, and for many > slabs, the available space is quite large. I wonder what the best Correct. > practice might be for how far from the edge to stay. Hmmm. Maybe simply > carve it into thirds, and randomize the offset within the middle third? Take off the first and last word and randomize within the space that is left?