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.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 4972BC4360C for ; Thu, 10 Oct 2019 17:44:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EC8B620659 for ; Thu, 10 Oct 2019 17:44:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="XAvcCIPN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC8B620659 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 740948E0006; Thu, 10 Oct 2019 13:44:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F1C58E0003; Thu, 10 Oct 2019 13:44:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 608488E0006; Thu, 10 Oct 2019 13:44:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0009.hostedemail.com [216.40.44.9]) by kanga.kvack.org (Postfix) with ESMTP id 3F1848E0003 for ; Thu, 10 Oct 2019 13:44:23 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id CEBD2824CA2F for ; Thu, 10 Oct 2019 17:44:22 +0000 (UTC) X-FDA: 76028599164.23.wrist58_4329c74420406 X-HE-Tag: wrist58_4329c74420406 X-Filterd-Recvd-Size: 2597 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Thu, 10 Oct 2019 17:44:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Z/Xo90rzmSfZRsrgT0oiI8BPLh39hTG/m3xFpUxe7nQ=; b=XAvcCIPNXZ2bSN6u+QooRLoDm pa0K2Fp7KPn4WkQlLoLictTYV0lMKtwZNLm0kcZhiUEYiF6xyz62G40j+Q28E5sr76s5x0A/C7mdP YvLcc6+CEwf2W1sQoeuOSIG9g3JYZWl0bsO+oki9Ez06xOcI1HyMqXE0zr6GuKhn0Sg535VNvQATK i/77r5QsFBHTR8NrxTF8NRXzUQ6WSiLDYik884CA5+Ef9Nfl+H8/KIKIoQiR0pLsMuxruL9whTxKH yPFDvoe+CeRnb5nYvFW2Aac0P5nNIniT6nfgE8o7UP8Ie/cHTQ05tZbUXrq8iqa4BX5g+FuRlrj+X NksvWo3VA==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iIcU1-0002hU-Sw; Thu, 10 Oct 2019 17:44:13 +0000 Date: Thu, 10 Oct 2019 10:44:13 -0700 From: Matthew Wilcox To: Christopher Lameter Cc: Shyam Saini , linux-mm@kvack.org, kernel-hardening@lists.openwall.com, Kees Cook Subject: Re: [PATCH] slab: Redefine ZERO_SIZE_PTR to include ERR_PTR range Message-ID: <20191010174413.GT32665@bombadil.infradead.org> References: <20191010103151.7708-1-mayhs11saini@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Oct 10, 2019 at 02:22:40PM +0000, Christopher Lameter wrote: > On Thu, 10 Oct 2019, Shyam Saini wrote: > > > This will help error related to ERR_PTR stand out better. > > Maybe make ZERO_SIZE_PTR an ERRNO value instead? Then allow ERR_PTRs to be > used instead of ZERO_SIZE_PTRs > > ERRNO_ZERO_OBJECT > > or something like that? I was wondering about something like that too, but allocating zero bytes isn't actually an error, and if we have code that does something like: void *p = my_funky_alloc(size, ...); if (IS_ERR(p)) return PTR_ERR(p); then we might get this errno returned to userspace. The change is definitely worth thinking about.