Austin Group Defect Tracker

Aardvark Mark IV


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0001237 [1003.1(2016/18)/Issue7+TC2] System Interfaces Objection Error 2019-03-16 09:45 2019-11-14 14:33
Reporter kre View Status public  
Assigned To
Priority normal Resolution Accepted As Marked  
Status Applied  
Name Robert Elz
Organization
User Reference
Section shmat
Page Number 1940
Line Number 62494
Interp Status ---
Final Accepted Text Note: 0004435
Summary 0001237: shmat() specifies use of an undefined operation
Description The parameter shmaddr to the shmat() function is of type void *
and the standard specifies:


  • If shmaddr is not a null pointer and (shmflg &SHM_RND) is non-zero, the segment
    is attached at the address given by (shmaddr -((uintptr_t)shmaddr %SHMLBA)). The
     character '%' is the C-language remainder operator.


Arithmetic on (void *) pointers is undefined,
so no address can be calculated as specified.
Desired Action


Three possible solutions appear reasonable.



Pick one:



  1. In line 62494 in page 1940 change the wording
    from:

    at the address given by (shmaddr -((uintptr_t)shmaddr %SHMLBA)).

    to:

    at the address given by (void *)((uintptr_t)shmaddr -((uintptr_t)shmaddr %SHMLBA
    )).

  2. In line 62494 in page 1940 change the wording
    from:

    at the address given by (shmaddr -((uintptr_t)shmaddr %SHMLBA)).

    to:

    at the address given by (void *)((char *)shmaddr -((uintptr_t)shmaddr %SHMLBA)).

  3. Delete all of pages 1940 to 1947 (inclusive).


Tags tc3-2008
Attached Files

- Relationships
related to 0001238Applied shmat() used the word "it" with an ambiguous antecedent 
related to 0001239Applied shmat() specifies non-portable return value 
related to 0001240Applied shmctl(IPC_RMID) relationship with attached shared memory segments is not specified 

-  Notes
(0004328)
geoffclare (manager)
2019-03-18 09:57

In XPG3 shmaddr had type char *, so adding a (char *) cast as in option 2 is the change that should have been made when shmaddr was changed to void * in XPG4.

The additional (void *) cast is unnecessary, as there is no problem with "the address given by" being followed by an expression of type char *.
(0004329)
kre (reporter)
2019-03-18 10:39

That(Note: 0004328) is fine.
(0004435)
geoffclare (manager)
2019-06-20 11:01
edited on: 2019-06-20 15:37

Suggested change:

In line 62494 in page 1940 change:
at the address given by (shmaddr -((uintptr_t)shmaddr %SHMLBA)).
to:
at the address given by ((char *)shmaddr - ((uintptr_t)shmaddr % SHMLBA)).



- Issue History
Date Modified Username Field Change
2019-03-16 09:45 kre New Issue
2019-03-16 09:45 kre Name => Robert Elz
2019-03-16 09:45 kre Section => shmat
2019-03-16 09:45 kre Page Number => 1940
2019-03-16 09:45 kre Line Number => 62494
2019-03-18 09:57 geoffclare Note Added: 0004328
2019-03-18 10:39 kre Note Added: 0004329
2019-06-20 11:01 geoffclare Note Added: 0004435
2019-06-20 11:02 geoffclare Note Edited: 0004435
2019-06-20 15:37 geoffclare Note Edited: 0004435
2019-06-20 15:38 geoffclare Interp Status => ---
2019-06-20 15:38 geoffclare Final Accepted Text => Note: 0004435
2019-06-20 15:38 geoffclare Status New => Resolved
2019-06-20 15:38 geoffclare Resolution Open => Accepted As Marked
2019-06-20 15:38 geoffclare Tag Attached: tc3-2008
2019-06-24 15:37 eblake Relationship added related to 0001240
2019-06-24 15:38 eblake Relationship added related to 0001238
2019-06-24 15:38 eblake Relationship added related to 0001239
2019-11-14 14:33 geoffclare Status Resolved => Applied


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker