Skip to content

Commit

Permalink
add package fakeroot-tcp glibc-wsl obfs4proxy from AUR
Browse files Browse the repository at this point in the history
  • Loading branch information
KenOokamiHoro committed Nov 13, 2017
1 parent 5e3fb75 commit bc58640
Show file tree
Hide file tree
Showing 15 changed files with 1,082 additions and 0 deletions.
53 changes: 53 additions & 0 deletions fakeroot-tcp/PKGBUILD
@@ -0,0 +1,53 @@
# Maintainer: 4679 <admin@libnull.com>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: Jochem Kossen <j.kossen@home.nl>

pkgname=fakeroot-tcp
_pkgname=fakeroot
pkgver=1.21
pkgrel=2
pkgdesc='Tool for simulating superuser privileges,with tcp ipc'

This comment has been minimized.

Copy link
@lilydjwg

lilydjwg Nov 16, 2017

Member

这逗号后边没加空格啊。另外没 conflicts=('fakeroot') 啊。最好注明一下是给 WSL 用的。

This comment has been minimized.

Copy link
@KenOokamiHoro

KenOokamiHoro via email Nov 20, 2017

Member
arch=('i686' 'x86_64' 'armv7h')
license=('GPL')
url="http://packages.debian.org/fakeroot"
groups=('base-devel')
install=fakeroot.install
depends=('glibc' 'filesystem' 'sed' 'util-linux' 'sh')
makedepends=('po4a')
source=(http://ftp.debian.org/debian/pool/main/f/$_pkgname/${_pkgname}_${pkgver}.orig.tar.gz
silence-dlerror.patch)
md5sums=('be5c9a0e516869fca4a6758105968e5a'
'5fba0b541b5af39d804265223fda525c')

prepare() {
cd $_pkgname-$pkgver
patch -p1 -i "$srcdir"/silence-dlerror.patch
}

build() {
cd $_pkgname-$pkgver

./bootstrap
./configure --prefix=/usr \
--libdir=/usr/lib/libfakeroot \
--disable-static \
--with-ipc=tcp

make

cd doc
po4a -k 0 --rm-backups --variable "srcdir=../doc/" po4a/po4a.cfg
}

package() {
cd $_pkgname-$pkgver
make DESTDIR="$pkgdir" install

install -dm755 "$pkgdir"/etc/ld.so.conf.d/
echo '/usr/lib/libfakeroot' > "$pkgdir"/etc/ld.so.conf.d/fakeroot.conf

# install README for sysv/tcp usage
install -Dm644 README "$pkgdir"/usr/share/doc/$_pkgname/README
}

14 changes: 14 additions & 0 deletions fakeroot-tcp/fakeroot.install
@@ -0,0 +1,14 @@
post_install() {
sbin/ldconfig -r .
}

post_upgrade() {
if [ "$(vercmp $2 1.14.4-2)" -lt 0 ]; then
sed -i -e '/\/usr\/lib\/libfakeroot/d' etc/ld.so.conf
fi
sbin/ldconfig -r .
}

pre_remove() {
sbin/ldconfig -r .
}
15 changes: 15 additions & 0 deletions fakeroot-tcp/lilac.py
@@ -0,0 +1,15 @@
#!/usr/bin/env python3
#
# This file is the most simple lilac.py file,
# and it suits for most packages in AUR.
#

from lilaclib import *

build_prefix = 'extra-x86_64'
pre_build = aur_pre_build
post_build = aur_post_build

if __name__ == '__main__':
single_main()

17 changes: 17 additions & 0 deletions fakeroot-tcp/silence-dlerror.patch
@@ -0,0 +1,17 @@
diff --git a/libfakeroot.c b/libfakeroot.c
index f867758..7ef6e47 100644
--- a/libfakeroot.c
+++ b/libfakeroot.c
@@ -256,10 +256,12 @@ void load_library_symbols(void){
/* clear dlerror() just in case dlsym() legitimately returns NULL */
msg = dlerror();
*(next_wrap[i].doit)=dlsym(get_libc(), next_wrap[i].name);
+#ifdef LIBFAKEROOT_DEBUGGING
if ( (msg = dlerror()) != NULL){
fprintf (stderr, "dlsym(%s): %s\n", next_wrap[i].name, msg);
/* abort ();*/
}
+#endif /* LIBFAKEROOT_DEBUGGING */
}
}

@@ -0,0 +1,110 @@
From fc5ad7024c620cdfe9b76e94638aac83b99c5bf8 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Tue, 8 Aug 2017 16:21:58 +0200
Subject: [PATCH] Don't use IFUNC resolver for longjmp or system in libpthread
(bug 21041)

Unlike the vfork forwarder and like the fork forwarder as in bug 19861,
there won't be a problem when the compiler does not turn this into a tail
call.
---
nptl/pt-longjmp.c | 31 ++++++++++---------------------
nptl/pt-system.c | 24 ++++++++----------------
3 files changed, 18 insertions(+), 37 deletions(-)

diff --git a/nptl/pt-longjmp.c b/nptl/pt-longjmp.c
index 2ef757e687f..8f3c6b3a09f 100644
--- a/nptl/pt-longjmp.c
+++ b/nptl/pt-longjmp.c
@@ -25,21 +25,14 @@
symbol in libpthread, but the historical ABI requires it. For static
linking, there is no need to provide anything here--the libc version
will be linked in. For shared library ABI compatibility, there must be
- longjmp and siglongjmp symbols in libpthread.so; so we define them using
- IFUNC to redirect to the libc function. */
+ longjmp and siglongjmp symbols in libpthread.so.

-#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
-
-# if HAVE_IFUNC
-
-# undef INIT_ARCH
-# define INIT_ARCH()
-# define DEFINE_LONGJMP(name) libc_ifunc (name, &__libc_longjmp)
-
-extern __typeof(longjmp) longjmp_ifunc;
-extern __typeof(siglongjmp) siglongjmp_ifunc;
+ With an IFUNC resolver, it would be possible to avoid the indirection,
+ but the IFUNC resolver might run before the __libc_longjmp symbol has
+ been relocated, in which case the IFUNC resolver would not be able to
+ provide the correct address. */

-# else /* !HAVE_IFUNC */
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)

static void __attribute__ ((noreturn, used))
longjmp_compat (jmp_buf env, int val)
@@ -47,14 +40,10 @@ longjmp_compat (jmp_buf env, int val)
__libc_longjmp (env, val);
}

-# define DEFINE_LONGJMP(name) strong_alias (longjmp_compat, name)
-
-# endif /* HAVE_IFUNC */
-
-DEFINE_LONGJMP (longjmp_ifunc)
-compat_symbol (libpthread, longjmp_ifunc, longjmp, GLIBC_2_0);
+strong_alias (longjmp_compat, longjmp_alias)
+compat_symbol (libpthread, longjmp_alias, longjmp, GLIBC_2_0);

-strong_alias (longjmp_ifunc, siglongjmp_ifunc)
-compat_symbol (libpthread, siglongjmp_ifunc, siglongjmp, GLIBC_2_0);
+strong_alias (longjmp_alias, siglongjmp_alias)
+compat_symbol (libpthread, siglongjmp_alias, siglongjmp, GLIBC_2_0);

#endif
diff --git a/nptl/pt-system.c b/nptl/pt-system.c
index f8ca6ba0d94..b30ddf2b398 100644
--- a/nptl/pt-system.c
+++ b/nptl/pt-system.c
@@ -25,29 +25,21 @@
libpthread, but the historical ABI requires it. For static linking,
there is no need to provide anything here--the libc version will be
linked in. For shared library ABI compatibility, there must be a
- 'system' symbol in libpthread.so; so we define it using IFUNC to
- redirect to the libc function. */
+ 'system' symbol in libpthread.so.

-#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
-
-# if HAVE_IFUNC
-
-extern __typeof(system) system_ifunc;
-# undef INIT_ARCH
-# define INIT_ARCH()
-libc_ifunc (system_ifunc, &__libc_system)
+ With an IFUNC resolver, it would be possible to avoid the indirection,
+ but the IFUNC resolver might run before the __libc_system symbol has
+ been relocated, in which case the IFUNC resolver would not be able to
+ provide the correct address. */

