This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Help needed with libsigsegv2.10-2 + cygwin 2.4.1-1 + win7


Hi all

Why the following test code works fluently in Linux and cygwin 1.5.
But with cygwin 2.4.1 it gives a segmentation fault, when running "x =
mem[filePageSize];"


--- Process 101084, exception c0000005 at 0040132E
--- Process 101084 thread 101312 exited with status 0xc0000005
--- Process 101084 thread 101336 exited with status 0xc0000005
--- Process 101084 thread 99348 exited with status 0xc0000005
--- Process 101084 exited with status 0xc0000005

Thank you in advance.
br. ari kumpumÃki

the used test code:l

#include <stdlib.h>
#include <sigsegv.h>
#include <stdio.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>

#define ALIGN_TO_PAGE_SIZE(x) (((x + filePageSize - 1) / filePageSize) *
filePageSize)

static volatile int count=0;
static volatile int filePageSize;

static void sigsegv_handler(void *failedAddress, unsigned x)
{
	(void) x;
	unsigned pageAddr = ((unsigned) failedAddress & ~(filePageSize - 1));
    mprotect((void *) pageAddr, filePageSize, PROT_WRITE | PROT_READ);
	count++;
}

void init(void)
{
	if (sigsegv_install_handler((sigsegv_handler_t) & sigsegv_handler) <
0)
    {
        fprintf(stderr, "ERROR: installing sigsegv handler failed\n ");
        exit(-1);
    }

    filePageSize = sysconf(_SC_PAGESIZE);
 }
