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=WPsswXaIWN/nfIic8OZPDKxdjWgMh7Sd3QILuBrKaOw=; b=m468Iv8lw2mGXomPLmUAKTUvdz lRb/hqe9YIApjjONEkrHMV4J+VIkozfAf3lKtLa7r5p3feiAUanSD6DvRXaVug+HfRTNAqH5MD0jE F9/9zZj7wJmVoOIGBbmoqOOg8c1cYfuXEmt7/u3D6f2cTLpuFtYivEDIlmqeg5IFwGgs5AzS3IHTY KgCXnB+7AEaXhTVeJxJwwVLgYHJXotnDIEfoG0x1gKcdNGHWkP2QaYiScP0vp2LQIICPD7/tnkWdW 3igmfUABkdEsv96lkBpvUPV7f/5QFUcb8RjUsTZ4xBqKWStwUzUm+ccXZ8xPYgf5gGCAWnXjWVPDy GGwhWhiw==; From: Arseny Maslennikov To: devel@lists.altlinux.org, ldv@altlinux.org Date: Thu, 22 Oct 2020 14:43:39 +0300 Message-Id: <20201022114343.1810141-3-arseny@altlinux.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201022114343.1810141-1-arseny@altlinux.org> References: <20201022114343.1810141-1-arseny@altlinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 37.204.119.143 X-SA-Exim-Mail-From: arseny@altlinux.org X-SA-Exim-Version: 4.2.1 X-SA-Exim-Scanned: Yes (on mail.cs.msu.ru) Cc: Arseny Maslennikov Subject: [devel] [PATCH v2 2/6] 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: Thu, 22 Oct 2020 11:43:58 -0000 X-List-Received-Date: Thu, 22 Oct 2020 11:43:58 -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 ce55274..283249b 100644 --- a/hasher-priv/Makefile +++ b/hasher-priv/Makefile @@ -39,6 +39,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) @@ -62,7 +63,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 2da9ee4..fac25cd 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.25.4