Bug 494004

Summary: [RHEL 5] fcntl call fails in emulation mode on IA64 when provided with >2GB values in 'struct flock'
Product: Red Hat Enterprise Linux 5 Reporter: Petr Machata <pmachata>
Component: ia32elAssignee: Petr Machata <pmachata>
Status: CLOSED ERRATA QA Contact: BaseOS QE <qe-baseos-auto>
Severity: urgent Docs Contact:
Priority: low    
Version: 5.0CC: azelinka, ebachalo, eric.lin, luming.yu, mnewsome, xiaolan.huang
Target Milestone: rc   
Target Release: ---   
Hardware: ia64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 493341 Environment:
Last Closed: 2009-09-02 09:24:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 493341    
Bug Blocks:    

Description Petr Machata 2009-04-03 17:06:51 UTC
+++ This bug was initially created as a clone of Bug #493341 +++

Description of problem:

Fcntl call fails when "struct flock" fields are filed with >2GB value and program compiled with -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

 I have the following program,

#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>

int main()
{
  unsigned int Bytes;
  struct flock64 lockdes;
  int fd;
  if ( (fd =open("/tmp/test", O_RDWR|O_CREAT|O_EXCL|O_SYNC|O_LARGEFILE)) == -1){
   printf("OPEN Failed %d %s\n",errno,strerror(errno));
  }
  else {
  printf("open PASS :%u %u\n",UINT_MAX,sizeof(lockdes));
    Bytes = UINT_MAX-3-260;
  //lockdes.l_pid = 0;
   lockdes.l_type =  F_WRLCK;
   lockdes.l_whence = SEEK_SET;
   lockdes.l_start = (UINT_MAX-1);
   lockdes.l_len = 1;
   if (fcntl(fd,  F_SETLK64 , &lockdes) == -1) {
   printf("fcntl Failed %d %s\n",errno,strerror(errno));
   }else{
     printf("fcntl PASS\n");
   }
   unlink("/tmp/test");
  }
}


 Compiled using :  gcc  -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -o test test.c  on RHEL4 x86 system

 Executed the problem on RHEL4U7 IA64 system which got emulation layer working. Program fails with the following error,

  open PASS :4294967295 24
fcntl Failed 22 Invalid argument
  
Actual results:


Expected results:
fcntl call should pass

Additional info:

--- Additional comment from dsubram on 2009-04-01 10:30:51 EDT ---

Presently our product is supported on RHEL4U7. We modified the fcntl calls inorder to support a new feature of the product which inturn created this problem. As we are not able to release the product into the market request to consider this issue with high priority.

--- Additional comment from eric.lin on 2009-04-01 19:57:49 EDT ---

Doguparthi, 

our engineer will take a look it and back to you this week.

Eric.

--- Additional comment from xiaolan.huang on 2009-04-01 21:34:33 EDT ---

It's IA-32EL's bug. we will provide the patch soon.

Thanks
Xiaolan

--- Additional comment from dsubram on 2009-04-02 04:01:28 EDT ---

Any estimates on timelines of the fix.

--- Additional comment from xiaolan.huang on 2009-04-02 04:13:10 EDT ---

The fix is under validation now. I think it will be ready this week.

Doguparthi, could you tell the version of ia32-el on RHEL4.7? so that I can prepare a patch for your version.

you can get the version vi following command
/usr/lib/ia32el/ia32x_loader -v

Thanks
Xiaolan

--- Additional comment from dsubram on 2009-04-02 04:21:21 EDT ---

biavm4-4.ind.hp.com:/root # /usr/lib/ia32el/ia32x_loader -v
IA32X Loader:           version=09.release
IA32X Generic   :       version=6,5,6515,0      path=/usr/lib/ia32el/ia32exec.bin
IA32X OS-Wrapper:       version=6.5.100.29.22.release

Won't this problem exists on other versions?

--- Additional comment from xiaolan.huang on 2009-04-02 04:57:35 EDT ---

yes, it does exist in other versions.

--- Additional comment from xiaolan.huang on 2009-04-03 03:08:43 EDT ---

Created an attachment (id=337984)
patch for ia32el btlib linux, v7 (7022to7023)

--- Additional comment from xiaolan.huang on 2009-04-03 03:10:12 EDT ---

Created an attachment (id=337987)
patch for ia32el btlib linux, v6u1(6639to6640)

--- Additional comment from xiaolan.huang on 2009-04-03 03:11:12 EDT ---

Created an attachment (id=337989)
patch for ia32el btlib linux, v6(6100to6101)

--- Additional comment from xiaolan.huang on 2009-04-03 03:15:54 EDT ---

Created an attachment (id=337990)
btlib binary of 6101

Doguparthi,

It's the binary of btlib v6 with the bug fixed. you may download it and update your system.

1. tar -xzf ia32el_btlib_lnx_6101.tgz
2. cd ia32el_btlib_lnx_6101
3. cp ia32x_loader  libia32x.so suid_ia32x_loader /usr/lib/ia32el/

libmme.so hasn't been touched. so it's ok to use the old version.

Please tell me if you have any problem with it.

thanks
Xiaolan

--- Additional comment from dsubram on 2009-04-03 11:26:35 EDT ---

How to identify which version of library to get picked up as a fix for my system?

Whats the delivery mechanism of this for customers? Do you please to release a RPM for all the versions?

--- Additional comment from xiaolan.huang on 2009-04-03 11:37:24 EDT ---

hi Doguparthi,

the first three attachments are ia32el's source level patch for redhat.
you can use the last package to update your system. it's a package of ia32el binaries.

Thanks
Xiaolan

--- Additional comment from xiaolan.huang on 2009-04-03 11:49:58 EDT ---

in fact, ia32el is released with OS. rehdat guys can help to merge the source level patch for next OS release.

The update package(last attachment) is to fix the problem on EL4U7.

If you would like to fix the problem on other platform, please tell me. I will prepare the package for you.

btw, the last package is for ia32el v6. you can identify the version by the command "/usr/lib/ia32el/ia32x_loader -v" and check the version number of IA32X Generic.

v6 :             IA32X Generic   :       version=6,5,*,* 
v6u1:            IA32X Generic   :       version=6,6,*,* 
V7:              IA32X Generic   :       version=7,*,*,*

Comment 1 Petr Machata 2009-04-03 17:08:14 UTC
RHEL4 ships ia32el V6, RHEL5 ships ia32el V7.  Need fixing in both versions.  This bug is for RHEL5.

Comment 2 Petr Machata 2009-04-03 17:09:16 UTC
(Correction: RHEL5 currently ships ia32el V6U1.  It will ship V7 in RHEL5.4.)

Comment 8 errata-xmlrpc 2009-09-02 09:24:43 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-1271.html