public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* IPC_STAT on ia64
@ 2004-05-04  9:34 ARADHYA, CHINMAYA TM (STSD)
  2004-05-04 15:07 ` n0ano
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ARADHYA, CHINMAYA TM (STSD) @ 2004-05-04  9:34 UTC (permalink / raw)
  To: linux-ia64

hello,

I noticed that when a 32bit application running on a ia64 system 
makes a shmctl call  with IPC_STAT flag junk data will be filled 
in the shmid_ds structure.
This is on the kernel version - 2.4.18-e.12smp

Sample program to reproduce the problem:

#include <stdio.h>
#include <errno.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/types.h>
#define errmsg(s,no) { printf("*** %s - %s ***\n",s,strerror(no)); 
exit(1); }
#define FTOK_FILENAME "/sbin"
#define PRJ_NO 419
int main()
{
        key_t shmkey;
        int shmid;
        char *shmt=NULL;
        struct shmid_ds shdata;
        if ((shmkey = ftok(FTOK_FILENAME,PRJ_NO)) = -1)
                errmsg("ftok error",errno);
        if ((shmid = shmget(shmkey,1048700,IPC_CREAT|IPC_EXCL|0666)) 
= -1)
                errmsg("shmget error",errno);
        if((shmt=(char*)shmat(shmid,NULL,0)) = -1)
                errmsg("shmat error", errno);
        if(shmctl(shmid,IPC_STAT,&shdata) = 0)
        {
                printf("=Shared mem size=%d=\n",shdata.shm_segsz);
        }
        shmdt(shmt);
        shmctl(shmid,IPC_RMID,0);
}
  
Actual results:
=Shared mem size=1073832704=
Expected results:
=Shared mem size=1048700=


Could anybody tell me how to go about addressing this problem.

TIA
Chinmaya 
 

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

* Re: IPC_STAT on ia64
  2004-05-04  9:34 IPC_STAT on ia64 ARADHYA, CHINMAYA TM (STSD)
@ 2004-05-04 15:07 ` n0ano
  2004-05-04 15:22 ` Bjorn Helgaas
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: n0ano @ 2004-05-04 15:07 UTC (permalink / raw)
  To: linux-ia64

This is a little surprising.  In `arch/ia64/ia32/sys_ia32.c' there is a
routine `shmctl32' that is supposed to solve this problem.  It shouldn't
be too hard to find out where the bug is, there is an `IPC_STAT' case
that is supposed to deal with this.

On Tue, May 04, 2004 at 02:52:35PM +0530, ARADHYA, CHINMAYA TM (STSD) wrote:
> hello,
> 
> I noticed that when a 32bit application running on a ia64 system 
> makes a shmctl call  with IPC_STAT flag junk data will be filled 
> in the shmid_ds structure.
> This is on the kernel version - 2.4.18-e.12smp
> 
> Sample program to reproduce the problem:
> 
> #include <stdio.h>
> #include <errno.h>
> #include <sys/ipc.h>
> #include <sys/shm.h>
> #include <sys/types.h>
> #define errmsg(s,no) { printf("*** %s - %s ***\n",s,strerror(no)); 
> exit(1); }
> #define FTOK_FILENAME "/sbin"
> #define PRJ_NO 419
> int main()
> {
>         key_t shmkey;
>         int shmid;
>         char *shmt=NULL;
>         struct shmid_ds shdata;
>         if ((shmkey = ftok(FTOK_FILENAME,PRJ_NO)) = -1)
>                 errmsg("ftok error",errno);
>         if ((shmid = shmget(shmkey,1048700,IPC_CREAT|IPC_EXCL|0666)) 
> = -1)
>                 errmsg("shmget error",errno);
>         if((shmt=(char*)shmat(shmid,NULL,0)) = -1)
>                 errmsg("shmat error", errno);
>         if(shmctl(shmid,IPC_STAT,&shdata) = 0)
>         {
>                 printf("=Shared mem size=%d=\n",shdata.shm_segsz);
>         }
>         shmdt(shmt);
>         shmctl(shmid,IPC_RMID,0);
> }
>   
> Actual results:
> =Shared mem size=1073832704=
> Expected results:
> =Shared mem size=1048700=
> 
> 
> Could anybody tell me how to go about addressing this problem.
> 
> TIA
> Chinmaya 
>  
> -
> To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Don Dugger
"Censeo Toto nos in Kansa esse decisse." - D. Gale
n0ano@n0ano.com
Ph: 303/447-2201

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

