screen: bump to version 4.2.1
PATCH 1/1 screen: bump to version 4.2.1
I re-did the patches: one patch per change, patch configure.in instead of the configure script itself, a few more issues fixed. This should hopefully make the patches acceptable for upstream, or at least make it easier to migrate them on version bumps.
This also fixes compilation with musl libc.
---
Patches have been submitted upstream as well:
https://savannah.gnu.org/bugs/?43222 (0002)
https://savannah.gnu.org/bugs/?43223 (0001,0003-0005)
https://savannah.gnu.org/bugs/?43224 (0006-0009)
https://savannah.gnu.org/bugs/?43225 (0010)
.../screen-0001-compiler-sanity-checks.patch | 60 +++ .../screen/screen-0002-no-memcpy-fallback.patch | 122 +++++ .../screen-0003-cross-compilation-AC_TRY_RUN.patch | 123 +++++ ...een-0004-cross-compilation-ignore-host-fs.patch | 130 +++++ .../screen-0005-avoid-identifying-as-SVR4.patch | 52 ++ .../screen-0006-install-no-backup-binary.patch | 39 ++ .../screen/screen-0007-install-always-chmod.patch | 29 ++ .../screen-0008-install-nonversioned-binary.patch | 31 ++ .../screen-0009-install-dir-dependency.patch | 43 ++ package/screen/screen-0010-rename-sched_h.patch | 142 ++++++ package/screen/screen-cross_compile_fix.patch | 524 --------------------- package/screen/screen-install-fix.patch | 21 - package/screen/screen.mk | 8 +- 13 files changed, 775 insertions(+), 549 deletions(-) create mode 100644 package/screen/screen-0001-compiler-sanity-checks.patch create mode 100644 package/screen/screen-0002-no-memcpy-fallback.patch create mode 100644 package/screen/screen-0003-cross-compilation-AC_TRY_RUN.patch create mode 100644 package/screen/screen-0004-cross-compilation-ignore-host-fs.patch create mode 100644 package/screen/screen-0005-avoid-identifying-as-SVR4.patch create mode 100644 package/screen/screen-0006-install-no-backup-binary.patch create mode 100644 package/screen/screen-0007-install-always-chmod.patch create mode 100644 package/screen/screen-0008-install-nonversioned-binary.patch create mode 100644 package/screen/screen-0009-install-dir-dependency.patch create mode 100644 package/screen/screen-0010-rename-sched_h.patch delete mode 100644 package/screen/screen-cross_compile_fix.patch delete mode 100644 package/screen/screen-install-fix.patch
package/screen/screen-0001-compiler-sanity-checks.patch new file +60 -0
@@ -0,0 +1,60 @@ +From: Maarten ter Huurne <[email protected]> +Date: Sat, 13 Sep 2014 10:27:27 +0200 +Subject: Removed redundant compiler sanity checks + +AC_PROG_CC already performs sanity checks. And unlike the removed +checks, it does so in a way that supports cross compilation. + +Signed-off-by: Maarten ter Huurne <[email protected]> +--- + configure.in | 27 --------------------------- + 1 file changed, 27 deletions(-) + +diff --git a/configure.in b/configure.in +index 87fd43b..572c2a3 100644 +--- a/configure.in ++++ b/configure.in +@@ -47,31 +47,6 @@ AC_PROG_GCC_TRADITIONAL + AC_ISC_POSIX + AC_USE_SYSTEM_EXTENSIONS + +-AC_TRY_RUN(main(){exit(0);},,[ +-if test $CC != cc ; then +-AC_NOTE(Your $CC failed - restarting with CC=cc) +-AC_NOTE() +-CC=cc +-export CC +-exec $0 $configure_args +-fi +-]) +- +-AC_TRY_RUN(main(){exit(0);},, +-exec 5>&2 +-eval $ac_link +-AC_NOTE(CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;) +-AC_NOTE($ac_compile) +-AC_MSG_ERROR(Can't run the compiler - sorry)) +- +-AC_TRY_RUN([ +-main() +-{ +- int __something_strange_(); +- __something_strange_(0); +-} +-],AC_MSG_ERROR(Your compiler does not set the exit status - sorry)) +- + AC_PROG_AWK + + AC_PROG_INSTALL +@@ -1299,8 +1274,6 @@ fi + dnl Ptx bug workaround -- insert -lc after -ltermcap + test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq" + +-AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.)) +- + ETCSCREENRC= + AC_MSG_CHECKING(for the global screenrc file) + AC_ARG_WITH(sys-screenrc, [ --with-sys-screenrc=path to the global screenrc file], [ ETCSCREENRC="${withval}" ]) +-- +1.8.4.5 +
package/screen/screen-0002-no-memcpy-fallback.patch new file +122 -0
122 lines not on this page · raw message
package/screen/screen-0003-cross-compilation-AC_TRY_RUN.patch new file +123 -0
123 lines not on this page · raw message
package/screen/screen-0004-cross-compilation-ignore-host-fs.patch new file +130 -0
130 lines not on this page · raw message
package/screen/screen-0005-avoid-identifying-as-SVR4.patch new file +52 -0
52 lines not on this page · raw message
package/screen/screen-0006-install-no-backup-binary.patch new file +39 -0
@@ -0,0 +1,39 @@ +From: Maarten ter Huurne <[email protected]> +Date: Sun, 14 Sep 2014 23:58:34 +0200 +Subject: Do not create backup of old installed binary + +This is a rather unusual feature that packagers will not expect. + +Signed-off-by: Maarten ter Huurne <[email protected]> +--- + Makefile.in | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index 187a69b..65549e9 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -83,12 +83,9 @@ screen: $(OFILES) + $(OPTIONS) $(CFLAGS) $< + + install_bin: .version screen +- -if [ -f $(DESTDIR)$(bindir)/$(SCREEN) ] && [ ! -f $(DESTDIR)$(bindir)/$(SCREEN).old ]; \ +- then mv $(DESTDIR)$(bindir)/$(SCREEN) $(DESTDIR)$(bindir)/$(SCREEN).old; fi + $(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/$(SCREEN) + -chown root $(DESTDIR)$(bindir)/$(SCREEN) && chmod 4755 $(DESTDIR)$(bindir)/$(SCREEN) + # This doesn't work if $(bindir)/screen is a symlink +- -if [ -f $(DESTDIR)$(bindir)/screen ] && [ ! -f $(DESTDIR)$(bindir)/screen.old ]; then mv $(DESTDIR)$(bindir)/screen $(DESTDIR)$(bindir)/screen.old; fi + rm -f $(DESTDIR)$(bindir)/screen + (cd $(DESTDIR)$(bindir) && ln -f -s $(SCREEN) screen) + cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS) +@@ -113,7 +110,6 @@ installdirs: + uninstall: .version + rm -f $(DESTDIR)$(bindir)/$(SCREEN) + rm -f $(DESTDIR)$(bindir)/screen +- -mv $(DESTDIR)$(bindir)/screen.old $(DESTDIR)$(bindir)/screen + rm -f $(DESTDIR)$(ETCSCREENRC) + cd doc; $(MAKE) uninstall + +-- +1.8.4.5 +
package/screen/screen-0007-install-always-chmod.patch new file +29 -0
@@ -0,0 +1,29 @@ +From: Maarten ter Huurne <[email protected]> +Date: Mon, 15 Sep 2014 00:03:05 +0200 +Subject: Change binary permission flags even if chown fails + +Typically when creating a package, the build is not run as root, so +the chown will fail. But the chmod can still be done. + +Signed-off-by: Maarten ter Huurne <[email protected]> +--- + Makefile.in | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Makefile.in b/Makefile.in +index 65549e9..3c12fdb 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -84,7 +84,8 @@ screen: $(OFILES) + + install_bin: .version screen + $(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/$(SCREEN) +- -chown root $(DESTDIR)$(bindir)/$(SCREEN) && chmod 4755 $(DESTDIR)$(bindir)/$(SCREEN) ++ -chown root $(DESTDIR)$(bindir)/$(SCREEN) ++ -chmod 4755 $(DESTDIR)$(bindir)/$(SCREEN) + # This doesn't work if $(bindir)/screen is a symlink + rm -f $(DESTDIR)$(bindir)/screen + (cd $(DESTDIR)$(bindir) && ln -f -s $(SCREEN) screen) +-- +1.8.4.5 +
package/screen/screen-0008-install-nonversioned-binary.patch new file +31 -0
@@ -0,0 +1,31 @@ +From: Maarten ter Huurne <[email protected]> +Date: Mon, 15 Sep 2014 00:06:20 +0200 +Subject: Support overriding SCREEN to get a non-versioned binary + +If a packager runs "make install SCREEN=screen", do not create +"screen" as a symlink to itself. + +Signed-off-by: Maarten ter Huurne <[email protected]> +--- + Makefile.in | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Makefile.in b/Makefile.in +index 3c12fdb..860f351 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -86,9 +86,11 @@ install_bin: .version screen + $(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/$(SCREEN) + -chown root $(DESTDIR)$(bindir)/$(SCREEN) + -chmod 4755 $(DESTDIR)$(bindir)/$(SCREEN) ++ifneq (${SCREEN},screen) + # This doesn't work if $(bindir)/screen is a symlink + rm -f $(DESTDIR)$(bindir)/screen + (cd $(DESTDIR)$(bindir) && ln -f -s $(SCREEN) screen) ++endif + cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS) + + ############################################################################### +-- +1.8.4.5 +
package/screen/screen-0009-install-dir-dependency.patch new file +43 -0
43 lines not on this page · raw message
package/screen/screen-0010-rename-sched_h.patch new file +142 -0
142 lines not on this page · raw message
package/screen/screen-cross_compile_fix.patch deleted +0 -524
524 lines not on this page · raw message
package/screen/screen-install-fix.patch deleted +0 -21
@@ -1,21 +0,0 @@ -diff -ru screen-4.0.2_vanilla/Makefile.in screen-4.0.2_install-fixup/Makefile.in ---- screen-4.0.2_vanilla/Makefile.in 2003-12-05 13:59:39.000000000 +0000 -+++ screen-4.0.2_install-fixup/Makefile.in 2009-01-03 15:20:22.000000000 +0000 -@@ -71,14 +71,9 @@ - $(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(DEFS) $(OPTIONS) $(CFLAGS) $< - - install_bin: .version screen -- -if [ -f $(DESTDIR)$(bindir)/$(SCREEN) ] && [ ! -f $(DESTDIR)$(bindir)/$(SCREEN).old ]; \ -- then mv $(DESTDIR)$(bindir)/$(SCREEN) $(DESTDIR)$(bindir)/$(SCREEN).old; fi -- $(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/$(SCREEN) -- -chown root $(DESTDIR)$(bindir)/$(SCREEN) && chmod 4755 $(DESTDIR)$(bindir)/$(SCREEN) --# This doesn't work if $(bindir)/screen is a symlink -- -if [ -f $(DESTDIR)$(bindir)/screen ] && [ ! -f $(DESTDIR)$(bindir)/screen.old ]; then mv $(DESTDIR)$(bindir)/screen $(DESTDIR)$(bindir)/screen.old; fi -- rm -f $(DESTDIR)$(bindir)/screen -- (cd $(DESTDIR)$(bindir) && ln -sf $(SCREEN) screen) -+ $(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/screen -+ -chmod 4755 $(DESTDIR)$(bindir)/screen -+ mkdir -p $(DESTDIR)$(SCREENENCODINGS) - cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS) - - ###############################################################################
package/screen/screen.mk +4 -4
@@ -4,13 +4,13 @@ # ################################################################################ -SCREEN_VERSION = 4.0.3 +SCREEN_VERSION = 4.2.1 SCREEN_SITE = $(BR2_GNU_MIRROR)/screen -SCREEN_LICENSE = GPLv2+ +SCREEN_LICENSE = GPLv3+ SCREEN_LICENSE_FILES = COPYING SCREEN_DEPENDENCIES = ncurses -SCREEN_CONF_ENV = ac_cv_header_elf_h=no ac_cv_header_dwarf_h=no \ - CFLAGS="$(TARGET_CFLAGS) -DTERMINFO" +SCREEN_AUTORECONF = YES +SCREEN_CONF_ENV = CFLAGS="$(TARGET_CFLAGS)" SCREEN_MAKE = $(MAKE1) SCREEN_INSTALL_TARGET_OPT = DESTDIR=$(TARGET_DIR) SCREEN=screen install_bin
Signature · 1 line
1.8.4.5
PATCH 1/1 screen: bump to version 4.2.1
Hi,
The Buildroot package of GNU Screen installs the binary as setuid root; both the old (4.0.3) and the new (4.2.1) version do. After having spent some time reading the Screen source code, I wouldn't trust it with root privileges on any system where security is relevant.
I haven't seen (or looked for) any actual code that could be exploited, just a code base that is really old, under-maintained and quite complex from all the workarounds it contains. So it resembles the OpenSSL situation, although it is not quite that bad.
It seems multiuser mode is the feature that requires Screen to be setuid root. Which means that without setuid root, Screen works fine but users can only connect to their own sessions.
I would like some guidance on how to proceed here:
- leave the setuid flag on
- always clear the setuid flag post-install
- make it a configuration option
- ...?
Bye,
Maarten
PATCH 1/1 screen: bump to version 4.2.1
Hi Maarten,
Quoted 5 lines · Maarten ter Huurne
The Buildroot package of GNU Screen installs the binary as setuid root; both the old (4.0.3) and the new (4.2.1) version do. After having spent some time reading the Screen source code, I wouldn't trust it with root privileges on any system where security is relevant.
Quoted 8 lines
I haven't seen (or looked for) any actual code that could be exploited, just a code base that is really old, under-maintained and quite complex from all the workarounds it contains. So it resembles the OpenSSL situation, although it is not quite that bad.
It seems multiuser mode is the feature that requires Screen to be setuid root. Which means that without setuid root, Screen works fine but users can only connect to their own sessions.
Thanks for looking into this.
Quoted 4 lines
I would like some guidance on how to proceed here:
- leave the setuid flag on
- always clear the setuid flag post-install
- make it a configuration option
I vote for this option, defaulting to the current status (i.e. setuid on).
Quoted 1 line
- ...?
baruch
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -PATCH 1/1 screen: bump to version 4.2.1
In reply to Maarten ter HuurneDear Maarten ter Huurne,
Quoted 14 lines · Maarten ter Huurne
The Buildroot package of GNU Screen installs the binary as setuid root; both the old (4.0.3) and the new (4.2.1) version do. After having spent some time reading the Screen source code, I wouldn't trust it with root privileges on any system where security is relevant.
I haven't seen (or looked for) any actual code that could be exploited, just a code base that is really old, under-maintained and quite complex from all the workarounds it contains. So it resembles the OpenSSL situation, although it is not quite that bad.
It seems multiuser mode is the feature that requires Screen to be setuid root. Which means that without setuid root, Screen works fine but users can only connect to their own sessions.
Quoted 5 lines
I would like some guidance on how to proceed here:
- leave the setuid flag on
- always clear the setuid flag post-install
- make it a configuration option
- ...?
I would go for clearing the setuid flag. Interested users can always re-enable it in a post-build script if they really need it.
Thanks for looking into this!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Thomas Petazzoni
AppliedPATCH 1/1 screen: bump to version 4.2.1
In reply to Maarten ter HuurneDear Maarten ter Huurne,
Quoted 7 lines · Maarten ter Huurne
I re-did the patches: one patch per change, patch configure.in instead of the configure script itself, a few more issues fixed. This should hopefully make the patches acceptable for upstream, or at least make it easier to migrate them on version bumps.
This also fixes compilation with musl libc.
Quoted 7 lines
Signed-off-by Maarten ter Huurne <[email protected]>---
Patches have been submitted upstream as well:
https://savannah.gnu.org/bugs/?43222 (0002)
https://savannah.gnu.org/bugs/?43223 (0001,0003-0005)
https://savannah.gnu.org/bugs/?43224 (0006-0009)
https://savannah.gnu.org/bugs/?43225 (0010)
Applied, thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com