From patchwork Wed Jun 5 00:53:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1352 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 92A626471C for ; Wed, 5 Jun 2019 02:53:30 +0200 (CEST) Received: from localhost.localdomain (unknown [96.44.9.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C478F2D1; Wed, 5 Jun 2019 02:53:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1559696010; bh=YJ3Ev46ZbfSbeeW3ZSix5DgsNlsTwaQV4Z8rW5yyrB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LqEqTmSN0LWiWDIEQW5B/UEzj/rl3/BUPd/q8rS1r6s0R/VOmbnTyw1v8Ku9xfqry J4SjGGtPEcfcl18/RkCW6KcBdlFXPWSSHZfmy8lH0T9MswY4YjraXp3BuG7xVfPpOx KDNnMtHuL6ZnOuB72UMj4fSTYrLse8Z8U91GH2OM= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Tue, 4 Jun 2019 20:53:10 -0400 Message-Id: <20190605005316.4835-5-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190605005316.4835-1-paul.elder@ideasonboard.com> References: <20190605005316.4835-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 04/10] libcamera: ipa_module: verify IPA module API version upon loading X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2019 00:53:30 -0000 The IPA module API version determines the layout of struct IPAModuleInfo. If this version number does not match, then it means that the IPA module cannot be loaded at all. Validate this version number upon loading the IPA module info from the IPA shared object. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- New patch src/libcamera/ipa_module.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp index f79a44e..2aa508c 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -274,6 +274,9 @@ int IPAModule::loadIPAModuleInfo() ret = elfLoadSymbol (&info_, sizeof(info_), map, soSize, "ipaModuleInfo"); + if (info_.moduleAPIVersion != IPA_MODULE_API_VERSION) + ret = -EINVAL; + unmap: munmap(map, soSize); close: