diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-03-24 08:45:09 +0000 | 
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-03-24 08:45:09 +0000 | 
| commit | 97a901308cf7ee854f2a187669dd1dba847a4a8b (patch) | |
| tree | cf670a10ed95a50a80e7fc96b9762b490e1cc4e0 | |
| parent | 670a36699a5fcfe0e35f368b3ecf00910fd95a9b (diff) | |
automatic import of nosyncopeneuler20.03
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | 4.patch | 67 | ||||
| -rw-r--r-- | nosync.spec | 43 | ||||
| -rw-r--r-- | sources | 1 | 
4 files changed, 112 insertions, 0 deletions
@@ -0,0 +1 @@ +/nosync-1.1.tar.gz @@ -0,0 +1,67 @@ +From 9497a56f7158339b56421b932760851feb39e5ad Mon Sep 17 00:00:00 2001 +From: Florian Weimer <fweimer@redhat.com> +Date: Wed, 20 May 2020 19:38:35 +0200 +Subject: [PATCH] open, open64: Eliminate dependency on ELF constructor + ordering + +Another shared object may call open or open64 before the nosync +ELF constructor has run. Relocation dependencies do not factor +into ELF constructor ordering. +--- + open.c | 33 ++++++++++++++++----------------- + 1 file changed, 16 insertions(+), 17 deletions(-) + +diff --git a/open.c b/open.c +index 89c896d..f96f542 100644 +--- a/open.c ++++ b/open.c +@@ -17,33 +17,32 @@ + #include <dlfcn.h> + #include <errno.h> + #include <fcntl.h> ++#include <stddef.h> + #include <sys/stat.h> + #include <sys/types.h> +  ++/* Avoid infinite recursion if called from dlsym(). The implementation ++   assumes that open is called before the process goes multi-threaded. */ + static int dlsym_pending; +  + #define OPEN(open)                                              \ +                                                                 \ +-static int (*real_ ## open)(const char *, int, ...);            \ +-                                                                \ + int __nosync_ ## open(const char *path, int flags, mode_t mode) \ + {                                                               \ +-  /* Avoid infinite recursion if called from dlsym(). */        \ +-  if (__builtin_expect(dlsym_pending, 0)) {                     \ +-    errno = ENOSYS;                                             \ +-    return -1;                                                  \ ++  static int (*real)(const char *, int, ...);                   \ ++  int (*real_copy)(const char *, int, ...)                      \ ++    = __atomic_load_n(&real, __ATOMIC_RELAXED);                 \ ++  if (real_copy == NULL) {                                      \ ++    if (dlsym_pending) {                                        \ ++      errno = ENOSYS;                                           \ ++      return -1;                                                \ ++    }                                                           \ ++    dlsym_pending = 1;                                          \ ++    real_copy = dlsym(RTLD_NEXT, #open);                        \ ++    dlsym_pending = 0;                                          \ ++    __atomic_store_n(&real, real_copy, __ATOMIC_RELAXED);       \ +   }                                                             \ +-                                                                \ +-  return real_ ## open(path, flags & ~(O_SYNC | O_DSYNC), mode);  \ +-}                                                               \ +-                                                                \ +-__attribute__((constructor))                                    \ +-static void                                                     \ +-init_ ## open(void)                                             \ +-{                                                               \ +-  dlsym_pending = 1;                                            \ +-  real_ ## open = dlsym(RTLD_NEXT, #open);                      \ +-  dlsym_pending = 0;                                            \ ++  return real_copy(path, flags & ~(O_SYNC | O_DSYNC), mode);    \ + }                                                               \ +                                                                 \ + int open(const char *, int, ...)                                \ diff --git a/nosync.spec b/nosync.spec new file mode 100644 index 0000000..36299bf --- /dev/null +++ b/nosync.spec @@ -0,0 +1,43 @@ +Name:           nosync +Version:        1.1 +Release:        1 +Summary:        Preload library for disabling file's content synchronization +License:        ASL 2.0 +URL:            http://github.com/kjn/%{name} +Source0:        http://github.com/kjn/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz + +# Eliminate dependency on ELF constructor ordering +# Solves segfaults during buildroot population in mock with nosync +# enabled for builds with openssl +# "FIPS module installed state definition is modified" changes +# https://bugzilla.redhat.com/show_bug.cgi?id=1837809 +# https://github.com/kjn/nosync/pull/4 +Patch0:         4.patch + +BuildRequires:  make +BuildRequires:  gcc + +%description +nosync is a small preload library that can be used to disable +synchronization of file's content with storage devices on GNU/Linux. +It works by overriding implementations of certain standard functions +like fsync or open. + +%prep +%autosetup -p1 + +%build +make CFLAGS="%{optflags}" %{?_smp_mflags} + +%install +%makeinstall + +%files +%doc AUTHORS README.md +%{!?_licensedir:%global license %%doc} +%license LICENSE NOTICE +%{_libdir}/%{name} + +%changelog +* Fri Mar 24 2023 lichaoran <pkwarcraft@hotmail.com> - 1.1-1 +- Initial packaging @@ -0,0 +1 @@ +6b49297ef2f953bbcc8c8ce71b57e609  nosync-1.1.tar.gz  | 
