From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=altlinux.org; s=dkim; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=eukIi5/d3ehPgwStzmoMXixBryNPDrffP/S5Nw2vB5Y=; b=qBnOgvaqtkfxfLD9bOY5f3Y0Wc eAvMx6FNnQRrzs140Bb6GrotATt3WQHTgNvAeqGGe+iurncT3fS7c6QnQO8C+3P52DzbVaiY4RHzq tvR7aVVEFqdZx8zvkz1taajqfX5Hm1wYYZoOSeMURu7JK7ihCd3ulRbXpFeMgcw8B3oONALTdeP4I wWiZNtRqULw9RwuV8kKKvbhBajpGIcsCbJtkgRCE4sEPQM+CQxuXvP9dQ9UdN/V2WnQbAEJeE/m+z NdRbvFENdZ/T/edayIqYtRk9KKHsf4yviMg1ChhbNO8x4ve2cOKIrnrQquTANtb4rGiyilBwRySUA YEt8KChw==; From: Arseny Maslennikov To: devel@lists.altlinux.org Date: Tue, 24 Aug 2021 11:24:33 +0300 Message-Id: <20210824082436.1555890-5-arseny@altlinux.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210824082436.1555890-1-arseny@altlinux.org> References: <20210824082436.1555890-1-arseny@altlinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 10.15.13.28 X-SA-Exim-Mail-From: arseny@altlinux.org X-SA-Exim-Version: 4.2.1 X-SA-Exim-Scanned: No (on mail.cs.msu.ru); Unknown failure Cc: Arseny Maslennikov Subject: [devel] [PATCH hasher-priv v3 4/7] Link with libsetproctitle by Dmitry V. Levin X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Aug 2021 08:25:09 -0000 Archived-At: List-Archive: List-Post: This being a shared library is an implementation detail: to overcome the lack of such an interface on Linux, we need to run some preparation code before main() and pass argv/envp memory buffers to it. A function declared with __attribute__((constructor)) gets called with no arguments, we can't pass the argv/envp buffers to it, so we put an implementation of setproctitle(3) in a shared object and hijack its _init(). Signed-off-by: Arseny Maslennikov --- hasher-priv/Makefile | 3 ++- hasher-priv/hasher-priv.spec | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hasher-priv/Makefile b/hasher-priv/Makefile index 8ccf99d..a08f6a8 100644 --- a/hasher-priv/Makefile +++ b/hasher-priv/Makefile @@ -42,6 +42,7 @@ CPPFLAGS = -std=gnu99 -D_GNU_SOURCE $(CHDIRUID_FLAGS) \ CFLAGS = -pipe -O2 override CFLAGS += $(WARNINGS) LDLIBS = +server_LDLIBS = -lsetproctitle SRC = hasher-priv.c cmdline.c fds.c sockets.c logging.c communication.c xmalloc.c pass.c OBJ = $(SRC:.c=.o) @@ -65,7 +66,7 @@ $(PROJECT): $(OBJ) $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ hasher-privd: $(server_OBJ) - $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) $(server_LDLIBS) -o $@ install: all $(MKDIR_P) -m710 $(DESTDIR)$(configdir)/user.d diff --git a/hasher-priv/hasher-priv.spec b/hasher-priv/hasher-priv.spec index 8ec0013..e21dec1 100644 --- a/hasher-priv/hasher-priv.spec +++ b/hasher-priv/hasher-priv.spec @@ -20,6 +20,7 @@ Obsoletes: pkg-build-priv Conflicts: hasher < 1.4.0 BuildPreReq: help2man, sisyphus_check >= 0:0.7.11 +BuildRequires: setproctitle-devel %description This package provides helpers for executing privileged operations -- 2.32.0