-# else /* !HAVE_IFUNC */
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)

static int __attribute__ ((used))
system_compat (const char *line)
{
return __libc_system (line);
}
-strong_alias (system_compat, system_ifunc)
-
-# endif /* HAVE_IFUNC */
-
-compat_symbol (libpthread, system_ifunc, system, GLIBC_2_0);
+strong_alias (system_compat, system_alias)
+compat_symbol (libpthread, system_alias, system, GLIBC_2_0);

#endif
--
2.14.1

171 changes: 171 additions & 0 deletions glibc-wsl/0001-Revert-Assume-prlimit64-is-available.patch
@@ -0,0 +1,171 @@
From e2cfb44540873fc0a566a8a119c550a64a38c319 Mon Sep 17 00:00:00 2001
From: Patrick Stewart <patrick@rfcreations.com>
Date: Thu, 14 Sep 2017 18:26:22 +0100
Subject: [PATCH] Revert "Assume prlimit64 is available."

This reverts commit 695d7d138eda449678a1650a8b8b58181033353f.
---
sysdeps/unix/sysv/linux/getrlimit64.c | 35 ++++++++++++++++++++++++++++++-
sysdeps/unix/sysv/linux/kernel-features.h | 5 +++++
sysdeps/unix/sysv/linux/prlimit.c | 10 +++++++++
sysdeps/unix/sysv/linux/setrlimit.c | 7 ++++++-
sysdeps/unix/sysv/linux/setrlimit64.c | 31 ++++++++++++++++++++++++++-
5 files changed, 85 insertions(+), 3 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/getrlimit64.c b/sysdeps/unix/sysv/linux/getrlimit64.c
index 56af3c0646..37c173286f 100644
--- a/sysdeps/unix/sysv/linux/getrlimit64.c
+++ b/sysdeps/unix/sysv/linux/getrlimit64.c
@@ -35,7 +35,40 @@
int
__getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits)
{
- return INLINE_SYSCALL_CALL (prlimit64, 0, resource, NULL, rlimits);
+#ifdef __NR_prlimit64
+ int res = INLINE_SYSCALL_CALL (prlimit64, 0, resource, NULL, rlimits);
+ if (res == 0 || errno != ENOSYS)
+ return res;
+#endif
+
+/* The fallback code only makes sense if the platform supports either
+ __NR_ugetrlimit and/or __NR_getrlimit. */
+#if defined (__NR_ugetrlimit) || defined (__NR_getrlimit)
+# ifndef __NR_ugetrlimit
+# define __NR_ugetrlimit __NR_getrlimit
+# endif
+# if __RLIM_T_MATCHES_RLIM64_T
+# define rlimits32 (*rlimits)
+# else
+ struct rlimit rlimits32;
+# endif
+
+ if (INLINE_SYSCALL_CALL (ugetrlimit, resource, &rlimits32) < 0)
+ return -1;
+
+# if !__RLIM_T_MATCHES_RLIM64_T
+ if (rlimits32.rlim_cur == RLIM_INFINITY)
+ rlimits->rlim_cur = RLIM64_INFINITY;
+ else
+ rlimits->rlim_cur = rlimits32.rlim_cur;
+ if (rlimits32.rlim_max == RLIM_INFINITY)
+ rlimits->rlim_max = RLIM64_INFINITY;
+ else
+ rlimits->rlim_max = rlimits32.rlim_max;
+# endif /* !__RLIM_T_MATCHES_RLIM64_T */
+#endif /* defined (__NR_ugetrlimit) || defined (__NR_getrlimit) */
+
+ return 0;
}
libc_hidden_def (__getrlimit64)

diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 9495db4fef..38788a75fb 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -81,6 +81,11 @@
/* Support for sendmmsg functionality was added in 3.0. */
#define __ASSUME_SENDMMSG 1

