From owner-svn-src-all@freebsd.org Fri Dec 1 06:37:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5C37E5F223; Fri, 1 Dec 2017 06:37:13 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8065372A87; Fri, 1 Dec 2017 06:37:13 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vB16bCw8076540; Fri, 1 Dec 2017 06:37:12 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB16bCfD076539; Fri, 1 Dec 2017 06:37:12 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201712010637.vB16bCfD076539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 1 Dec 2017 06:37:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326421 - head/stand/efi/libefi X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/efi/libefi X-SVN-Commit-Revision: 326421 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Dec 2017 06:37:13 -0000 Author: tsoome Date: Fri Dec 1 06:37:12 2017 New Revision: 326421 URL: https://svnweb.freebsd.org/changeset/base/326421 Log: loader.efi: efipart should exclude iPXE stub block protocol iPXE does insert stub BLOCK IO protocol handle to rework other issues, this handle is not usable as it does not provide actual implementation. We can detect this situation by checking and validating the BlockSize property, so this update does make sure we have BlockSize at least 512B and its value is power of 2. PR: 223969 Reported by: Jeff Pieper Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D13297 Modified: head/stand/efi/libefi/efipart.c Modified: head/stand/efi/libefi/efipart.c ============================================================================== --- head/stand/efi/libefi/efipart.c Fri Dec 1 05:57:05 2017 (r326420) +++ head/stand/efi/libefi/efipart.c Fri Dec 1 06:37:12 2017 (r326421) @@ -257,6 +257,14 @@ efipart_hdd(EFI_DEVICE_PATH *dp) !blkio->Media->MediaPresent) { return (false); } + + /* + * We assume the block size 512 or greater power of 2. + */ + if (blkio->Media->BlockSize < 512 || + !powerof2(blkio->Media->BlockSize)) { + return (false); + } } return (true); }