public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/25810] New: x32: Incorrect syscall entries with pointer, off_t and size_t
@ 2020-04-10 10:55 hjl.tools at gmail dot com
  2020-04-10 13:28 ` [Bug libc/25810] " hjl.tools at gmail dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2020-04-10 10:55 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=25810

            Bug ID: 25810
           Summary: x32: Incorrect syscall entries with pointer, off_t and
                    size_t
           Product: glibc
           Version: 2.32
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---
            Target: x86-64

These system calls:

       int mprotect(void *addr, size_t len, int prot);
       void *mmap(void *addr, size_t length, int prot, int flags,
                  int fd, off_t offset);
       int munmap(void *addr, size_t length);

take both void *, off_t and size_t.  Since they are mapped to LP64 syscalls
for x32, they need special conversions as x32 has 32-bit pointers and size_t
with 64-bit off_t:

[hjl@gnu-cfl-2 pr94541]$ cat x.c
#include <stdlib.h>
#include <sys/mman.h>

struct Array
{
  size_t length;
  void *ptr;
};

struct Array
allocate(size_t bytes)
{
  if (!bytes)
    return __extension__ (struct Array) {0, 0};

  void *p = mmap(0x0, bytes, PROT_READ | PROT_WRITE,
                 MAP_PRIVATE | MAP_ANON, -1, 0);
  if (p == MAP_FAILED)
    return __extension__ (struct Array) {0, 0};

  return __extension__ (struct Array) {bytes, p};
}

void
deallocate(struct Array b)
{
  if (b.length)
    {
      if (munmap(b.ptr, b.length))
        abort ();
    }
}

int main()
{
  struct Array array = allocate(1);
  deallocate(array);
  return 0;
}
[hjl@gnu-cfl-2 pr94541]$ gcc -O2 -mx32 x.c
[hjl@gnu-cfl-2 pr94541]$ ./a.out 
Aborted (core dumped)
[hjl@gnu-cfl-2 pr94541]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/25810] x32: Incorrect syscall entries with pointer, off_t and size_t
  2020-04-10 10:55 [Bug libc/25810] New: x32: Incorrect syscall entries with pointer, off_t and size_t hjl.tools at gmail dot com
@ 2020-04-10 13:28 ` hjl.tools at gmail dot com
  2020-04-10 16:04 ` hjl.tools at gmail dot com
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2020-04-10 13:28 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=25810

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
Also

       int pkey_mprotect(void *addr, size_t len, int prot, int pkey);
       void *mremap(void *old_address, size_t old_size,
                    size_t new_size, int flags, ... /* void *new_address */);
       int msync(void *addr, size_t length, int flags);
       int mincore(void *addr, size_t length, unsigned char *vec);
       int madvise(void *addr, size_t length, int advice);
       ssize_t read(int fd, void *buf, size_t count);
       ssize_t write(int fd, const void *buf, size_t count);
       int shmget(key_t key, size_t size, int shmflg);
       ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
       int semop(int semid, struct sembuf *sops, size_t nsops);
       int semtimedop(int semid, struct sembuf *sops, size_t nsops,
                      const struct timespec *timeout);
       int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg);
       ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp,
                      int msgflg);
       int mlock(const void *addr, size_t len);
       int mlock2(const void *addr, size_t len, int flags);
       int munlock(const void *addr, size_t len);
       int remap_file_pages(void *addr, size_t size, int prot,
                            size_t pgoff, int flags);
       int semop(int semid, struct sembuf *sops, size_t nsops);
       int semtimedop(int semid, struct sembuf *sops, size_t nsops,
                      const struct timespec *timeout);
       ssize_t copy_file_range(int fd_in, loff_t *off_in,
                               int fd_out, loff_t *off_out,
                               size_t len, unsigned int flags);

All size_t arguments must be zero-extended to 64bit.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/25810] x32: Incorrect syscall entries with pointer, off_t and size_t
  2020-04-10 10:55 [Bug libc/25810] New: x32: Incorrect syscall entries with pointer, off_t and size_t hjl.tools at gmail dot com
  2020-04-10 13:28 ` [Bug libc/25810] " hjl.tools at gmail dot com
@ 2020-04-10 16:04 ` hjl.tools at gmail dot com
  2020-04-10 16:38 ` hjl.tools at gmail dot com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2020-04-10 16:04 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=25810

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
       int mount(const char *source, const char *target,
                 const char *filesystemtype, unsigned long mountflags,
                 const void *data);

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/25810] x32: Incorrect syscall entries with pointer, off_t and size_t
  2020-04-10 10:55 [Bug libc/25810] New: x32: Incorrect syscall entries with pointer, off_t and size_t hjl.tools at gmail dot com
  2020-04-10 13:28 ` [Bug libc/25810] " hjl.tools at gmail dot com
  2020-04-10 16:04 ` hjl.tools at gmail dot com
