From: schwab@suse.de (Andreas Schwab)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC5 PATCH v6 00/21] ILP32 for ARM64
Date: Mon, 29 Feb 2016 17:00:29 +0100 [thread overview]
Message-ID: <mvm4mcrtski.fsf@hawking.suse.de> (raw)
In-Reply-To: <208897488.c0hkBy2G1S@wuerfel> (Arnd Bergmann's message of "Fri, 19 Feb 2016 09:23:35 +0100")
Arnd Bergmann <arnd@arndb.de> writes:
> In https://github.com/norov/glibc/commit/5d4290435e428267171ece871539b76e1d079d11
> you are defining a struct __kernel_stat64 in the glibc. Is this the expected
> way to do it? I would have thought you'd get the definition from the kernel
> headers.
The problem really is that struct stat64 does not match the kernel
struct stat64. The latter uses the broken st_ino, where the 64-bit
inode is actually stored at the end of the structure, and there is
padding *before* the 32-bit inode, not after (so you cannot overlay a
64-bit inode field in little endian mode). You need to add the attached
file as sysdeps/unix/sysv/linux/aarch64/bits/stat.h, then you can use
the user-space struct stat64 to communicate with the *stat64 syscalls,
and __kernel_stat64 is not needed any more.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab at suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: stat.h
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160229/6c496eb8/attachment-0001.h>
WARNING: multiple messages have this Message-ID (diff)
From: Andreas Schwab <schwab@suse.de>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arm-kernel@lists.infradead.org,
Yury Norov <ynorov@caviumnetworks.com>,
"Zhangjian \(Bamvor\)" <bamvor.zhangjian@huawei.com>,
pinskia@gmail.com, Prasun.Kapoor@caviumnetworks.com,
catalin.marinas@arm.com, heiko.carstens@de.ibm.com,
linux-kernel@vger.kernel.org, agraf@suse.de,
klimov.linux@gmail.com, broonie@kernel.org,
jan.dakinevich@gmail.com, joseph@codesourcery.com,
schwidefsky@de.ibm.com, Nathan_Lynch@mentor.com,
christoph.muellner@theobroma-systems.com
Subject: Re: [RFC5 PATCH v6 00/21] ILP32 for ARM64
Date: Mon, 29 Feb 2016 17:00:29 +0100 [thread overview]
Message-ID: <mvm4mcrtski.fsf@hawking.suse.de> (raw)
In-Reply-To: <208897488.c0hkBy2G1S@wuerfel> (Arnd Bergmann's message of "Fri, 19 Feb 2016 09:23:35 +0100")
[-- Attachment #1: Type: text/plain, Size: 998 bytes --]
Arnd Bergmann <arnd@arndb.de> writes:
> In https://github.com/norov/glibc/commit/5d4290435e428267171ece871539b76e1d079d11
> you are defining a struct __kernel_stat64 in the glibc. Is this the expected
> way to do it? I would have thought you'd get the definition from the kernel
> headers.
The problem really is that struct stat64 does not match the kernel
struct stat64. The latter uses the broken st_ino, where the 64-bit
inode is actually stored at the end of the structure, and there is
padding *before* the 32-bit inode, not after (so you cannot overlay a
64-bit inode field in little endian mode). You need to add the attached
file as sysdeps/unix/sysv/linux/aarch64/bits/stat.h, then you can use
the user-space struct stat64 to communicate with the *stat64 syscalls,
and __kernel_stat64 is not needed any more.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
[-- Attachment #2: sysdeps/unix/sysv/linux/aarch64/bits/stat.h --]
[-- Type: text/plain, Size: 6892 bytes --]
/* Copyright (C) 1992-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
#ifndef _BITS_STAT_H
#define _BITS_STAT_H 1
/* Versions of the `struct stat' data structure. */
#define _STAT_VER_KERNEL 0
#define _STAT_VER_LINUX 0
#define _STAT_VER _STAT_VER_KERNEL
/* Versions of the `xmknod' interface. */
#define _MKNOD_VER_LINUX 0
struct stat
{
__dev_t st_dev; /* Device. */
#ifdef __ILP32__
unsigned int __st_ino_pad;
# ifndef __USE_FILE_OFFSET64
__ino_t st_ino; /* File serial number. */
# else
__ino_t __st_ino; /* 32bit file serial number. */
# endif
#else
# ifndef __USE_FILE_OFFSET64
__ino_t st_ino; /* File serial number. */
# else
__ino64_t st_ino; /* File serial number. */
# endif
#endif
__mode_t st_mode; /* File mode. */
__nlink_t st_nlink; /* Link count. */
__uid_t st_uid; /* User ID of the file's owner. */
__gid_t st_gid; /* Group ID of the file's group.*/
__dev_t st_rdev; /* Device number, if device. */
__dev_t __pad1;
#ifndef __USE_FILE_OFFSET64
__off_t st_size; /* Size of file, in bytes. */
# ifdef __ILP32__
int __st_size_pad;
# endif
#else
__off64_t st_size; /* Size of file, in bytes. */
#endif
__blksize_t st_blksize; /* Optimal block size for I/O. */
int __pad2;
#ifndef __USE_FILE_OFFSET64
__blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
# ifdef __ILP32__
int __st_blocks_pad;
# endif
#else
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
#endif
#ifdef __USE_XOPEN2K8
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
identifier 'timespec' to appear in the <sys/stat.h> header.
Therefore we have to handle the use of this header in strictly
standard-compliant sources special. */
struct timespec st_atim; /* Time of last access. */
struct timespec st_mtim; /* Time of last modification. */
struct timespec st_ctim; /* Time of last status change. */
# define st_atime st_atim.tv_sec /* Backward compatibility. */
# define st_mtime st_mtim.tv_sec
# define st_ctime st_ctim.tv_sec
#else
__time_t st_atime; /* Time of last access. */
unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
unsigned long int st_ctimensec; /* Nsecs of last status change. */
#endif
#if !defined __ILP32__ || !defined __USE_FILE_OFFSET64
int __glibc_reserved[2];
#else
__ino64_t st_ino; /* File serial number. */
#endif
};
#ifdef __USE_LARGEFILE64
struct stat64
{
__dev_t st_dev; /* Device. */
# ifdef __ILP32__
unsigned int __st_ino_pad;
__ino_t __st_ino; /* 32bit file serial number. */
# else
__ino64_t st_ino; /* File serial number. */
# endif
__mode_t st_mode; /* File mode. */
__nlink_t st_nlink; /* Link count. */
__uid_t st_uid; /* User ID of the file's owner. */
__gid_t st_gid; /* Group ID of the file's group.*/
__dev_t st_rdev; /* Device number, if device. */
__dev_t __pad1;
__off64_t st_size; /* Size of file, in bytes. */
__blksize_t st_blksize; /* Optimal block size for I/O. */
int __pad2;
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
# ifdef __USE_XOPEN2K8
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
identifier 'timespec' to appear in the <sys/stat.h> header.
Therefore we have to handle the use of this header in strictly
standard-compliant sources special. */
struct timespec st_atim; /* Time of last access. */
struct timespec st_mtim; /* Time of last modification. */
struct timespec st_ctim; /* Time of last status change. */
# else
__time_t st_atime; /* Time of last access. */
unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
unsigned long int st_ctimensec; /* Nsecs of last status change. */
# endif
# ifdef __ILP32__
__ino64_t st_ino; /* File serial number. */
# else
int __glibc_reserved[2];
# endif
};
#endif
/* Tell code we have these members. */
#define _STATBUF_ST_BLKSIZE
#define _STATBUF_ST_RDEV
/* Nanosecond resolution time values are supported. */
#define _STATBUF_ST_NSEC
/* Encoding of the file mode. */
#define __S_IFMT 0170000 /* These bits determine file type. */
/* File types. */
#define __S_IFDIR 0040000 /* Directory. */
#define __S_IFCHR 0020000 /* Character device. */
#define __S_IFBLK 0060000 /* Block device. */
#define __S_IFREG 0100000 /* Regular file. */
#define __S_IFIFO 0010000 /* FIFO. */
#define __S_IFLNK 0120000 /* Symbolic link. */
#define __S_IFSOCK 0140000 /* Socket. */
/* POSIX.1b objects. Note that these macros always evaluate to zero. But
they do it by enforcing the correct use of the macros. */
#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
/* Protection bits. */
#define __S_ISUID 04000 /* Set user ID on execution. */
#define __S_ISGID 02000 /* Set group ID on execution. */
#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
#define __S_IREAD 0400 /* Read by owner. */
#define __S_IWRITE 0200 /* Write by owner. */
#define __S_IEXEC 0100 /* Execute by owner. */
#ifdef __USE_ATFILE
# define UTIME_NOW ((1l << 30) - 1l)
# define UTIME_OMIT ((1l << 30) - 2l)
#endif
#endif /* bits/stat.h */
next prev parent reply other threads:[~2016-02-29 16:00 UTC|newest]
Thread overview: 143+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-14 17:22 [RFC5 PATCH v6 00/21] ILP32 for ARM64 Yury Norov
2016-01-14 17:22 ` Yury Norov
2016-01-14 17:22 ` [PATCH v6 01/21] arm64: ilp32: add documentation on the ILP32 ABI " Yury Norov
2016-01-14 17:22 ` Yury Norov
2016-01-14 17:22 ` [PATCH v6 02/21] arm64: ensure the kernel is compiled for LP64 Yury Norov
2016-01-14 17:22 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 03/21] arm64: rename COMPAT to AARCH32_EL0 in Kconfig Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 04/21] arm64: change some CONFIG_COMPAT over to use CONFIG_AARCH32_EL0 instead Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 05/21] arm64: compat: change config dependences to aarch32 Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 06/21] arm64:uapi: set __BITS_PER_LONG correctly for ILP32 and LP64 Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 07/21] thread: move thread bits accessors to separated file Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 08/21] arm64: introduce is_a32_task and is_a32_thread (for AArch32 compat) Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 09/21] arm64: ilp32: add is_ilp32_compat_{task, thread} and TIF_32BIT_AARCH64 Yury Norov
2016-01-14 17:23 ` [PATCH v6 09/21] arm64: ilp32: add is_ilp32_compat_{task,thread} " Yury Norov
2016-01-14 17:23 ` [PATCH v6 10/21] arm64: introduce binfmt_elf32.c Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 11/21] arm64: ilp32: introduce binfmt_ilp32.c Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 12/21] arm64: ptrace: handle ptrace_request differently for aarch32 and ilp32 Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 13/21] arm64:ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 14/21] arm64: signal: wrap struct ucontext, fp and lr with struct sigframe Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 15/21] arm64: signal: share lp64 signal routines to ilp32 Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 16/21] arm64: signal32: move ilp32 and aarch32 common code to separated file Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 17/21] arm64: ilp32: introduce ilp32-specific handlers for sigframe Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-02-29 8:27 ` Andreas Schwab
2016-02-29 8:27 ` Andreas Schwab
2016-01-14 17:23 ` [PATCH v6 18/21] arm64:ilp32: add vdso-ilp32 and use for signal return Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 19/21] arm64:ilp32: add ARM64_ILP32 to Kconfig Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 20/21] all: s390: make compat wrappers the generic solution Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-14 18:11 ` Yury Norov
2016-01-14 18:11 ` Yury Norov
2016-01-15 12:46 ` Heiko Carstens
2016-01-15 12:46 ` Heiko Carstens
2016-01-19 17:52 ` Yury Norov
2016-01-20 8:16 ` Heiko Carstens
2016-01-20 8:16 ` Heiko Carstens
2016-01-20 12:17 ` Yury Norov
2016-01-20 12:17 ` Yury Norov
2016-01-14 17:23 ` [PATCH v6 21/21] arm64: ilp32: wrap syscalls to remove top 32-bit vulnerability Yury Norov
2016-01-14 17:23 ` Yury Norov
2016-01-18 13:18 ` [RFC5 PATCH v6 00/21] ILP32 for ARM64 Zhangjian (Bamvor)
2016-01-18 13:18 ` Zhangjian (Bamvor)
2016-01-18 13:26 ` Andreas Schwab
2016-01-18 13:26 ` Andreas Schwab
2016-01-18 13:41 ` Bamvor Zhang Jian
2016-01-18 13:41 ` Bamvor Zhang Jian
2016-01-29 9:59 ` Zhangjian (Bamvor)
2016-01-29 9:59 ` Zhangjian (Bamvor)
2016-01-29 17:09 ` Yury Norov
2016-01-29 17:09 ` Yury Norov
2016-01-30 4:15 ` Zhangjian (Bamvor)
2016-01-30 4:15 ` Zhangjian (Bamvor)
2016-02-18 22:35 ` Yury Norov
2016-02-18 22:35 ` Yury Norov
2016-02-19 8:23 ` Arnd Bergmann
2016-02-19 8:23 ` Arnd Bergmann
2016-02-19 12:59 ` Yury Norov
2016-02-19 12:59 ` Yury Norov
2016-02-19 14:06 ` Arnd Bergmann
2016-02-19 14:06 ` Arnd Bergmann
2016-02-29 15:39 ` Yury Norov
2016-02-29 15:39 ` Yury Norov
2016-02-29 16:00 ` Andreas Schwab [this message]
2016-02-29 16:00 ` Andreas Schwab
2016-02-29 16:30 ` Arnd Bergmann
2016-02-29 16:30 ` Arnd Bergmann
2016-02-25 10:50 ` Andreas Schwab
2016-02-25 10:50 ` Andreas Schwab
2016-02-25 20:28 ` Yury Norov
2016-02-25 20:28 ` Yury Norov
2016-03-18 10:28 ` Zhangjian (Bamvor)
2016-03-18 10:28 ` Zhangjian (Bamvor)
2016-03-18 15:49 ` Yury Norov
2016-03-18 15:49 ` Yury Norov
2016-03-18 15:55 ` Alexander Graf
2016-03-18 15:55 ` Alexander Graf
2016-03-18 16:46 ` Yury Norov
2016-03-18 16:46 ` Yury Norov
2016-03-20 8:12 ` Zhangjian (Bamvor)
2016-03-20 8:12 ` Zhangjian (Bamvor)
2016-03-21 11:23 ` Zhangjian (Bamvor)
2016-03-21 11:23 ` Zhangjian (Bamvor)
2016-03-21 18:43 ` Yury Norov
2016-03-21 18:43 ` Yury Norov
2016-03-22 1:49 ` Yury Norov
2016-03-22 1:49 ` Yury Norov
2016-03-21 9:07 ` Andreas Schwab
2016-03-21 9:07 ` Andreas Schwab
2016-03-21 9:43 ` Arnd Bergmann
2016-03-21 9:43 ` Arnd Bergmann
2016-03-21 10:52 ` Andreas Schwab
2016-03-21 10:52 ` Andreas Schwab
2016-03-21 17:02 ` Arnd Bergmann
2016-03-21 17:02 ` Arnd Bergmann
2016-03-26 12:36 ` Zhangjian (Bamvor)
2016-03-26 12:36 ` Zhangjian (Bamvor)
2016-03-29 10:58 ` Arnd Bergmann
2016-03-29 10:58 ` Arnd Bergmann
2016-03-29 12:01 ` Yury Norov
2016-03-29 12:01 ` Yury Norov
2016-03-29 12:42 ` Arnd Bergmann
2016-03-29 12:42 ` Arnd Bergmann
2016-03-29 13:21 ` Zhangjian (Bamvor)
2016-03-29 13:21 ` Zhangjian (Bamvor)
2016-03-29 13:27 ` Arnd Bergmann
2016-03-29 13:27 ` Arnd Bergmann
2016-03-29 15:54 ` Joseph Myers
2016-03-29 15:54 ` Joseph Myers
2016-03-29 19:30 ` Arnd Bergmann
2016-03-29 19:30 ` Arnd Bergmann
2016-03-29 20:15 ` Joseph Myers
2016-03-29 20:15 ` Joseph Myers
2016-03-29 20:24 ` Arnd Bergmann
2016-03-29 20:24 ` Arnd Bergmann
2016-03-29 21:00 ` Joseph Myers
2016-03-29 21:00 ` Joseph Myers
2016-03-29 21:39 ` Arnd Bergmann
2016-03-29 21:39 ` Arnd Bergmann
2016-03-31 7:35 ` Zhangjian (Bamvor)
2016-03-31 7:35 ` Zhangjian (Bamvor)
2016-03-21 18:40 ` Yury Norov
2016-03-21 18:40 ` Yury Norov
2016-03-26 13:08 ` Zhangjian (Bamvor)
2016-03-26 13:08 ` Zhangjian (Bamvor)
2016-03-26 13:45 ` Zhangjian (Bamvor)
2016-03-26 13:45 ` Zhangjian (Bamvor)
2016-03-26 22:46 ` Yury Norov
2016-03-26 22:46 ` Yury Norov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mvm4mcrtski.fsf@hawking.suse.de \
--to=schwab@suse.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.