a4023d0c37
- Fix patch tty-ask-password-agent-on-console.patch not to crash away but enable it to ask on all devices of /dev/console - Avoid "file not found /etc/udev/rules.d/70-persistent-net.rules" waring occurring in %post - Add patch let-vconsole-setup-get-properties-only-once-to-copy-them.patch to avoid broken virtual console mapping due stressed ioctl API for the virtual consoles (boo#904214) - Fix last change that is use the new name for udev packages in %pretrans. - restore usage of LUA in %pretrans. - Try to generate the systemd users and groups always in same order to avoid republish other packages (boo#944660) - cleanup specfile by removing commands that were dealing with systemd pre-generated files: we're now using systemd tarball generated directly from the git repo which doesn't contain any of these files. - there's no point in using LUA in %pretrans - Drop 0009-make-xsltproc-use-correct-ROFF-links.patch This patch was initialy added to workaround bsc#842844. But it appears that man(1) was fixed (included since 13.2 at least) to handle manual pages that consist only of a .so directive such as '.so <page>'. - Change use-rndaddentropy-ioctl-to-load-random-seed.patch to make it work on big endian OBS-URL: https://build.opensuse.org/request/show/333777 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=223
139 lines
5.3 KiB
Diff
139 lines
5.3 KiB
Diff
From: werner@suse.de
|
|
Upstream: marked as openSUSE-specific fix originally, but may well
|
|
worth be to be sent upstream.
|
|
|
|
Original description:
|
|
(none)
|
|
|
|
Notes [jengelh@inai.de]:
|
|
MAP_NONBLOCK is documented (mmap(2) in man-pages-3.69+) to render
|
|
MAP_POPULATE ineffective. Why do we have it?
|
|
What is the rationale for MAP_STACK?
|
|
---
|
|
src/journal/catalog.c | 12 +++++++++++-
|
|
src/journal/journal-authenticate.c | 7 +++++--
|
|
src/journal/journald-kmsg.c | 3 ++-
|
|
src/journal/mmap-cache.c | 16 +++++++++++++++-
|
|
4 files changed, 33 insertions(+), 5 deletions(-)
|
|
|
|
Index: systemd-221/src/journal/catalog.c
|
|
===================================================================
|
|
--- systemd-221.orig/src/journal/catalog.c
|
|
+++ systemd-221/src/journal/catalog.c
|
|
@@ -469,6 +469,10 @@ finish:
|
|
|
|
static int open_mmap(const char *database, int *_fd, struct stat *_st, void **_p) {
|
|
const CatalogHeader *h;
|
|
+ static const unsigned int advice[] =
|
|
+ {MADV_WILLNEED, MADV_SEQUENTIAL, MADV_DONTDUMP, MADV_DONTFORK};
|
|
+ unsigned int n;
|
|
+ size_t psize;
|
|
int fd;
|
|
void *p;
|
|
struct stat st;
|
|
@@ -491,12 +495,18 @@ static int open_mmap(const char *databas
|
|
return -EINVAL;
|
|
}
|
|
|
|
- p = mmap(NULL, PAGE_ALIGN(st.st_size), PROT_READ, MAP_SHARED, fd, 0);
|
|
+ psize = PAGE_ALIGN(st.st_size);
|
|
+ p = mmap(NULL, psize, PROT_READ, MAP_SHARED | MAP_POPULATE |
|
|
+ MAP_NONBLOCK, fd, 0);
|
|
if (p == MAP_FAILED) {
|
|
safe_close(fd);
|
|
return -errno;
|
|
}
|
|
|
|
+ for (n = 0; n < sizeof(advice) / sizeof(*advice); ++n)
|
|
+ if (madvise(p, psize, advice[n]) < 0)
|
|
+ log_warning("Failed to give advice about use of memory: %m");
|
|
+
|
|
h = p;
|
|
if (memcmp(h->signature, CATALOG_SIGNATURE, sizeof(h->signature)) != 0 ||
|
|
le64toh(h->header_size) < sizeof(CatalogHeader) ||
|
|
Index: systemd-221/src/journal/journal-authenticate.c
|
|
===================================================================
|
|
--- systemd-221.orig/src/journal/journal-authenticate.c
|
|
+++ systemd-221/src/journal/journal-authenticate.c
|
|
@@ -355,7 +355,8 @@ int journal_file_fss_load(JournalFile *f
|
|
goto finish;
|
|
}
|
|
|
|
- m = mmap(NULL, PAGE_ALIGN(sizeof(FSSHeader)), PROT_READ, MAP_SHARED, fd, 0);
|
|
+ m = mmap(NULL, PAGE_ALIGN(sizeof(FSSHeader)), PROT_READ,
|
|
+ MAP_SHARED | MAP_STACK, fd, 0);
|
|
if (m == MAP_FAILED) {
|
|
m = NULL;
|
|
r = -errno;
|
|
@@ -399,7 +400,9 @@ int journal_file_fss_load(JournalFile *f
|
|
goto finish;
|
|
}
|
|
|
|
- f->fss_file = mmap(NULL, PAGE_ALIGN(f->fss_file_size), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
|
|
+ f->fss_file = mmap(NULL, PAGE_ALIGN(f->fss_file_size),
|
|
+ PROT_READ | PROT_WRITE, MAP_SHARED | MAP_STACK,
|
|
+ fd, 0);
|
|
if (f->fss_file == MAP_FAILED) {
|
|
f->fss_file = NULL;
|
|
r = -errno;
|
|
Index: systemd-221/src/journal/journald-kmsg.c
|
|
===================================================================
|
|
--- systemd-221.orig/src/journal/journald-kmsg.c
|
|
+++ systemd-221/src/journal/journald-kmsg.c
|
|
@@ -454,7 +454,8 @@ int server_open_kernel_seqnum(Server *s)
|
|
return 0;
|
|
}
|
|
|
|
- p = mmap(NULL, sizeof(uint64_t), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
|
|
+ p = mmap(NULL, sizeof(uint64_t), PROT_READ | PROT_WRITE,
|
|
+ MAP_SHARED | MAP_STACK, fd, 0);
|
|
if (p == MAP_FAILED) {
|
|
log_error_errno(errno, "Failed to map sequential number file, ignoring: %m");
|
|
return 0;
|
|
Index: systemd-221/src/journal/mmap-cache.c
|
|
===================================================================
|
|
--- systemd-221.orig/src/journal/mmap-cache.c
|
|
+++ systemd-221/src/journal/mmap-cache.c
|
|
@@ -466,11 +466,14 @@ static int add_mmap(
|
|
struct stat *st,
|
|
void **ret) {
|
|
|
|
+ static const unsigned int advice[] =
|
|
+ {MADV_WILLNEED, MADV_SEQUENTIAL, MADV_DONTDUMP, MADV_DONTFORK};
|
|
uint64_t woffset, wsize;
|
|
Context *c;
|
|
FileDescriptor *f;
|
|
Window *w;
|
|
void *d;
|
|
+ unsigned int n;
|
|
int r;
|
|
|
|
assert(m);
|
|
@@ -509,7 +512,8 @@ static int add_mmap(
|
|
}
|
|
|
|
for (;;) {
|
|
- d = mmap(NULL, wsize, prot, MAP_SHARED, fd, woffset);
|
|
+ d = mmap(NULL, wsize, prot, MAP_SHARED | MAP_POPULATE |
|
|
+ MAP_NONBLOCK, fd, woffset);
|
|
if (d != MAP_FAILED)
|
|
break;
|
|
if (errno != ENOMEM)
|
|
@@ -522,6 +526,16 @@ static int add_mmap(
|
|
return -ENOMEM;
|
|
}
|
|
|
|
+ for (n = 0; n < sizeof(advice) / sizeof(*advice); ++n) {
|
|
+ if (advice[n] == MADV_DONTFORK) {
|
|
+ int flags = fcntl(fd, F_GETFD);
|
|
+ if (flags < 0 || !(flags & FD_CLOEXEC))
|
|
+ continue;
|
|
+ }
|
|
+ if (madvise(d, wsize, advice[n]) < 0)
|
|
+ log_warning("Failed to give advice about use of memory: %m");
|
|
+ }
|
|
+
|
|
c = context_add(m, context);
|
|
if (!c)
|
|
goto outofmem;
|