public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* ld randomly assigns wrong user and group IDs to executable
@ 2016-04-22 18:08 Andrew Schulman
  2016-04-22 19:28 ` Andrew Schulman
  2016-04-26 19:46 ` Andrew Schulman
  0 siblings, 2 replies; 4+ messages in thread
From: Andrew Schulman @ 2016-04-22 18:08 UTC (permalink / raw)
  To: cygwin

This is a strange one.

cygwin 2.5.1-1
binutils 2.25-4

Lately my attempt to build fish keeps failing, and I've traced it to the
following problem:

During configure, a particular c++ program compiles fine, but the generated
executable has the wrong user and group IDs and permissions, so the
configure test fails and my build fails.

Here are the source files and generated executable:

$ ls -l conftest*
-rw-r--r--  1 ASchulma     Domain Users   1911 Apr 22 13:11 conftest.cpp
-rw-r--r--  1 ASchulma     Domain Users    466 Apr 22 13:11 conftest.err
-rwxr-x---  1 Unknown+User Unknown+Group 62152 Apr 22 13:11 conftest.exe

$ ls -ln conftest.exe
-rwxr-x--- 1 4294967295 4294967295 62152 Apr 22 13:11 conftest.exe

Note the strange, apparently random user and group ID numbers for
conftest.exe.

* This happens about half the time. The other half of the time, the user
and group IDs are mine and so the build succeeds.  I haven't been able to
figure out when it will fail.

* The user and group IDs are always the same, 4294967295, when the problem
happens.

* It only happens with this one program - other tests in configure work
fine.

* When I compile the program on my own, outside of configure, it builds
fine, two compiler warnings aside.

An excerpt of config.log is below.

What could be causing this?  Is it a problem with ld, or with Cygwin?

Thanks,
Andrew

----------
config.log
----------

configure:5219: checking if struct winsize and TIOCGWINSZ exist
configure:5246: g++ -o conftest.exe -ggdb -O2 -pipe
-fdebug-prefix-map=/home/ASchulma/dev/cygwin/fish/fish-2.3b1-1.x86_64/build=/usr/src/debug/fish-2.3b1-1
-fdebug-prefix-map=/home/ASchulma/dev/cygwin/fish/fish-2.3b1-1.x86_64/src/fish-2.3b1=/usr/src/debug/fish-2.3b1-1
-D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -fno-exceptions -Wall
-Wno-sign-compare   conftest.cpp -lintl -lncurses  >&5
conftest.cpp: In function 'int main()':
conftest.cpp:80:19: warning: statement has no effect [-Wunused-value]
         TIOCGWINSZ;
                   ^
conftest.cpp:79:24: warning: unused variable 'termsize' [-Wunused-variable]
         struct winsize termsize = {0};
                        ^
/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/../../../../x86_64-pc-cygwin/bin/ld:
cannot open output file conftest.exe: Permission denied
collect2: error: ld returned 1 exit status
configure:5246: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "fish"
| #define PACKAGE_TARNAME "fish"
| #define PACKAGE_VERSION "2.3b1"
| #define PACKAGE_STRING "fish 2.3b1"
| #define PACKAGE_BUGREPORT "fish-users@lists.sourceforge.net"
| #define PACKAGE_URL ""
| #define USE_GETTEXT 1
| #define HAVE__PROC_SELF_STAT 1
| #define HAVE_TRANSLATE_H 1
| #define NCURSES_NOMACROS 1
| #define NOMACROS 1
| #define HAVE_NAN 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_GETOPT_H 1
| #define HAVE_TERMIOS_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_TERM_H 1
| #define HAVE_NCURSES_TERM_H 1
| #define HAVE_NCURSES_H 1
| #define HAVE_NCURSES_CURSES_H 1
| #define HAVE_CURSES_H 1
| #define HAVE_SYS_SELECT_H 1
| #define HAVE_SYS_IOCTL_H 1
| #define HAVE_SPAWN_H 1
| #define HAVE_LIBINTL_H 1
| #define SIZEOF_WCHAR_T 2
| #define WCHAR_T_BITS 16
| #define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1
| #define HAVE_DIRENT_H 1
| #define HAVE_STRUCT_DIRENT_D_TYPE 1
| #define HAVE_WCSDUP 1
| #define HAVE_WCSLEN 1
| #define HAVE_WCSCASECMP 1
| #define HAVE_WCSNCASECMP 1
| #define HAVE_FWPRINTF 1
| #define HAVE_FUTIMES 1
| #define HAVE_WCWIDTH 1
| #define HAVE_WCSWIDTH 1
| #define HAVE_WCSTOK 1
| #define HAVE_FPUTWC 1
| #define HAVE_FGETWC 1
| #define HAVE_WCSTOL 1
| #define HAVE_WCSLCAT 1
| #define HAVE_WCSLCPY 1
| #define HAVE_KILLPG 1
| #define HAVE_MKOSTEMP 1
| #define HAVE_SYSCONF 1
| #define HAVE_GETIFADDRS 1
| #define HAVE_FUTIMENS 1
| #define HAVE_CLOCK_GETTIME 1
| #define HAVE_GETTEXT 1
| #define HAVE_DCGETTEXT 1
| #define HAVE_REALPATH_NULL 1
| /* end confdefs.h.  */
|
|
|         #ifdef HAVE_TERMIOS_H
|         #include <termios.h>
|         #endif
|
|         #ifdef HAVE_SYS_IOCTL_H
|         #include <sys/ioctl.h>
|         #endif
|
| int
| main ()
| {
|
|         struct winsize termsize = {0};
|         TIOCGWINSZ;
|
|
|   ;
|   return 0;
| }
|
configure:5256: result: no


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ld randomly assigns wrong user and group IDs to executable
  2016-04-22 18:08 ld randomly assigns wrong user and group IDs to executable Andrew Schulman