char *allocMem(int size)
{
  return (char *) mmap(0, ALIGN_TO_PAGE_SIZE(size), PROT_NONE,
MAP_SHARED | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
}




void main(void)
{
	init();
	char *mem = allocMem(filePageSize * 2);
	char x;
	if(mem)
	{
		x = mem[0];
		printf("%d\n", x);
		x = mem[filePageSize];
		printf("%d\n", x);
	}
	
}




the installed packages:
Cygwin Package Information
Package                   Version            Status
_autorebase               001003-2           OK
alternatives              1.3.30c-10         OK
autobuild                 5.3-1              OK
autoconf                  13-1               OK
autoconf2.1               2.13-12            OK
autoconf2.5               2.69-3             OK
autogen                   5.18.4-1           OK
automake                  9-1                OK
automake1.10              1.10.3-2           OK
automake1.11              1.11.6-2           OK
automake1.12              1.12.6-2           OK
automake1.13              1.13.4-1           OK
automake1.14              1.14.1-2           OK
automake1.15              1.15-1             OK
automake1.4               1.4p6-11           OK
automake1.5               1.5-11             OK
automake1.6               1.6.3-12           OK
automake1.7               1.7.9-11           OK
automake1.8               1.8.5-11           OK
automake1.9               1.9.6-11           OK
base-cygwin               3.8-1              OK
base-files                4.2-4              OK
bash                      4.3.42-4           OK
bashdb                    3.1_0.09-1         OK
binutils                  2.25-4             OK
byacc                     20150711-1         OK
bzip2                     1.0.6-2            OK
ca-certificates           2.6-1              OK
cmake                     3.3.2-1            OK
coreutils                 8.25-1             OK
crypt                     1.3-1              OK
csih                      0.9.9-1            OK
cygrunsrv                 1.62-1             OK
cygutils                  1.4.15-2           OK
cygwin                    2.4.1-1            OK
cygwin-devel              2.4.1-1            Incomplete
dash                      0.5.8-3            OK
desktop-file-utils        0.22-2             OK
diffutils                 3.3-3              OK
editrights                1.03-1             OK
file                      5.25-1             OK
findutils                 4.6.0-1            OK
gamin                     0.1.10-15          OK
gawk                      4.1.3-1            OK
gcc-cilkplus              5.3.0-3            OK
gcc-core                  5.3.0-3            OK
gcc-g++                   5.3.0-3            OK
gdb                       7.10.1-1           OK
getent                    2.18.90-4          OK
gettext                   0.19.5.1-2         OK
gettext-devel             0.19.5.1-2         OK
git                       2.7.4-1            OK
grep                      2.24-1             OK
groff                     1.22.3-1           OK
gsettings-desktop-schemas 3.18.1-1           OK
gzip                      1.6-1              OK
hostname                  3.13-1             OK
indent                    2.2.11-1           OK
info                      6.1-2              OK
intltool                  0.51.0-1           OK
ipc-utils                 1.0-1              OK
less                      481-1              OK
libarchive13              3.1.2-3            OK
libargp                   20110921-2         OK
libatomic1                5.3.0-3            OK
libattr1                  2.4.46-1           OK
libblkid1                 2.25.2-2           OK
libbz2_1                  1.0.6-2            OK
libcharset1               1.14-3             OK
libcilkrts5               5.3.0-3            OK
libcloog-isl4             0.18.0-2           OK
libcom_err2               1.42.12-2          OK
libcroco0.6_3             0.6.9-1            OK
libcurl4                  7.47.1-1           OK
libdb4.8                  4.8.30-1           OK
libedit0                  20130712-1         OK
libelf0                   0.8.13-2           OK
libelf0-devel             0.8.13-2           OK
libexpat1                 2.1.1-1            OK
libfam0                   0.1.10-15          OK
libffi6                   3.2.1-1            OK
libgcc1                   5.3.0-3            OK
libgdbm4                  1.8.3-20           OK
libglib2.0-devel          2.46.2-3           OK
libglib2.0_0              2.46.2-3           OK
libgmp10                  6.1.0-3p1          OK
libgomp1                  5.3.0-3            OK
libgssapi_krb5_2          1.13.2-4           OK
libguile17                1.8.8-1            OK
libiconv                  1.14-3             OK
libiconv-devel            1.14-3             OK
libiconv2                 1.14-3             OK
libidn11                  1.29-1             OK
libintl-devel             0.19.5.1-2         OK
libintl8                  0.19.5.1-2         OK
libisl10                  0.11.1-2           OK
libisl13                  0.14.1-1           OK
libk5crypto3              1.13.2-4           OK
libkrb5_3                 1.13.2-4           OK
libkrb5support0           1.13.2-4           OK
liblrzip0                 0.621-1            OK
libltdl7                  2.4.6-3            OK
liblzma5                  5.2.2-1            OK
liblzo2_2                 2.08-1             OK
libmpc3                   1.0.3-1            OK
libmpfr4                  3.1.4-1            OK
libncursesw10             6.0-4.20160305     OK
libnettle4                2.7.1-1            OK
libnghttp2_14             1.7.1-1            OK
libopenldap2_4_2          2.4.42-1           OK
libopenssl100             1.0.2g-3           OK
libopts-devel             5.18.4-1           OK
libopts25                 5.18.4-1           OK
libp11-kit0               0.22.1-1           OK
libpcre-devel             8.38-2             OK
libpcre1                  8.38-2             OK
libpcre16_0               8.38-2             OK
libpcre32_0               8.38-2             OK
libpcrecpp0               8.38-2             OK
libpcreposix0             8.38-2             OK
libpipeline1              1.4.0-1            OK
libpsl5                   0.12.0-1           OK
libquadmath0              5.3.0-3            OK
libreadline-devel         6.3.8-1            OK
libreadline7              6.3.8-1            OK
libsasl2_3                2.1.26-9           OK
libsigsegv-devel          2.10-2             OK
libsigsegv2               2.10-2             OK
libsmartcols1             2.25.2-2           OK
libsqlite3_0              3.11.1-1           OK
libssh2_1                 1.7.0-1            OK
libssp0                   5.3.0-3            OK
libstdc++6                5.3.0-3            OK
libtasn1_6                4.7-1              OK
libtool                   2.4.6-3            OK
libunistring2             0.9.6-1            OK
libuuid-devel             2.25.2-2           OK
libuuid1                  2.25.2-2           OK
libvtv0                   5.3.0-3            OK
libxml2                   2.9.3-1            OK
libzip                    0.11.2-2           OK
libzip-devel              0.11.2-2           OK
libzip2                   0.11.2-2           OK
libzzip-devel             0.13.62-1          OK
libzzip0.13               0.13.62-1          OK
login                     1.11-1             OK
lynx                      2.8.7-1            OK
lz4                       131-1              OK
lzip                      1.17-1             OK
m4                        1.4.17-2           OK
make                      4.1-1              OK
man-db                    2.7.4-1            OK
mintty                    2.2.3-0            OK
ncurses                   6.0-4.20160305     OK
openssh                   7.2p2-1            OK
openssl                   1.0.2g-3           OK
p11-kit                   0.22.1-1           OK
p11-kit-trust             0.22.1-1           OK
p7zip                     15.09-2            OK
perl                      5.22.1-2           OK
perl-Carp                 1.38-1             OK
perl-Encode-Locale        1.05-1             OK
perl-Error                0.17024-1          OK
perl-File-Listing         6.04-5             OK
perl-HTML-Parser          3.72-1             OK
perl-HTML-Tagset          3.20-5             OK
perl-HTTP-Cookies         6.01-5             OK
perl-HTTP-Daemon          6.01-5             OK
perl-HTTP-Date            6.02-5             OK
perl-HTTP-Message         6.11-1             OK
perl-HTTP-Negotiate       6.01-5             OK
perl-IO-HTML              1.001-2            OK
perl-libwww-perl          6.15-1             OK
perl-LWP-MediaTypes       6.02-5             OK
perl-Net-HTTP             6.09-1             OK
perl-Pod-Simple           3.32-1             OK
perl-TermReadKey          2.33-1             OK
perl-Unicode-Normalize    1.25-1             OK
perl-URI                  1.71-1             OK
perl-WWW-RobotRules       6.02-5             OK
perl-XML-Parser           2.44-2             OK
perl_autorebase           5.22.1-2           OK
perl_base                 5.22.1-2           OK
pkg-config                0.29-1             OK
popt                      1.16-1             OK
python                    2.7.10-1           OK
python3                   3.4.3-1            OK
rebase                    4.4.2-1            OK
rsync                     3.1.2-1            OK
run                       1.3.4-2            OK
sed                       4.2.2-3            OK
shared-mime-info          1.6-3              OK
tar                       1.28-1             OK
terminfo                  6.0-4.20160305     OK
texinfo                   6.1-2              OK
tzcode                    2016b-1            OK
unzip                     6.0-15             OK
util-linux                2.25.2-2           OK
vim-minimal               7.4.1558-1         OK
w32api-headers            4.0.4-1            OK
w32api-runtime            4.0.4-1            OK
which                     2.20-2             OK
windows-default-manifest  6.4-1              OK
xz                        5.2.2-1            OK
yasm                      1.3.0-1            OK
zip                       3.0-12             OK
zlib-devel                1.2.8-3            OK
zlib0                     1.2.8-3            OK


--
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]