Skip to content

Commit

Permalink
Rebase against 314368e6c442f043ebfc22b70c1113e4e6232c04.
Browse files Browse the repository at this point in the history
  • Loading branch information
zfigura committed Sep 4, 2020
1 parent 285e594 commit 1d149ff
Show file tree
Hide file tree
Showing 21 changed files with 872 additions and 826 deletions.
@@ -1,4 +1,4 @@
From 83309ce4174bf56eef86e516221290b8d88bdc27 Mon Sep 17 00:00:00 2001
From 9e66f8a5f7579f0e7ef97ab4df66f91d8d8c0949 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 1 Jun 2017 06:04:53 +0200
Subject: [PATCH] ntdll: Fix holes in ELF mappings. (v2)
Expand All @@ -10,10 +10,10 @@ Based on a patch by Andrew Wesie.
2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index cdc8e1189b3..1f73e72a952 100644
index 253d5e31e3d..c518a4f8141 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -968,6 +968,16 @@ static inline BOOL is_write_watch_range( const void *addr, size_t size )
@@ -1014,6 +1014,16 @@ static inline BOOL is_write_watch_range( const void *addr, size_t size )
}


Expand All @@ -30,7 +30,7 @@ index cdc8e1189b3..1f73e72a952 100644
/***********************************************************************
* find_view_range
*
@@ -2966,6 +2976,19 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack )
@@ -2985,6 +2995,19 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack )
/* ignore fault if page is writable now */
if (get_unix_prot( get_page_vprot( page ) ) & PROT_WRITE) ret = STATUS_SUCCESS;
}
Expand All @@ -42,7 +42,7 @@ index cdc8e1189b3..1f73e72a952 100644
+ mprotect_range( page, page_size, 0, 0 );
+ if (!mincore( page, page_size, &vec ) && (vec & 1))
+ ret = STATUS_SUCCESS;
+ else if (wine_anon_mmap( page, page_size, unix_prot, MAP_FIXED ) == page)
+ else if (anon_mmap_fixed( page, page_size, unix_prot, 0 ) == page)
+ ret = STATUS_SUCCESS;
+ else
+ set_page_vprot_bits( page, page_size, 0, VPROT_READ | VPROT_EXEC );
Expand All @@ -51,7 +51,7 @@ index cdc8e1189b3..1f73e72a952 100644
return ret;
}
diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
index eb52fc690cf..178f5605a23 100644
index d85099455aa..be12af58311 100644
--- a/dlls/psapi/tests/psapi_main.c
+++ b/dlls/psapi/tests/psapi_main.c
@@ -195,6 +195,7 @@ todo_wine
Expand Down Expand Up @@ -86,5 +86,5 @@ index eb52fc690cf..178f5605a23 100644

static BOOL check_with_margin(SIZE_T perf, SIZE_T sysperf, int margin)
--
2.27.0
2.28.0

@@ -1,31 +1,27 @@
From f96ab0203c4119942b9d8ccc27207cc73389b375 Mon Sep 17 00:00:00 2001
From 80247bc4566977f67a1851f46facba226fbd93df Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Tue, 19 Aug 2014 22:10:49 -0600
Subject: [PATCH] ntdll: Implement retrieving DOS attributes in
[fd_]get_file_info().