* Re: IPC_STAT on ia64
  2004-05-04  9:34 IPC_STAT on ia64 ARADHYA, CHINMAYA TM (STSD)
  2004-05-04 15:07 ` n0ano
@ 2004-05-04 15:22 ` Bjorn Helgaas
  2004-05-04 15:36 ` Matthew Wilcox
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2004-05-04 15:22 UTC (permalink / raw)
  To: linux-ia64

On Tuesday 04 May 2004 3:22 am, ARADHYA, CHINMAYA TM (STSD) wrote:
> I noticed that when a 32bit application running on a ia64 system 
> makes a shmctl call  with IPC_STAT flag junk data will be filled 
> in the shmid_ds structure.
> This is on the kernel version - 2.4.18-e.12smp

2.4.18 was released almost two years ago.  There were some
shmctl(IPC_STAT) changes in 2.4.21.  Can you run your test
on a current kernel (linux-2.4.25-ia64-040218 (yes, I need to
get the 2.4.26 patch out)) and see whether it's still broken?

Bjorn

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

* Re: IPC_STAT on ia64
  2004-05-04  9:34 IPC_STAT on ia64 ARADHYA, CHINMAYA TM (STSD)
  2004-05-04 15:07 ` n0ano
  2004-05-04 15:22 ` Bjorn Helgaas
@ 2004-05-04 15:36 ` Matthew Wilcox
  2004-05-04 15:45 ` ARADHYA, CHINMAYA TM (STSD)
  2004-05-04 19:01 ` Jason Baron
  4 siblings, 0 replies; 6+ messages in thread
From: Matthew Wilcox @ 2004-05-04 15:36 UTC (permalink / raw)
  To: linux-ia64

On Tue, May 04, 2004 at 02:52:35PM +0530, ARADHYA, CHINMAYA TM (STSD) wrote:
> Actual results:
> =Shared mem size=1073832704=
> Expected results:
> =Shared mem size=1048700=

It gives the expected result on 2.6.5-pa3

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

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

* RE: IPC_STAT on ia64
  2004-05-04  9:34 IPC_STAT on ia64 ARADHYA, CHINMAYA TM (STSD)
                   ` (2 preceding siblings ...)
  2004-05-04 15:36 ` Matthew Wilcox
@ 2004-05-04 15:45 ` ARADHYA, CHINMAYA TM (STSD)
  2004-05-04 19:01 ` Jason Baron
  4 siblings, 0 replies; 6+ messages in thread
From: ARADHYA, CHINMAYA TM (STSD) @ 2004-05-04 15:45 UTC (permalink / raw)
  To: linux-ia64

I ran the test on Kernel ver 2.4.21, The behaviour was sane.

There were indeed some IPC_STAT related issues fixed in this
version. 

>>>>>>>
2.4.21 Fixes

* IA32 emulation:
    .
    .
    .
    - fix shmctl(IPC_STAT) (Arun Sharma).
>>>>>>>>

thx
Chinmaya


>>-----Original Message-----
>>From: Helgaas, Bjorn 
>>Sent: Tuesday, May 04, 2004 8:53 PM
>>To: ARADHYA, CHINMAYA TM (STSD)
>>Cc: Linux-Ia64 (E-mail)
>>Subject: Re: IPC_STAT on ia64
>>
>>
>>On Tuesday 04 May 2004 3:22 am, ARADHYA, CHINMAYA TM (STSD) wrote:
>>> I noticed that when a 32bit application running on a ia64 system 
>>> makes a shmctl call  with IPC_STAT flag junk data will be filled 
>>> in the shmid_ds structure.
>>> This is on the kernel version - 2.4.18-e.12smp
>>
>>2.4.18 was released almost two years ago.  There were some
>>shmctl(IPC_STAT) changes in 2.4.21.  Can you run your test
>>on a current kernel (linux-2.4.25-ia64-040218 (yes, I need to
>>get the 2.4.26 patch out)) and see whether it's still broken?
>>
>>Bjorn
>>

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

* RE: IPC_STAT on ia64
  2004-05-04  9:34 IPC_STAT on ia64 ARADHYA, CHINMAYA TM (STSD)
                   ` (3 preceding siblings ...)
  2004-05-04 15:45 ` ARADHYA, CHINMAYA TM (STSD)
@ 2004-05-04 19:01 ` Jason Baron
  4 siblings, 0 replies; 6+ messages in thread
From: Jason Baron @ 2004-05-04 19:01 UTC (permalink / raw)
  To: linux-ia64


On Tue, 4 May 2004, ARADHYA, CHINMAYA TM (STSD) wrote:

> I ran the test on Kernel ver 2.4.21, The behaviour was sane.
> 
> There were indeed some IPC_STAT related issues fixed in this
> version. 
> 
> >>>>>>>
> 2.4.21 Fixes
> 
> * IA32 emulation:
>     .
>     .
>     .
>     - fix shmctl(IPC_STAT) (Arun Sharma).
> >>>>>>>>
> 
> thx
> Chinmaya

This has been fixed for quite some time in RHEL 2.1 as well.  2.4.18-e.43
is the current kernel version, while 2.4.18-e.12, was the original kernel
version from 2 years ago.

-Jason




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

end of thread, other threads:[~2004-05-04 19:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-04  9:34 IPC_STAT on ia64 ARADHYA, CHINMAYA TM (STSD)
2004-05-04 15:07 ` n0ano
2004-05-04 15:22 ` Bjorn Helgaas
2004-05-04 15:36 ` Matthew Wilcox
2004-05-04 15:45 ` ARADHYA, CHINMAYA TM (STSD)
2004-05-04 19:01 ` Jason Baron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox