From owner-svn-src-head@freebsd.org Wed Jan 24 21:13:34 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3BEAEC657B for ; Wed, 24 Jan 2018 21:13:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A90978725 for ; Wed, 24 Jan 2018 21:13:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x229.google.com with SMTP id g1so10935735wmg.2 for ; Wed, 24 Jan 2018 13:13:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=FfemW3Va+D3OTJAjuYjIgsXmjF/+WPmVbjUG0aBvKl0=; b=0ZHHXZsgWvK1G0uwfiTd4tdduw9oPoO/nN49dO5Tq6GzOC1CEmEW+MJXu0tJtvQzs6 6VnVMQd8CKYmSASihCVxE4in8TSQ3/Xn603AtybJi/fE6HAeHpEZU0BL2XRFwwt3ovAy n6cs5YyAQdvt+mLfmqH+sSY3rfxjV3+YKyUS61DPw5+P4lxN0iF9jg5OygTI6ZtBi270 dK6suC28mVnVu2Tkgm0iKr3onVU48graXhiS/10xl2hV1E952tjCu/pQDsZGmGmTwsms 4lggcNd2qYtoD450Ze0E32ciVf0D8ZHYtHyd6GUStcJQFw51XH0/DAu6k7BG3fxYC7Ch wSAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=FfemW3Va+D3OTJAjuYjIgsXmjF/+WPmVbjUG0aBvKl0=; b=mNtvxCZJRdeiCvWlrUhhp7Tjxk27dx7zxHsV0PXMaVV0P5r0je14gKYRTMtvgdAYd5 Cxi47WHmGvnPHeiAHlHgvDApyNa82bJiXBGCxPo4csgCYn4GcxcRleVu57R0/YrQSXLJ Kz9zHT13hRS4UjGTmQ8YVJr2FVLH99+msHaNKWd12Vr+tFn4dsAz13pBNuJShsFbal7E S3bdoQzJTWboCe6UXK57Jh0rbi5cyb6mQI0+VISNPmHAQc4K1uEobgt1CpZGnN6PP0Hg TLBPWtEic+XazDuMQj34TOon3LcX5fJ2jmnIkYRaj8tl4ts56SqChIZwNTfE/7ERK8pz 4sPQ== X-Gm-Message-State: AKwxytfIcU903mZuzvQU4RJP8MqR1U85v0gF+koT55UjBX/kO8RfyCRC CsTzV4TuLbuhmVx9l4J6rH+S5rurSDnFFMDF5Qpk5A== X-Google-Smtp-Source: AH8x226/l2h7YSLBBv9Ob8puqnppxpgwEKPQJLdqsVFi/9rIR+VH/BX+TfFcxFQ7czXdZCImW/jTCh6hwrfoUyINluU= X-Received: by 10.80.151.22 with SMTP id c22mr26429688edb.225.1516828412227; Wed, 24 Jan 2018 13:13:32 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.133.195 with HTTP; Wed, 24 Jan 2018 13:13:31 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: References: <201801211542.w0LFgbsp005980@repo.freebsd.org> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> <1516817048.42536.182.camel@freebsd.org> <2aa48cbd-247a-66cd-b486-02ee77ec2e96@selasky.org> From: Warner Losh Date: Wed, 24 Jan 2018 14:13:31 -0700 X-Google-Sender-Auth: 0uAgF_FljxpqC90LWoK69cuEgvE Message-ID: Subject: Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/... To: "Conrad E. Meyer" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jan 2018 21:13:34 -0000 On Wed, Jan 24, 2018 at 12:40 PM, Conrad Meyer wrote: > On Wed, Jan 24, 2018 at 11:27 AM, Warner Losh wrote: > > > > Which is why we should add check overflows for most of the no wait cases. > > They should be checked, but not primarily with mallocarray... > > I don't understand what the distinction is here. Can you help me > understand why the overflow check should be lifted from mallocarray > into the caller for no wait cases? Or is that not what you're > suggesting? > mallocarray should be the last line of defense, not the only line of defense. most of the time, it's more correct to say if (WOULD_OVERFLOW(a,b)) return EINVAL; ptr = mallocarray(a,b...); since an error return, assuming it's handled correctly is preferable to a panic. I thought this was more true for NOWAIT than for WAITOK cases, but I've realized it's more true always. And that's why I have such a problem with mallocarray: it's only useful when people are lazy and haven't checked, and then it creates a DoS path for things that don't check. We'll change it now and think we're safe, when we still have issues, just different issues than before. It may be a necessary change, but it certainly isn't sufficient. Warner