@ 2016-04-22 19:28 ` Andrew Schulman
  2016-04-26 19:46 ` Andrew Schulman
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Schulman @ 2016-04-22 19:28 UTC (permalink / raw)
  To: cygwin

> During configure, a particular c++ program compiles fine, but the generated
> executable has the wrong user and group IDs and permissions, so the
> configure test fails and my build fails.
> 
> Here are the source files and generated executable:
> 
> $ ls -l conftest*
> -rw-r--r--  1 ASchulma     Domain Users   1911 Apr 22 13:11 conftest.cpp
> -rw-r--r--  1 ASchulma     Domain Users    466 Apr 22 13:11 conftest.err
> -rwxr-x---  1 Unknown+User Unknown+Group 62152 Apr 22 13:11 conftest.exe
> 
> $ ls -ln conftest.exe
> -rwxr-x--- 1 4294967295 4294967295 62152 Apr 22 13:11 conftest.exe
> 
> Note the strange, apparently random user and group ID numbers for
> conftest.exe.
> 
> * This happens about half the time. The other half of the time, the user
> and group IDs are mine and so the build succeeds.  I haven't been able to
> figure out when it will fail.
> 
> * The user and group IDs are always the same, 4294967295, when the problem
> happens.
> 
> * It only happens with this one program - other tests in configure work
> fine.
> 
> * When I compile the program on my own, outside of configure, it builds
> fine, two compiler warnings aside.

A few more notes:

* As Sergio Gomez points out, the ID 4294967295 isn't random but is 2^32-1.

* Configure is now starting to fail on other tests, in exactly the same
way: by generating an executable with those IDs that I then can't read,
causing the test to fail.  Again it seems to be random which test fails and
when.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ld randomly assigns wrong user and group IDs to executable
  2016-04-22 18:08 ld randomly assigns wrong user and group IDs to executable Andrew Schulman
  2016-04-22 19:28 ` Andrew Schulman
@ 2016-04-26 19:46 ` Andrew Schulman
  2016-04-26 19:50   ` Achim Gratz
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Schulman @ 2016-04-26 19:46 UTC (permalink / raw)
  To: cygwin

> During configure, a particular c++ program compiles fine, but the generated
> executable has the wrong user and group IDs and permissions, so the
> configure test fails and my build fails.

Seems to be a BLODA problem. The problem is inconsistent/intermittent, and
happens only on one of my three Windows hosts. The bad machine has
Symtantec Endpoint Protection running (I can't disable it), and
CYGWIN=detect_bloda also finds C:\windows\system32\privman64.dll, the
"BeyondTrust Power Broker for Windows DLL". Seems a likely suspect.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ld randomly assigns wrong user and group IDs to executable
  2016-04-26 19:46 ` Andrew Schulman
@ 2016-04-26 19:50   ` Achim Gratz
  0 siblings, 0 replies; 4+ messages in thread
From: Achim Gratz @ 2016-04-26 19:50 UTC (permalink / raw)
  To: cygwin

Andrew Schulman writes:
> Seems to be a BLODA problem. The problem is inconsistent/intermittent, and
> happens only on one of my three Windows hosts. The bad machine has
> Symtantec Endpoint Protection running (I can't disable it), and
> CYGWIN=detect_bloda also finds C:\windows\system32\privman64.dll, the
> "BeyondTrust Power Broker for Windows DLL". Seems a likely suspect.

Endpoint protection places a DLL at the very end of the Cygwin rebase
area in my experience.  Look at /proc/self/maps and "rebase -si" if it's
consistent and what Cygwin library gets rebased there.  You might want
to change the rebase area dow to some lower address (you could edit it
in /usr/bin/rebaselst and trigger a full rebase as an experiment).


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Waldorf MIDI Implementation & additional documentation:
http://Synth.Stromeko.net/Downloads.html#WaldorfDocs

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-26 19:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-22 18:08 ld randomly assigns wrong user and group IDs to executable Andrew Schulman
2016-04-22 19:28 ` Andrew Schulman
2016-04-26 19:46 ` Andrew Schulman
2016-04-26 19:50   ` Achim Gratz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).