Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754016AbcCIVA7 (ORCPT ); Wed, 9 Mar 2016 16:00:59 -0500 Received: from mail-io0-f180.google.com ([209.85.223.180]:35986 "EHLO mail-io0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753912AbcCIVAt (ORCPT ); Wed, 9 Mar 2016 16:00:49 -0500 MIME-Version: 1.0 In-Reply-To: <1457135448-15541-1-git-send-email-labbott@fedoraproject.org> References: <1457135448-15541-1-git-send-email-labbott@fedoraproject.org> Date: Wed, 9 Mar 2016 13:00:48 -0800 X-Google-Sender-Auth: sOV0JWYLPP5zuuXVjG6LHJIOEBM Message-ID: Subject: Re: [PATCHv4 0/2] Sanitization of buddy pages From: Kees Cook To: Laura Abbott Cc: Andrew Morton , "Kirill A. Shutemov" , Vlastimil Babka , Michal Hocko , Linux-MM , LKML , "kernel-hardening@lists.openwall.com" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2709 Lines: 110 On Fri, Mar 4, 2016 at 3:50 PM, Laura Abbott wrote: > Hi, > > This is v4 of the santization of buddy pages. This is mostly just a rebase > and some phrasing tweaks from v2. Kees submitted a rebase of v3 so this is v4. > > Kees, I'm hoping you will give your Tested-by and provide some stats from the > tests you were running before. Yeah, please consider these: Tested-by: Kees Cook The benchmarking should be the same as the v3 I reported on, repeated here for good measure: The sanity checks appear to add about 3% additional overhead, but poisoning seems to add about 9%. DEBUG_PAGEALLOC=n PAGE_POISONING=y PAGE_POISONING_NO_SANITY=y PAGE_POISONING_ZERO=y Run times: 389.23 384.88 386.33 Mean: 386.81 Std Dev: 1.81 LKDTM detects nothing, as expected. DEBUG_PAGEALLOC=n PAGE_POISONING=y PAGE_POISONING_NO_SANITY=y PAGE_POISONING_ZERO=n slub_debug=P page_poison=on Run times: 435.63 419.20 422.82 Mean: 425.89 Std Dev: 7.05 Overhead: 9.2% vs all disabled Poisoning confirmed: READ_AFTER_FREE, READ_BUDDY_AFTER_FREE Writes not detected, as expected. DEBUG_PAGEALLOC=n PAGE_POISONING=y PAGE_POISONING_NO_SANITY=y PAGE_POISONING_ZERO=y slub_debug=P page_poison=on Run times: 423.44 422.32 424.95 Mean: 423.57 Std Dev: 1.08 Overhead 8.7% overhead vs disabled, 0.5% improvement over non-zero poison (though only the buddy allocator is using the zero poison). Poisoning confirmed: READ_AFTER_FREE, READ_BUDDY_AFTER_FREE Writes not detected, as expected. DEBUG_PAGEALLOC=n PAGE_POISONING=y PAGE_POISONING_NO_SANITY=n PAGE_POISONING_ZERO=y slub_debug=FP page_poison=on Run times: 454.26 429.46 430.48 Mean: 438.07 Std Dev: 11.46 Overhead: 11.7% vs nothing, 3% more overhead than no sanitizing. All four tests detect correctly. > > Thanks, > Laura > > Laura Abbott (2): > mm/page_poison.c: Enable PAGE_POISONING as a separate option > mm/page_poisoning.c: Allow for zero poisoning > > Documentation/kernel-parameters.txt | 5 + > include/linux/mm.h | 11 +++ > include/linux/poison.h | 4 + > kernel/power/hibernate.c | 17 ++++ > mm/Kconfig.debug | 39 +++++++- > mm/Makefile | 2 +- > mm/debug-pagealloc.c | 137 ---------------------------- > mm/page_alloc.c | 13 ++- > mm/page_ext.c | 10 +- > mm/page_poison.c | 176 ++++++++++++++++++++++++++++++++++++ > 10 files changed, 272 insertions(+), 142 deletions(-) > delete mode 100644 mm/debug-pagealloc.c > create mode 100644 mm/page_poison.c > > -- > 2.5.0 > -Kees -- Kees Cook Chrome OS & Brillo Security