From owner-dev-commits-src-main@freebsd.org Fri Jul 9 19:54:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AE216656A5 for ; Fri, 9 Jul 2021 19:54:27 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GM3lR3RyMz3DCP for ; Fri, 9 Jul 2021 19:54:27 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x82e.google.com with SMTP id x24so8392994qts.11 for ; Fri, 09 Jul 2021 12:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=7VXe/T725BhUcviId67HBLTEjgIEQSFSJdaeow7whlk=; b=DQVwCxIVXGVFpTtz0XqbECcJwz94PPV94FGhV6vTL6QEH9hjOlTYh/MDs3FVQ89oWM Ty1hIGgjPPBwP0JLYiU2dFPlLNLp1Ceqbi0VJQJxCD+YyYO6nuCn5M7GY5D9hI5mOgp/ b5zTpfz2/WGc5Gca6hgFY780cqTABjHLbS3QCMjZrvAV1+CATDoZrd04ytnTmGqBRmfn 8Jq+leC+iClswRcOojQP6ZBsNOuGjL67lDA3MfpvmIlPR4XkUlT2nvy3pCyMBBk+Giay t+oodPAb03W/UrOCvzkD+W1TB2CIqhxahKbX29i8gcEl7w0T0fLYjVrGiZhBi1buo/Tf 5pVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=7VXe/T725BhUcviId67HBLTEjgIEQSFSJdaeow7whlk=; b=jqq8jxcWi4+e8vqXx9B0Ld8WPsDs/Yurwdbx3lWkwae03CSElPdiVrzYU9WxMZeNET WZTKfTmpJnpD0f866vAi5tXzcPY+fcExiY4Uqx7UcSr9aHEvHJ5Ba67ywYgLC2UG880W hUdyIWc/7I0eqAJpP1Q3JgnZnrF4HwBAno6JppmZiefQLhOJ/vFyHToY5lrW2ly2iX7t hxE0cE13CxrsuwK4LfQu+WAcWllW40GVIEHLko873t5aiX+x6i9Q0RLzACq1WdQ7VexR XnV5saAScW7vL4n+PZc7WNb2Bd3C9jWJ0jxmzm+9lnyEF9vraYJjsNQic88utSqh0Orq bB6Q== X-Gm-Message-State: AOAM532YRlC4i9OhE8EMNBDLZZfJVm4BlxzM8kgFIpwVQk7hu1b3AbeY uYStmqmPOWvAd4s2GHGQzyfzeA== X-Google-Smtp-Source: ABdhPJzAp06cIY49U8j4hLKsIYbvf2KhUc7rIdOpkkDNPJ4167WFHp+CVBd27HneflKLoMMLjHkYDw== X-Received: by 2002:ac8:5314:: with SMTP id t20mr2842703qtn.235.1625860466668; Fri, 09 Jul 2021 12:54:26 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id d26sm480810qka.107.2021.07.09.12.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jul 2021 12:54:26 -0700 (PDT) Date: Fri, 9 Jul 2021 15:54:25 -0400 From: Shawn Webb To: Warner Losh Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 72821668b039 - main - stand/kmem_zalloc: panic when a M_WAITOK allocation fails Message-ID: <20210709195425.xzk2azaor4ielmb4@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202107091726.169HQvGQ084473@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bbnarx7wbuksohxs" Content-Disposition: inline In-Reply-To: <202107091726.169HQvGQ084473@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4GM3lR3RyMz3DCP X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 19:54:27 -0000 --bbnarx7wbuksohxs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 09, 2021 at 05:26:57PM +0000, Warner Losh wrote: > The branch main has been updated by imp: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D72821668b039c276914569e9ca= a1cdfa4e4cb674 >=20 > commit 72821668b039c276914569e9caa1cdfa4e4cb674 > Author: Warner Losh > AuthorDate: 2021-07-09 17:21:18 +0000 > Commit: Warner Losh > CommitDate: 2021-07-09 17:21:18 +0000 >=20 > stand/kmem_zalloc: panic when a M_WAITOK allocation fails > =20 > Malloc() might return NULL, in which case we will panic with a NULL > pointer deref. Make it panic when the allocation fails to preserve the > postcondtion that we never return a non-NULL value. malloc(9) tells us that M_WAITOK will never fail. I'm thinking this conditional might need to be negated for the !M_WAITOK case, in which malloc(9) could indeed fail. Although, even as I type this email, I just realized that a different function, Malloc, is being called. What's the difference between malloc and Malloc? Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --bbnarx7wbuksohxs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmDoqXEACgkQ/y5nonf4 4fpiPQ/9GhtOSJy3+Stl9jkeS3ZoT03rPiQouKWNEyS3PqbPJ9LYN2xT66FVDViJ ZYQ/fjH27lDikBOExbvO70ykU5D9HBgjmvqkrG8sQKbCwJzGE9gy4l0uNTdA4Lm7 fOic36syucTSeKwvWq7ptYMyz75/fSxovIoyH9uPB4oL6bZzjjuhYk1Z3XnglVG8 MJhqvpzz77ORjiuymB1QbZSq7a1F79jPcRMC0cK6xm4BmLPn+Brw/+eviQ4vr160 0L9ZfR/NA0XUgC9tDwfDgGjYQVRsZ3Xl8B8M9UXybbPHQMRyunWupfU4+Gln2AVH X6Rt6aeuvBA46gBp+/ea8NatGDWYZLPAfGNe54oS8LGj3Db1e2LayEyLDSguTzWL AgY1p0fnNdF4YAfY8HIoTmP7PvYwFjUNpL4MXAjeotWWMKoaIXtbWBFfYmxmfbZx ep2/S8jenXYK0SmG5ky9+P5YJCNdKpeg5/b5LsApOoegme6LFTd2uAN1Dg33ipvH VfxX7B35dqlFqR6gGBUJm3MzOJF1kR7L5cZR/BWHIJ1Y9ZPzZ0xeaZ8OJrKjhQOm QoATgJ2ouHUxXO1vLETJxRiwoKfzOxaMOitbXblU014bAr3YojzZ7KCj0ipFvdn/ t4y+Q2dsEMcZtRKvv94vdcCgx/QUcFJoFksELQisLfs4vd9/QpY= =NObg -----END PGP SIGNATURE----- --bbnarx7wbuksohxs--