---
configure.ac | 12 +++++++++++
dlls/ntdll/unix/file.c | 22 ++++++++++++++++++-
include/wine/port.h | 9 ++++++++
libs/port/Makefile.in | 3 ++-
libs/port/xattr.c | 49 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 93 insertions(+), 2 deletions(-)
create mode 100644 libs/port/xattr.c
configure.ac | 12 ++++++++++++
dlls/ntdll/unix/file.c | 39 ++++++++++++++++++++++++++++++++++++++-
2 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 4829648c3a5..cff2d4b8288 100644
index f60cd593549..cca97ee403b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,6 +88,7 @@ AC_ARG_WITH(usb, AS_HELP_STRING([--without-usb],[do not use the libusb lib
@@ -89,6 +89,7 @@ AC_ARG_WITH(usb, AS_HELP_STRING([--without-usb],[do not use the libusb lib
AC_ARG_WITH(v4l2, AS_HELP_STRING([--without-v4l2],[do not use v4l2 (video capture)]))
AC_ARG_WITH(vkd3d, AS_HELP_STRING([--without-vkd3d],[do not use vkd3d (Direct3D 12 support)]))
AC_ARG_WITH(vulkan, AS_HELP_STRING([--without-vulkan],[do not use Vulkan]))
+AC_ARG_WITH(xattr, AS_HELP_STRING([--without-xattr],[do not use xattr (security attributes support)]))
AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]),
[if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi])
AC_ARG_WITH(xcursor, AS_HELP_STRING([--without-xcursor],[do not use the Xcursor extension]),
@@ -697,6 +698,17 @@ AC_CHECK_HEADERS([libprocstat.h],,,
@@ -698,6 +699,17 @@ AC_CHECK_HEADERS([libprocstat.h],,,
#include <sys/socket.h>
#endif])

Expand All @@ -44,10 +40,41 @@ index 4829648c3a5..cff2d4b8288 100644

AC_SUBST(DLLFLAGS,"-D_REENTRANT")
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index bf435f109f1..6ac9b18da57 100644
index 03e92a5c59e..da8f65af7b3 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1448,6 +1448,22 @@ static BOOL append_entry( struct dir_data *data, const char *long_name,
@@ -105,6 +105,9 @@
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
+#ifdef HAVE_ATTR_XATTR_H
+#include <attr/xattr.h>
+#endif
#include <time.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
@@ -369,6 +372,20 @@ NTSTATUS errno_to_status( int err )
}
}

+#ifndef XATTR_USER_PREFIX
+#define XATTR_USER_PREFIX "user."
+#endif
+
+static int xattr_get( const char *path, const char *name, void *value, size_t size )
+{
+#if defined(HAVE_ATTR_XATTR_H)
+ return getxattr( path, name, value, size );
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
/* get space from the current directory data buffer, allocating a new one if necessary */
static void *get_dir_data_space( struct dir_data *data, unsigned int size )
{
@@ -1448,6 +1465,22 @@ static BOOL append_entry( struct dir_data *data, const char *long_name,
}


Expand All @@ -70,7 +97,7 @@ index bf435f109f1..6ac9b18da57 100644
/* fetch the attributes of a file */
static inline ULONG get_file_attributes( const struct stat *st )
{
@@ -1491,7 +1507,8 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON
@@ -1491,7 +1524,8 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON
static int get_file_info( const char *path, struct stat *st, ULONG *attr )
{
char *parent_path;
Expand All @@ -80,7 +107,7 @@ index bf435f109f1..6ac9b18da57 100644

*attr = 0;
ret = lstat( path, st );
@@ -1517,6 +1534,9 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
@@ -1517,6 +1551,9 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
free( parent_path );
}
*attr |= get_file_attributes( st );
Expand All @@ -90,92 +117,6 @@ index bf435f109f1..6ac9b18da57 100644
return ret;
}

diff --git a/include/wine/port.h b/include/wine/port.h
index 928730a41d7..4670891ae77 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -352,6 +352,15 @@ int usleep (unsigned int useconds);

extern int mkstemps(char *template, int suffix_len);

+/* Extended attribute functions */
+
+#ifndef XATTR_USER_PREFIX
+# define XATTR_USER_PREFIX "user."
+#endif
+
+extern int xattr_fget( int filedes, const char *name, void *value, size_t size );
+extern int xattr_get( const char *path, const char *name, void *value, size_t size );
+
#else /* NO_LIBWINE_PORT */

#define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in
index 7bc67fa3fee..d1de285d527 100644
--- a/libs/port/Makefile.in
+++ b/libs/port/Makefile.in
@@ -21,4 +21,5 @@ C_SRCS = \
strnlen.c \
symlink.c \
usleep.c \
- wctype.c
+ wctype.c \
+ xattr.c
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
new file mode 100644
index 00000000000..88e900dac6d
--- /dev/null
+++ b/libs/port/xattr.c
@@ -0,0 +1,49 @@
+/*
+ * extended attributes functions
+ *
+ * Copyright 2014 Erich E. Hoover
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#if defined(HAVE_ATTR_XATTR_H)
+# include <attr/xattr.h>
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+
+int xattr_fget( int filedes, const char *name, void *value, size_t size )
+{
+#if defined(HAVE_ATTR_XATTR_H)
+ return fgetxattr( filedes, name, value, size );
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+int xattr_get( const char *path, const char *name, void *value, size_t size )
+{
+#if defined(HAVE_ATTR_XATTR_H)
+ return getxattr( path, name, value, size );
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
--
2.27.0
2.28.0

0 comments on commit 1d149ff

Please sign in to comment.