Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753755AbcKRRrI (ORCPT ); Fri, 18 Nov 2016 12:47:08 -0500 Received: from resqmta-ch2-10v.sys.comcast.net ([69.252.207.42]:53044 "EHLO resqmta-ch2-10v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752337AbcKRRrH (ORCPT ); Fri, 18 Nov 2016 12:47:07 -0500 Date: Fri, 18 Nov 2016 11:47:09 -0600 (CST) From: Christoph Lameter X-X-Sender: cl@east.gentwo.org To: Michael Ellerman cc: akpm@linux-foundation.org, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, keescook@chromium.org Subject: Re: [PATCH v2] slab: Add POISON_POINTER_DELTA to ZERO_SIZE_PTR In-Reply-To: <1479376267-18486-1-git-send-email-mpe@ellerman.id.au> Message-ID: References: <1479376267-18486-1-git-send-email-mpe@ellerman.id.au> Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfHk9zOgW/e9zZzwhCicXPoFKevrUDWVaFu/rtevscRZy15EKNDeP84NC7SchteOhutltLErRtIHo2wVBiUe4+0zwnB0SM9pdFXcLejXauA7AG/0quHFl aNfPE7WJI9rwrHba8vu3dAwrnABkjRt6NtOpIqI0XU+wzOjEyiKbKR5uF9a2jgMXaPNOUGkueV7w+FXZdpgqZ50iMKZkASay6+TNmjmHtsT8x2dlti0Q7ASW lLp/fMK2HLuhrJ1OAO+Hy3OkNhNi8z02AdY/v1PKryBVhGG9wSC5kHfKmvX+I2fvGXRmjWx3YT+X8nP2YAqNNqsu+b/nQjLq0WbKt+scwtPP8Gh7Q1qzCQ0g RxEVKPs5Rep27vJ6rR5EI6qmzlmsAAZvsG8drR3jZS3pDR+yB0w00MByElFKEohnLRMHLt9KAatDqjPbp6UVKvwlwph7rg== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 482 Lines: 14 On Thu, 17 Nov 2016, Michael Ellerman wrote: > Currently ZERO_OR_NULL_PTR() uses a trick of doing a single check that > x <= ZERO_SIZE_PTR, and ignoring the fact that it also matches 1-15. Well yes that was done so we do not add too many branches all over the kernel..... > That no longer really works once we add the poison delta, so split it > into two checks. Assign x to a temporary to avoid evaluating it > twice (suggested by Kees Cook). And now you are doing just that.