1
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-06-14 11:13:53 +02:00
openwrt/package/system/ubus/Makefile
Petr Štetiar cc344f1513 ubus: backport fixes for UAF and other issues
Backporting following fixes:

 a72457b61df0 libubus: increase stack depth for processing obj msgs
 ef038488edc3 libubus: process pending messages in data handler if stack depth is 0
 2099bb3ad997 libubus: use list_empty/list_first_entry in ubus_process_pending_msg

where at least commit 2099bb3ad997 ("libubus: use
list_empty/list_first_entry in ubus_process_pending_msg") fixes UAF
issue I've introduced in commit c5f2053dfcfd ("workaround possibly false
positive uses of memory after it is freed") while fixing another false
positive UAF reported[1] by clang's static analyzer.

Those fixes are being used in master/21.02 for about 6 months, so should
be tested enough and considered for backporting. I've runtested those
fixes on mvebu/turris-omnia and ipq40xx/glinet-b1300 devices.

1. https://openwrt.gitlab.io/-/project/ubus/-/jobs/2096090992/artifacts/build/scan/2022-02-15-150310-70-1/index.html

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2022-02-21 07:41:05 +01:00

82 lines
1.8 KiB
Makefile

include $(TOPDIR)/rules.mk
PKG_NAME:=ubus
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git
PKG_SOURCE_DATE:=2022-02-21
PKG_SOURCE_VERSION:=b32a0e17b37847e8357b53a358d1311bfc3ad5d2
PKG_MIRROR_HASH:=fddf17b1faeb2ab09a3bed2e301a9cc83cb6ceb69af57cd58dc2132b58276f8b
PKG_ABI_VERSION:=20210603
CMAKE_INSTALL:=1
PKG_LICENSE:=LGPL-2.1
PKG_LICENSE_FILES:=
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/ubus
SECTION:=base
CATEGORY:=Base system
DEPENDS:=+libubus +libblobmsg-json +ubusd
TITLE:=OpenWrt RPC client utility
endef
define Package/ubusd
SECTION:=base
CATEGORY:=Base system
TITLE:=OpenWrt RPC daemon
DEPENDS:=+libubox +libblobmsg-json
endef
define Package/libubus
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libubox
ABI_VERSION:=$(PKG_ABI_VERSION)
TITLE:=OpenWrt RPC client library
endef
define Package/libubus-lua
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libubus +liblua
TITLE:=Lua binding for the OpenWrt RPC client
endef
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -flto
TARGET_LDFLAGS += -flto
CMAKE_OPTIONS = \
-DLUAPATH=/usr/lib/lua \
-DABIVERSION="$(PKG_ABI_VERSION)"
define Package/ubus/install
$(INSTALL_DIR) $(1)/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/ubus $(1)/bin/
endef
define Package/ubusd/install
$(INSTALL_DIR) $(1)/sbin
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/ubusd $(1)/sbin/
endef
define Package/libubus/install
$(INSTALL_DIR) $(1)/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libubus.so.* $(1)/lib/
endef
define Package/libubus-lua/install
$(INSTALL_DIR) $(1)/usr/lib/lua
$(CP) $(PKG_BUILD_DIR)/lua/ubus.so $(1)/usr/lib/lua/
endef
$(eval $(call BuildPackage,libubus))
$(eval $(call BuildPackage,libubus-lua))
$(eval $(call BuildPackage,ubus))
$(eval $(call BuildPackage,ubusd))