@ 2020-04-10 16:38 ` hjl.tools at gmail dot com
  2020-04-10 16:44 ` hjl.tools at gmail dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2020-04-10 16:38 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=25810

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
       ssize_t getrandom(void *buf, size_t buflen, unsigned int flags);

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/25810] x32: Incorrect syscall entries with pointer, off_t and size_t
  2020-04-10 10:55 [Bug libc/25810] New: x32: Incorrect syscall entries with pointer, off_t and size_t hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2020-04-10 16:38 ` hjl.tools at gmail dot com
@ 2020-04-10 16:44 ` hjl.tools at gmail dot com
  2020-04-10 16:46 ` hjl.tools at gmail dot com
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2020-04-10 16:44 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=25810

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
       ssize_t readahead(int fd, off64_t offset, size_t count);

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/25810] x32: Incorrect syscall entries with pointer, off_t and size_t
  2020-04-10 10:55 [Bug libc/25810] New: x32: Incorrect syscall entries with pointer, off_t and size_t hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2020-04-10 16:44 ` hjl.tools at gmail dot com
@ 2020-04-10 16:46 ` hjl.tools at gmail dot com
  2020-04-10 16:51 ` hjl.tools at gmail dot com
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2020-04-10 16:46 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=25810

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
       int sched_setaffinity(pid_t pid, size_t cpusetsize,
                             const cpu_set_t *mask);

       int sched_getaffinity(pid_t pid, size_t cpusetsize,
                             cpu_set_t *mask);

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/25810] x32: Incorrect syscall entries with pointer, off_t and size_t
  2020-04-10 10:55 [Bug libc/25810] New: x32: Incorrect syscall entries with pointer, off_t and size_t hjl.tools at gmail dot com
                   ` (4 preceding siblings ...)
  2020-04-10 16:46 ` hjl.tools at gmail dot com
@ 2020-04-10 16:51 ` hjl.tools at gmail dot com
  2020-04-10 17:02 ` hjl.tools at gmail dot com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2020-04-10 16:51 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=25810

--- Comment #6 from H.J. Lu <hjl.tools at gmail dot com> ---
       ssize_t pread(int fd, void *buf, size_t count, off_t offset);
       ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/25810] x32: Incorrect syscall entries with pointer, off_t and size_t
  2020-04-10 10:55 [Bug libc/25810] New: x32: Incorrect syscall entries with pointer, off_t and size_t hjl.tools at gmail dot com
                   ` (5 preceding siblings ...)
  2020-04-10 16:51 ` hjl.tools at gmail dot com
@ 2020-04-10 17:02 ` hjl.tools at gmail dot com
  2020-04-10 17:15 ` hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2020-04-10 17:02 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=25810

--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
       ssize_t recv(int sockfd, void *buf, size_t len, int flags);
       ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags,
                        struct sockaddr *src_addr, socklen_t *addrlen);
       ssize_t send(int sockfd, const void *buf, size_t len, int flags);
       ssize_t sendto(int sockfd, const void *buf, size_t len, int flags,
                      const struct sockaddr *dest_addr, socklen_t addrlen);
       ssize_t splice(int fd_in, loff_t *off_in, int fd_out,
                      loff_t *off_out, size_t len, unsigned int flags);
       ssize_t tee(int fd_in, int fd_out, size_t len, unsigned int flags);
       ssize_t vmsplice(int fd, const struct iovec *iov,
                        unsigned long nr_segs, unsigned int flags);
       ssize_t readv(int fd, const struct iovec *iov, unsigned long iovcnt);
       ssize_t writev(int fd, const struct iovec *iov, unsigned long iovcnt);
       ssize_t preadv(int fd, const struct iovec *iov, unsigned long iovcnt,
                      off_t offset);
       ssize_t pwritev(int fd, const struct iovec *iov, unsigned long iovcnt,
                       off_t offset);
       ssize_t preadv2(int fd, const struct iovec *iov, unsigned long iovcnt,
                       off_t offset, int flags);
       ssize_t pwritev2(int fd, const struct iovec *iov, unsigned long iovcnt,
                        off_t offset, int flags);

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/25810] x32: Incorrect syscall entries with pointer, off_t and size_t
  2020-04-10 10:55 [Bug libc/25810] New: x32: Incorrect syscall entries with pointer, off_t and size_t hjl.tools at gmail dot com
                   ` (6 preceding siblings ...)
  2020-04-10 17:02 ` hjl.tools at gmail dot com
