Bug 695703

Summary: SIGILL received on s390x when mmap from 0x80000000
Product: Red Hat Enterprise Linux 6 Reporter: Caspar Zhang <czhang>
Component: kernelAssignee: Hendrik Brueckner <brueckner>
Status: CLOSED NOTABUG QA Contact: Caspar Zhang <czhang>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: liwan, qcai
Target Milestone: rc   
Target Release: ---   
Hardware: s390x   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-28 15:59:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 767187, 846704    

Description Caspar Zhang 2011-04-12 13:26:43 UTC
Description of problem:

when executing hugemmap02 testcase from LTP, it failed on s390x. After investigating, seems mmap from 0x80000000 always causes SIGILL so that the test fails. 

It happens on both RHEL5.6 and RHEL6GA and also latest RHEL6.1. The SIGILL is not documented in man mmap(2).

Here is a simple reproducer:

#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/mman.h>

int main()
{
	int nfildes;
	unsigned long *addr;

	nfildes = open("/dev/zero", O_RDONLY, 0666);

	addr = mmap((void *)0x80000000, getpagesize(), PROT_READ, MAP_SHARED | MAP_FIXED, nfildes, 0);
	if (addr == MAP_FAILED)
		return 1;

	return 0;
}

Comment 2 RHEL Program Management 2012-05-03 04:53:46 UTC
Since RHEL 6.3 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 3 Hendrik Brueckner 2013-02-28 15:59:45 UTC
Hi,

your test program will not work because the program text segment will be loaded at address 0x80000000.  The mmap() with MAP_FIXED flag enforces the mapping of /dev/zero in the specified address and, thus, overriding the program's text segment with zeros.

I suggest that you change your test case and use a different address or remove the MAP_FIXED flag to let mmap() assign you an address.

Thanks and kind regars,
Hendrik

Comment 4 Carlos O'Donell 2015-10-09 17:22:37 UTC
*** Bug 1270205 has been marked as a duplicate of this bug. ***