From patchwork Fri Feb 12 05:42:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Lipnitskiy X-Patchwork-Id: 1439756 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=zGtSDkNl; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=rJOmTF7a; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DcMwQ3GC7z9sCD for ; Fri, 12 Feb 2021 16:47:50 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WzEGBPAgjh4SsY9LmYu38VW4AsufYZLMZ4rBI6XrIss=; b=zGtSDkNlgmDp9wvYMpvn6Wij2 Y2Lv5lIMmZQPonloUe6A8SkbPB3KDHbBGBnEmyEOrDx1Yl6cqiUwqfdE5ghXIkEMXQLT4EEd7ZtKU LMCF/O0ti+1F8X5RuTO66jmnNh5MGPvBSRf/jwd4DypvHPrwJiWmHA7TOUurt5xCrQXBYSWGIhepM +LP8cjLASLqAkt4UysnBfcM3SRF5VhBpd3SA7icm7LVB3Nc+Q5+R1HN4mCjv5gJ4Op05YX+0qAhPJ 5C7SOBI9Vr0AvmhmVRqnSBV4WBw8PcpX9gMEktTYzRWCivtSTHMyXkXVKFJlBdODB0lhvebNASQmi P+Fb1r9Mg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lARHV-00076I-23; Fri, 12 Feb 2021 05:46:17 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lARHR-00075M-Ft for openwrt-devel@lists.openwrt.org; Fri, 12 Feb 2021 05:46:14 +0000 Received: by mail-pf1-x42c.google.com with SMTP id z6so5179984pfq.0 for ; Thu, 11 Feb 2021 21:46:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MzIRVwThnEWEEUC4CtWP0BYEhhdmojCQQh6MvS6mqDg=; b=rJOmTF7aVKFTAziVwQeVWS8Z35ma9fP3L58cnmGcJHfFSp8pgiyDRfaF6Kv969BpZ1 y0uRdgg5+R4TUXwS+S2xLAoeESzmud5yWW22dpiNe6dcpGBSbdY6mOi9Pmm3LYtzhjnB eKCKdn/TMepqtQP75nlG+zaJACdi8p7OLxrxwFWs+LRibS20+wQsczdR70ekWY/ccbL0 8T9IrKb4zHolgNAJsD9nVlEBbj2GA7CYsUqwppHFdzocQ5U1epktyVgSZ+EpSY7qelzH 2rmWfOBHkozX2UrJJTj8ERsbInC8Tmh0bfqZnbTjq4H9NcX8Wr7y5M1BERoMiUWPd4me OEMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MzIRVwThnEWEEUC4CtWP0BYEhhdmojCQQh6MvS6mqDg=; b=rEM6Nu8k6iU9N0AmKiO11qVwIaZ0KY3DcQZSL1vsjFmNeX84C2cVQlvhKHpj27Ijy5 lvkYKHWzmSLBxGeyQUI+PbeanMidyZgEZKgis+GHP7/fyjPd0E+OSicoQQlBlOmTVlto bPtGgtZfEsctsJnPxNlrcEg7c8cXgu+5bUKbmHEq4LBu7z2uASsDinj3XXAc+o6dNsNR iUSC0X62XoguYQt7JoW6WkFf0KjCZdGi4/tk4W7TgeXXRhqHVdxZma1SuNquntv0XXN7 I5GMivklDWoKdtI4474UDly+rj1P5HTvLmUfenN0FM1W/ZMsCnIMiZHQrLdOF+4l4m8I Chhg== X-Gm-Message-State: AOAM533/MZkT1jCsjJVBFrQTmlV18qpcygBQR8hDLzetNihnQ6DKc7eY fs9S72NxJot6yAzUH1zMiEEZyG4Jb58bLg== X-Google-Smtp-Source: ABdhPJzPMGyL41ZmXM3KiVZSpTgu8hDTM91UxCt4aglfvv+8mmGXm9mK44CUinsMPNm4RsJiaSzujw== X-Received: by 2002:a05:6a00:8d4:b029:1b7:7ad9:4864 with SMTP id s20-20020a056a0008d4b02901b77ad94864mr1527196pfu.34.1613108771044; Thu, 11 Feb 2021 21:46:11 -0800 (PST) Received: from z640-arch.lan ([2602:4b:a46e:b100::678]) by smtp.gmail.com with ESMTPSA id t8sm6467592pjm.9.2021.02.11.21.46.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 21:46:10 -0800 (PST) From: Ilya Lipnitskiy To: openwrt-devel@lists.openwrt.org Subject: [PATCH v2] fakeroot: fix to work with glibc 2.33 Date: Thu, 11 Feb 2021 21:42:11 -0800 Message-Id: <20210212054210.684510-1-ilya.lipnitskiy@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210211031441.628215-1-ilya.lipnitskiy@gmail.com> References: <20210211031441.628215-1-ilya.lipnitskiy@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210212_004613_608448_AD443F3D X-CRM114-Status: GOOD ( 14.02 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:42c listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [ilya.lipnitskiy[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ilya Lipnitskiy , Felix Fietkau Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org The following commit removed _STAT_VER definitions from glibc: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=8ed005daf0ab03e142500324a34087ce179ae78e That subsequently broke fakeroot: https://bugs.archlinux.org/task/69572 https://bugzilla.redhat.com/show_bug.cgi?id=1889862#c13 https://forum.openwrt.org/t/unable-to-build-toolchain-fakeroot-fails-perhaps-others-after-it/87966 Make the patch based on Jan Pazdziora's suggestion from here: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/SMQ3RYXEYTVZH6PLQMKNB3NM4XLPMNZO/ Additionally, add wrappers for newly exported symbols in glibc. Tested on my x86_64 Arch Linux machine, fakeroot unit tests pass. Also tested by building various .ipks and examining the tar contents, to ensure that the owner uid/gid was 0/0. Signed-off-by: Ilya Lipnitskiy --- .../300-glibc-2.33-compatibility.patch | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 tools/fakeroot/patches/300-glibc-2.33-compatibility.patch diff --git a/tools/fakeroot/patches/300-glibc-2.33-compatibility.patch b/tools/fakeroot/patches/300-glibc-2.33-compatibility.patch new file mode 100644 index 0000000000..2e6beab095 --- /dev/null +++ b/tools/fakeroot/patches/300-glibc-2.33-compatibility.patch @@ -0,0 +1,74 @@ +--- a/libfakeroot.c ++++ b/libfakeroot.c +@@ -90,6 +90,16 @@ + #define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b) + #endif + ++#ifndef _STAT_VER ++ #if defined (__aarch64__) ++ #define _STAT_VER 0 ++ #elif defined (__x86_64__) ++ #define _STAT_VER 1 ++ #else ++ #define _STAT_VER 3 ++ #endif ++#endif ++ + /* + These INT_* (which stands for internal) macros should always be used when + the fakeroot library owns the storage of the stat variable. +@@ -1358,6 +1368,54 @@ int renameat(int olddir_fd, const char * + #endif /* HAVE_FSTATAT */ + + ++#ifdef __GLIBC__ ++#if __GLIBC_PREREQ(2,33) ++/* Glibc 2.33 exports symbols for these functions in the shared lib */ ++int lstat(const char *file_name, struct stat *statbuf) { ++ return WRAP_LSTAT LSTAT_ARG(_STAT_VER, file_name, statbuf); ++} ++int stat(const char *file_name, struct stat *st) { ++ return WRAP_STAT STAT_ARG(_STAT_VER, file_name, st); ++} ++int fstat(int fd, struct stat *st) { ++ return WRAP_FSTAT FSTAT_ARG(_STAT_VER, fd, st); ++} ++#ifdef HAVE_FSTATAT ++int fstatat(int dir_fd, const char *path, struct stat *st, int flags) { ++ return WRAP_FSTATAT FSTATAT_ARG(_STAT_VER, dir_fd, path, st, flags); ++} ++#endif ++#ifdef STAT64_SUPPORT ++int lstat64(const char *file_name, struct stat64 *st) { ++ return WRAP_LSTAT64 LSTAT64_ARG(_STAT_VER, file_name, st); ++} ++int stat64(const char *file_name, struct stat64 *st) { ++ return WRAP_STAT64 STAT64_ARG(_STAT_VER, file_name, st); ++} ++int fstat64(int fd, struct stat64 *st) { ++ return WRAP_FSTAT64 FSTAT64_ARG(_STAT_VER, fd, st); ++} ++#ifdef HAVE_FSTATAT ++int fstatat64(int dir_fd, const char *path, struct stat64 *st, int flags) { ++ return WRAP_FSTATAT64 FSTATAT64_ARG(_STAT_VER, dir_fd, path, st, flags); ++} ++#endif ++#endif ++int mknod(const char *pathname, mode_t mode, dev_t dev) { ++ return WRAP_MKNOD MKNOD_ARG(_STAT_VER, pathname, mode, &dev); ++} ++#ifdef HAVE_FSTATAT ++#ifdef HAVE_MKNODAT ++int mknodat(int dir_fd, const char *pathname, mode_t mode, dev_t dev) { ++ return WRAP_MKNODAT MKNODAT_ARG(_STAT_VER, dir_fd, pathname, mode, &dev); ++} ++#endif ++#endif ++ ++#endif /* __GLIBC_PREPREQ */ ++#endif /* __GLIBC__ */ ++ ++ + #ifdef FAKEROOT_FAKENET + pid_t fork(void) + {