+/* prlimit64 is available in 2.6.36. */
+#if __LINUX_KERNEL_VERSION >= 0x020624
+# define __ASSUME_PRLIMIT64 1
+#endif
+
/* On most architectures, most socket syscalls are supported for all
supported kernel versions, but on some socketcall architectures
separate syscalls were only added later. */
diff --git a/sysdeps/unix/sysv/linux/prlimit.c b/sysdeps/unix/sysv/linux/prlimit.c
index d31980f10c..2996e73b81 100644
--- a/sysdeps/unix/sysv/linux/prlimit.c
+++ b/sysdeps/unix/sysv/linux/prlimit.c
@@ -20,6 +20,7 @@
#include <sys/syscall.h>


+#ifdef __NR_prlimit64
int
prlimit (__pid_t pid, enum __rlimit_resource resource,
const struct rlimit *new_rlimit, struct rlimit *old_rlimit)
@@ -72,3 +73,12 @@ prlimit (__pid_t pid, enum __rlimit_resource resource,

return res;
}
+#else
+int
+prlimit (__pid_t pid, enum __rlimit_resource resource,
+ const struct rlimit *new_rlimit, struct rlimit *old_rlimit)
+{
+ return INLINE_SYSCALL_ERROR_RETURN_VALUE (ENOSYS);
+}
+stub_warning (prlimit)
+#endif
diff --git a/sysdeps/unix/sysv/linux/setrlimit.c b/sysdeps/unix/sysv/linux/setrlimit.c
index 8773c78236..01812ac355 100644
--- a/sysdeps/unix/sysv/linux/setrlimit.c
+++ b/sysdeps/unix/sysv/linux/setrlimit.c
@@ -34,6 +34,7 @@
int
__setrlimit (enum __rlimit_resource resource, const struct rlimit *rlim)
{
+# ifdef __NR_prlimit64
struct rlimit64 rlim64;

if (rlim->rlim_cur == RLIM_INFINITY)
@@ -45,7 +46,11 @@ __setrlimit (enum __rlimit_resource resource, const struct rlimit *rlim)
else
rlim64.rlim_max = rlim->rlim_max;

- return INLINE_SYSCALL_CALL (prlimit64, 0, resource, &rlim64, NULL);
+ int res = INLINE_SYSCALL_CALL (prlimit64, 0, resource, &rlim64, NULL);
+ if (res == 0 || errno != ENOSYS)
+ return res;
+# endif
+ return INLINE_SYSCALL_CALL (setrlimit, resource, rlim);
}

# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
diff --git a/sysdeps/unix/sysv/linux/setrlimit64.c b/sysdeps/unix/sysv/linux/setrlimit64.c
index db1960fc18..2dd129d99e 100644
--- a/sysdeps/unix/sysv/linux/setrlimit64.c
+++ b/sysdeps/unix/sysv/linux/setrlimit64.c
@@ -36,7 +36,36 @@
int
__setrlimit64 (enum __rlimit_resource resource, const struct rlimit64 *rlimits)
{
- return INLINE_SYSCALL_CALL (prlimit64, 0, resource, rlimits, NULL);
+ int res;
+
+#ifdef __NR_prlimit64
+ res = INLINE_SYSCALL_CALL (prlimit64, 0, resource, rlimits, NULL);
+ if (res == 0 || errno != ENOSYS)
+ return res;
+#endif
+
+/* The fallback code only makes sense if the platform supports
+ __NR_setrlimit. */
+#ifdef __NR_setrlimit
+# if !__RLIM_T_MATCHES_RLIM64_T
+ struct rlimit rlimits32;
+
+ if (rlimits->rlim_cur >= RLIM_INFINITY)
+ rlimits32.rlim_cur = RLIM_INFINITY;
+ else
+ rlimits32.rlim_cur = rlimits->rlim_cur;
+ if (rlimits->rlim_max >= RLIM_INFINITY)
+ rlimits32.rlim_max = RLIM_INFINITY;
+ else
+ rlimits32.rlim_max = rlimits->rlim_max;
+# else
+# define rlimits32 (*rlimits)
+# endif
+
+ res = INLINE_SYSCALL_CALL (setrlimit, resource, &rlimits32);
+#endif
+
+ return res;
}
weak_alias (__setrlimit64, setrlimit64)

--
2.14.1

0 comments on commit bc58640

Please sign in to comment.