- make now restores rlimit to its original values before launching
subprocess (#214033) - this doesn't resolve #214033, it's merely related
This commit is contained in:
parent
ff58089a52
commit
2a3871a1b2
108
make-3.81-rlimit.patch
Normal file
108
make-3.81-rlimit.patch
Normal file
@ -0,0 +1,108 @@
|
||||
diff -Burp make-3.81/job.c make-3.81-pm/job.c
|
||||
--- make-3.81/job.c 2006-11-30 11:00:23.000000000 +0100
|
||||
+++ make-3.81-pm/job.c 2006-11-30 10:58:46.000000000 +0100
|
||||
@@ -2079,6 +2079,9 @@ exec_command (char **argv, char **envp)
|
||||
# else
|
||||
|
||||
/* Run the program. */
|
||||
+#ifdef SET_STACK_SIZE
|
||||
+ restore_original_stack_rlimit ();
|
||||
+#endif
|
||||
environ = envp;
|
||||
execvp (argv[0], argv);
|
||||
|
||||
diff -Burp make-3.81/main.c make-3.81-pm/main.c
|
||||
--- make-3.81/main.c 2006-11-30 11:00:23.000000000 +0100
|
||||
+++ make-3.81-pm/main.c 2006-11-30 10:38:04.000000000 +0100
|
||||
@@ -44,12 +44,51 @@ Foundation, Inc., 51 Franklin St, Fifth
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
|
||||
-#if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT)
|
||||
-# define SET_STACK_SIZE
|
||||
-#endif
|
||||
-
|
||||
#ifdef SET_STACK_SIZE
|
||||
# include <sys/resource.h>
|
||||
+/* Whether the rlimit was set successfuly */
|
||||
+static int setrlimit_succeeded = 0;
|
||||
+/* Original rlim_cur */
|
||||
+static rlim_t setrlimit_orig_cur = 0;
|
||||
+
|
||||
+/* Get rid of any avoidable limit on stack size so that alloca does
|
||||
+ not fail. */
|
||||
+void
|
||||
+set_max_stack_rlimit (void)
|
||||
+{
|
||||
+ struct rlimit rlim;
|
||||
+
|
||||
+ /* Back off if the limit is still set, probably due to failure in
|
||||
+ restore_original_stack_rlimit. */
|
||||
+ if (setrlimit_succeeded)
|
||||
+ return;
|
||||
+
|
||||
+ if (getrlimit (RLIMIT_STACK, &rlim) == 0)
|
||||
+ {
|
||||
+ setrlimit_orig_cur = rlim.rlim_cur;
|
||||
+ rlim.rlim_cur = rlim.rlim_max;
|
||||
+ if (setrlimit (RLIMIT_STACK, &rlim) != -1)
|
||||
+ setrlimit_succeeded = 1;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/* Set the rlimit back to its original value. To be called before
|
||||
+ process spawn. */
|
||||
+void
|
||||
+restore_original_stack_rlimit (void)
|
||||
+{
|
||||
+ struct rlimit rlim;
|
||||
+
|
||||
+ if (!setrlimit_succeeded)
|
||||
+ return;
|
||||
+
|
||||
+ if (getrlimit (RLIMIT_STACK, &rlim) == 0)
|
||||
+ {
|
||||
+ rlim.rlim_cur = setrlimit_orig_cur;
|
||||
+ if (setrlimit (RLIMIT_STACK, &rlim) != -1)
|
||||
+ setrlimit_succeeded = 0;
|
||||
+ }
|
||||
+}
|
||||
#endif
|
||||
|
||||
#ifdef _AMIGA
|
||||
@@ -915,17 +954,7 @@ main (int argc, char **argv, char **envp
|
||||
#endif
|
||||
|
||||
#ifdef SET_STACK_SIZE
|
||||
- /* Get rid of any avoidable limit on stack size. */
|
||||
- {
|
||||
- struct rlimit rlim;
|
||||
-
|
||||
- /* Set the stack limit huge so that alloca does not fail. */
|
||||
- if (getrlimit (RLIMIT_STACK, &rlim) == 0)
|
||||
- {
|
||||
- rlim.rlim_cur = rlim.rlim_max;
|
||||
- setrlimit (RLIMIT_STACK, &rlim);
|
||||
- }
|
||||
- }
|
||||
+ set_max_stack_rlimit ();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ATEXIT
|
||||
diff -Burp make-3.81/make.h make-3.81-pm/make.h
|
||||
--- make-3.81/make.h 2006-11-30 11:00:23.000000000 +0100
|
||||
+++ make-3.81-pm/make.h 2006-11-30 10:29:50.000000000 +0100
|
||||
@@ -346,6 +346,13 @@ extern int strcmpi (const char *,const c
|
||||
#define N_(msgid) gettext_noop (msgid)
|
||||
#define S_(msg1,msg2,num) ngettext (msg1,msg2,num)
|
||||
|
||||
+/* Handle rlimit */
|
||||
+#if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT)
|
||||
+# define SET_STACK_SIZE
|
||||
+void set_max_stack_rlimit (void);
|
||||
+void restore_original_stack_rlimit (void);
|
||||
+#endif
|
||||
+
|
||||
/* Handle other OSs. */
|
||||
#if defined(HAVE_DOS_PATHS)
|
||||
# define PATH_SEPARATOR_CHAR ';'
|
@ -2,7 +2,7 @@ Summary: A GNU tool which simplifies the build process for users.
|
||||
Name: make
|
||||
Epoch: 1
|
||||
Version: 3.81
|
||||
Release: 1.1
|
||||
Release: 2%{?dist}
|
||||
License: GPL
|
||||
Group: Development/Tools
|
||||
URL: http://www.gnu.org/software/make/
|
||||
@ -12,6 +12,7 @@ Patch4: make-3.80-j8k.patch
|
||||
Patch5: make-3.80-getcwd.patch
|
||||
Patch6: make-3.81-err-reporting.patch
|
||||
Patch7: make-3.81-memory.patch
|
||||
Patch8: make-3.81-rlimit.patch
|
||||
Prereq: /sbin/install-info
|
||||
Prefix: %{_prefix}
|
||||
Buildroot: %{_tmppath}/%{name}-root
|
||||
@ -34,6 +35,7 @@ commonly used to simplify the process of installing programs.
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
|
||||
%build
|
||||
config/missing --run aclocal -I config
|
||||
@ -81,6 +83,10 @@ fi
|
||||
%{_infodir}/*.info*
|
||||
|
||||
%changelog
|
||||
* Thu Jan 25 2007 Petr Machata <pmachata@redhat.com> - 1:3.81-2
|
||||
- make now restores rlimit to its original values before launching
|
||||
subprocess (#214033)
|
||||
|
||||
* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 1:3.81-1.1
|
||||
- rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user