@ 2020-04-10 17:15 ` hjl.tools at gmail dot com
  2020-04-10 17:27 ` hjl.tools at gmail dot com
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2020-04-10 17:15 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=25810

--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> ---
       ssize_t mq_receive(mqd_t mqdes, char *msg_ptr,
                          size_t msg_len, unsigned int *msg_prio);
       ssize_t mq_timedreceive(mqd_t mqdes, char *msg_ptr,
                          size_t msg_len, unsigned int *msg_prio,
                          const struct timespec *abs_timeout);

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/25810] x32: Incorrect syscall entries with pointer, off_t and size_t
  2020-04-10 10:55 [Bug libc/25810] New: x32: Incorrect syscall entries with pointer, off_t and size_t hjl.tools at gmail dot com
                   ` (7 preceding siblings ...)
  2020-04-10 17:15 ` hjl.tools at gmail dot com
@ 2020-04-10 17:27 ` hjl.tools at gmail dot com
  2020-05-07 12:33 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2020-04-10 17:27 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=25810

--- Comment #9 from H.J. Lu <hjl.tools at gmail dot com> ---
      char *getcwd(char *buf, size_t size);

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/25810] x32: Incorrect syscall entries with pointer, off_t and size_t
  2020-04-10 10:55 [Bug libc/25810] New: x32: Incorrect syscall entries with pointer, off_t and size_t hjl.tools at gmail dot com
                   ` (8 preceding siblings ...)
  2020-04-10 17:27 ` hjl.tools at gmail dot com
@ 2020-05-07 12:33 ` hjl.tools at gmail dot com
  2020-05-09 19:44 ` cvs-commit at gcc dot gnu.org
  2020-05-09 19:48 ` cvs-commit at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2020-05-07 12:33 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=25810

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |2.32

--- Comment #10 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for 2.32 and 2.30/2.31 branches.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/25810] x32: Incorrect syscall entries with pointer, off_t and size_t
  2020-04-10 10:55 [Bug libc/25810] New: x32: Incorrect syscall entries with pointer, off_t and size_t hjl.tools at gmail dot com
                   ` (9 preceding siblings ...)
  2020-05-07 12:33 ` hjl.tools at gmail dot com
@ 2020-05-09 19:44 ` cvs-commit at gcc dot gnu.org
  2020-05-09 19:48 ` cvs-commit at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-09 19:44 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=25810

--- Comment #11 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The release/2.31/master branch has been updated by H.J. Lu
<hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a98b8b221cfe732dc7c19ae1d22665002e254c96

commit a98b8b221cfe732dc7c19ae1d22665002e254c96
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat May 9 12:43:53 2020 -0700

    NEWS: Mention fixes for BZ 25810/25896/25902/25966

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/25810] x32: Incorrect syscall entries with pointer, off_t and size_t
  2020-04-10 10:55 [Bug libc/25810] New: x32: Incorrect syscall entries with pointer, off_t and size_t hjl.tools at gmail dot com
                   ` (10 preceding siblings ...)
  2020-05-09 19:44 ` cvs-commit at gcc dot gnu.org
@ 2020-05-09 19:48 ` cvs-commit at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-09 19:48 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=25810

--- Comment #12 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The release/2.30/master branch has been updated by H.J. Lu
<hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4748829f86a458b76642f3e98b1d80f7b868e427

commit 4748829f86a458b76642f3e98b1d80f7b868e427
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat May 9 12:43:53 2020 -0700

    NEWS: Mention fixes for BZ 25810/25896/25902/25966

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2020-05-09 19:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-10 10:55 [Bug libc/25810] New: x32: Incorrect syscall entries with pointer, off_t and size_t hjl.tools at gmail dot com
2020-04-10 13:28 ` [Bug libc/25810] " hjl.tools at gmail dot com
2020-04-10 16:04 ` hjl.tools at gmail dot com
2020-04-10 16:38 ` hjl.tools at gmail dot com
2020-04-10 16:44 ` hjl.tools at gmail dot com
2020-04-10 16:46 ` hjl.tools at gmail dot com
2020-04-10 16:51 ` hjl.tools at gmail dot com
2020-04-10 17:02 ` hjl.tools at gmail dot com
2020-04-10 17:15 ` hjl.tools at gmail dot com
2020-04-10 17:27 ` hjl.tools at gmail dot com
2020-05-07 12:33 ` hjl.tools at gmail dot com
2020-05-09 19:44 ` cvs-commit at gcc dot gnu.org
2020-05-09 19:48 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).