From patchwork Mon Sep 7 09:17:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 274416 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A01F2C43461 for ; Mon, 7 Sep 2020 09:18:47 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 19B292078E for ; Mon, 7 Sep 2020 09:18:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 19B292078E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=vivier.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFDIU-000747-7z for qemu-devel@archiver.kernel.org; Mon, 07 Sep 2020 05:18:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34078) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFDHl-0005Vp-7R for qemu-devel@nongnu.org; Mon, 07 Sep 2020 05:18:01 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:56537) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFDHi-0002ai-9o for qemu-devel@nongnu.org; Mon, 07 Sep 2020 05:18:00 -0400 Received: from localhost.localdomain ([82.252.135.186]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MSI6i-1k8VB50nZg-00Sc3g; Mon, 07 Sep 2020 11:17:55 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 1/5] linux-user: Add support for ppoll_time64() and pselect6_time64() Date: Mon, 7 Sep 2020 11:17:44 +0200 Message-Id: <20200907091748.376101-2-laurent@vivier.eu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200907091748.376101-1-laurent@vivier.eu> References: <20200907091748.376101-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:N+CfROGZniiCxcSFLIRFhL9tLoK/UdLLVqM8vE7Xuu0lQiKYk6a JgC+RSPjkuMgKSxWuT2KHVFgWZXUNXlRhp7wr8AuC6wUeG1gc/xJKzBps9DVB3qEUqWgwF9 tToc2ltZnc7GfGcEVUQ/RbsItAiefxQomj42QQcs6Dqm4v774lx/P+7fIypnakgfpjA1n5W N/6v/71mk0yg+UjfVfldw== X-UI-Out-Filterresults: notjunk:1; V03:K0:+82GtxHO0eQ=:PZsDhtD1sI634jf1i7Ti+Q FLIa+7M6jWWiZYUy6idiwE9Nw6MLAniw8QHRO7VOcwhWC6T1EaGU+nIequu8GR3THoFXpSu8R B3gVKHznVcgXPhTvJHMe2weD8OoKzCJXxt4X+Nd/A4fHUssUUoiFFpgetA1km7M/smbrmYV8m xwSXrCBJQPcX9kGAI9vqHbRdm7LOLJdaUWf1x58oixIlOqRPtbJJA7LC+rQohVU9WnboHc1kn Bzsi+P6v0H5HyuBSmH/14dwXj86UprY3FVeavvThcY/DhD4LRU/4qxkf960oQNqldaJNB2cOw l4BWX7UVsHxKcUOYOksmUSyt/0GyeEUM980sYk4GkX5Ej33Nob1ru3swDJk0N79E6urqrX6YJ Zx47DOhrNNy4vgeSuciv//XRZMVPHDfZAzTe3lGJy4wJ58BACe4yCH1Z/gQKkZE6sdoWL1lSx KI8yQ2CaBtOx1hCZoxuzoAkaI7e6wm2d5y9YoGJcuk5aXA1XoH+x05Oq9CvInQko3/57Xjdi1 VYcSqA+LJa1vBL3oKjAbDodgjuiujNeqd3i4fg6rY3x1wLYwxiER8kQ3Y0Ps02kcJ1kYwcqWf LSU0HpM3MRyd912mxWzYVXZtaPF9Yg/9CH6w6B3wDYvllFPFicQToy9p83mDMN7vMef6HWX/z SA1ORK5pib6JGlul6QQJRYaC/GVfuQ/LZFI2yL6l+au7zpgyX8fwUodhivi5lhI49a59YiByX Gm/50+V/anuiK6Eh7ReYa+kgtkMu71qPrd1coWiAbLmckTqABFQM4eStDTp02EgIXDH+i9uWr G6ZtJrEdR1uQ8EY4fhlggRhbiV3nEWEGeLfNpWRr4oLk9qDurCghTcLcMNzlLHNaDIo98fj Received-SPF: none client-ip=212.227.126.130; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/07 05:17:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Filip Bozuta Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Filip Bozuta This patch introduces functionality for following time64 syscalls: *ppoll_time64 This is a year 2038 safe variant of: int poll(struct pollfd *fds, nfds_t nfds, int timeout) -- wait for some event on a file descriptor -- man page: https://man7.org/linux/man-pages/man2/ppoll.2.html *pselect6_time64 This is a year 2038 safe variant of: int pselect6(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timespec *timeout, const sigset_t *sigmask); -- synchronous I/O multiplexing -- man page: https://man7.org/linux/man-pages/man2/pselect6.2.html Implementation notes: Year 2038 safe syscalls in this patch were implemented with the same code as their regular variants (ppoll() and pselect()). This code was moved to new functions ('do_ppoll()' and 'do_pselect6()') that take a 'bool time64' from which a right 'struct timespec' converting function is called. (target_to_host/host_to_target_timespec() for regular and target_to_host/host_to_target_timespec64() for time64 variants) Signed-off-by: Filip Bozuta Reviewed-by: Laurent Vivier Message-Id: <20200824223050.92032-2-Filip.Bozuta@syrmia.com> [lv: rebase and fix do_pselect6()] Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 460 +++++++++++++++++++++++-------------------- 1 file changed, 250 insertions(+), 210 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 93da3b972852..07220eee40c5 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -728,11 +728,11 @@ safe_syscall5(int, waitid, idtype_t, idtype, id_t, id, siginfo_t *, infop, \ int, options, struct rusage *, rusage) safe_syscall3(int, execve, const char *, filename, char **, argv, char **, envp) #if defined(TARGET_NR_select) || defined(TARGET_NR__newselect) || \ - defined(TARGET_NR_pselect6) + defined(TARGET_NR_pselect6) || defined(TARGET_NR_pselect6_time64) safe_syscall6(int, pselect6, int, nfds, fd_set *, readfds, fd_set *, writefds, \ fd_set *, exceptfds, struct timespec *, timeout, void *, sig) #endif -#if defined(TARGET_NR_ppoll) || defined(TARGET_NR_poll) +#if defined(TARGET_NR_ppoll) || defined(TARGET_NR_ppoll_time64) safe_syscall5(int, ppoll, struct pollfd *, ufds, unsigned int, nfds, struct timespec *, tsp, const sigset_t *, sigmask, size_t, sigsetsize) @@ -952,7 +952,7 @@ abi_long do_brk(abi_ulong new_brk) } #if defined(TARGET_NR_select) || defined(TARGET_NR__newselect) || \ - defined(TARGET_NR_pselect6) + defined(TARGET_NR_pselect6) || defined(TARGET_NR_pselect6_time64) static inline abi_long copy_from_user_fdset(fd_set *fds, abi_ulong target_fds_addr, int n) @@ -1250,7 +1250,8 @@ static inline abi_long target_to_host_timespec(struct timespec *host_ts, defined(TARGET_NR_rt_sigtimedwait_time64) || \ defined(TARGET_NR_utimensat) || \ defined(TARGET_NR_utimensat_time64) || \ - defined(TARGET_NR_semtimedop_time64) + defined(TARGET_NR_semtimedop_time64) || \ + defined(TARGET_NR_pselect6_time64) || defined(TARGET_NR_ppoll_time64) static inline abi_long target_to_host_timespec64(struct timespec *host_ts, abi_ulong target_addr) { @@ -1458,6 +1459,237 @@ static abi_long do_old_select(abi_ulong arg1) #endif #endif +#if defined(TARGET_NR_pselect6) || defined(TARGET_NR_pselect6_time64) +static abi_long do_pselect6(abi_long arg1, abi_long arg2, abi_long arg3, + abi_long arg4, abi_long arg5, abi_long arg6, + bool time64) +{ + abi_long rfd_addr, wfd_addr, efd_addr, n, ts_addr; + fd_set rfds, wfds, efds; + fd_set *rfds_ptr, *wfds_ptr, *efds_ptr; + struct timespec ts, *ts_ptr; + abi_long ret; + + /* + * The 6th arg is actually two args smashed together, + * so we cannot use the C library. + */ + sigset_t set; + struct { + sigset_t *set; + size_t size; + } sig, *sig_ptr; + + abi_ulong arg_sigset, arg_sigsize, *arg7; + target_sigset_t *target_sigset; + + n = arg1; + rfd_addr = arg2; + wfd_addr = arg3; + efd_addr = arg4; + ts_addr = arg5; + + ret = copy_from_user_fdset_ptr(&rfds, &rfds_ptr, rfd_addr, n); + if (ret) { + return ret; + } + ret = copy_from_user_fdset_ptr(&wfds, &wfds_ptr, wfd_addr, n); + if (ret) { + return ret; + } + ret = copy_from_user_fdset_ptr(&efds, &efds_ptr, efd_addr, n); + if (ret) { + return ret; + } + + /* + * This takes a timespec, and not a timeval, so we cannot + * use the do_select() helper ... + */ + if (ts_addr) { + if (time64) { + if (target_to_host_timespec64(&ts, ts_addr)) { + return -TARGET_EFAULT; + } + } else { + if (target_to_host_timespec(&ts, ts_addr)) { + return -TARGET_EFAULT; + } + } + ts_ptr = &ts; + } else { + ts_ptr = NULL; + } + + /* Extract the two packed args for the sigset */ + if (arg6) { + sig_ptr = &sig; + sig.size = SIGSET_T_SIZE; + + arg7 = lock_user(VERIFY_READ, arg6, sizeof(*arg7) * 2, 1); + if (!arg7) { + return -TARGET_EFAULT; + } + arg_sigset = tswapal(arg7[0]); + arg_sigsize = tswapal(arg7[1]); + unlock_user(arg7, arg6, 0); + + if (arg_sigset) { + sig.set = &set; + if (arg_sigsize != sizeof(*target_sigset)) { + /* Like the kernel, we enforce correct size sigsets */ + return -TARGET_EINVAL; + } + target_sigset = lock_user(VERIFY_READ, arg_sigset, + sizeof(*target_sigset), 1); + if (!target_sigset) { + return -TARGET_EFAULT; + } + target_to_host_sigset(&set, target_sigset); + unlock_user(target_sigset, arg_sigset, 0); + } else { + sig.set = NULL; + } + } else { + sig_ptr = NULL; + } + + ret = get_errno(safe_pselect6(n, rfds_ptr, wfds_ptr, efds_ptr, + ts_ptr, sig_ptr)); + + if (!is_error(ret)) { + if (rfd_addr && copy_to_user_fdset(rfd_addr, &rfds, n)) { + return -TARGET_EFAULT; + } + if (wfd_addr && copy_to_user_fdset(wfd_addr, &wfds, n)) { + return -TARGET_EFAULT; + } + if (efd_addr && copy_to_user_fdset(efd_addr, &efds, n)) { + return -TARGET_EFAULT; + } + if (time64) { + if (ts_addr && host_to_target_timespec64(ts_addr, &ts)) { + return -TARGET_EFAULT; + } + } else { + if (ts_addr && host_to_target_timespec(ts_addr, &ts)) { + return -TARGET_EFAULT; + } + } + } + return ret; +} +#endif + +#if defined(TARGET_NR_poll) || defined(TARGET_NR_ppoll) || \ + defined(TARGET_NR_ppoll_time64) +static abi_long do_ppoll(abi_long arg1, abi_long arg2, abi_long arg3, + abi_long arg4, abi_long arg5, bool ppoll, bool time64) +{ + struct target_pollfd *target_pfd; + unsigned int nfds = arg2; + struct pollfd *pfd; + unsigned int i; + abi_long ret; + + pfd = NULL; + target_pfd = NULL; + if (nfds) { + if (nfds > (INT_MAX / sizeof(struct target_pollfd))) { + return -TARGET_EINVAL; + } + target_pfd = lock_user(VERIFY_WRITE, arg1, + sizeof(struct target_pollfd) * nfds, 1); + if (!target_pfd) { + return -TARGET_EFAULT; + } + + pfd = alloca(sizeof(struct pollfd) * nfds); + for (i = 0; i < nfds; i++) { + pfd[i].fd = tswap32(target_pfd[i].fd); + pfd[i].events = tswap16(target_pfd[i].events); + } + } + if (ppoll) { + struct timespec _timeout_ts, *timeout_ts = &_timeout_ts; + target_sigset_t *target_set; + sigset_t _set, *set = &_set; + + if (arg3) { + if (time64) { + if (target_to_host_timespec64(timeout_ts, arg3)) { + unlock_user(target_pfd, arg1, 0); + return -TARGET_EFAULT; + } + } else { + if (target_to_host_timespec(timeout_ts, arg3)) { + unlock_user(target_pfd, arg1, 0); + return -TARGET_EFAULT; + } + } + } else { + timeout_ts = NULL; + } + + if (arg4) { + if (arg5 != sizeof(target_sigset_t)) { + unlock_user(target_pfd, arg1, 0); + return -TARGET_EINVAL; + } + + target_set = lock_user(VERIFY_READ, arg4, + sizeof(target_sigset_t), 1); + if (!target_set) { + unlock_user(target_pfd, arg1, 0); + return -TARGET_EFAULT; + } + target_to_host_sigset(set, target_set); + } else { + set = NULL; + } + + ret = get_errno(safe_ppoll(pfd, nfds, timeout_ts, + set, SIGSET_T_SIZE)); + + if (!is_error(ret) && arg3) { + if (time64) { + if (host_to_target_timespec64(arg3, timeout_ts)) { + return -TARGET_EFAULT; + } + } else { + if (host_to_target_timespec(arg3, timeout_ts)) { + return -TARGET_EFAULT; + } + } + } + if (arg4) { + unlock_user(target_set, arg4, 0); + } + } else { + struct timespec ts, *pts; + + if (arg3 >= 0) { + /* Convert ms to secs, ns */ + ts.tv_sec = arg3 / 1000; + ts.tv_nsec = (arg3 % 1000) * 1000000LL; + pts = &ts; + } else { + /* -ve poll() timeout means "infinite" */ + pts = NULL; + } + ret = get_errno(safe_ppoll(pfd, nfds, pts, NULL, 0)); + } + + if (!is_error(ret)) { + for (i = 0; i < nfds; i++) { + target_pfd[i].revents = tswap16(pfd[i].revents); + } + } + unlock_user(target_pfd, arg1, sizeof(struct target_pollfd) * nfds); + return ret; +} +#endif + static abi_long do_pipe2(int host_pipe[], int flags) { #ifdef CONFIG_PIPE2 @@ -9256,106 +9488,11 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, #endif #ifdef TARGET_NR_pselect6 case TARGET_NR_pselect6: - { - abi_long rfd_addr, wfd_addr, efd_addr, n, ts_addr; - fd_set rfds, wfds, efds; - fd_set *rfds_ptr, *wfds_ptr, *efds_ptr; - struct timespec ts, *ts_ptr; - - /* - * The 6th arg is actually two args smashed together, - * so we cannot use the C library. - */ - sigset_t set; - struct { - sigset_t *set; - size_t size; - } sig, *sig_ptr; - - abi_ulong arg_sigset, arg_sigsize, *arg7; - target_sigset_t *target_sigset; - - n = arg1; - rfd_addr = arg2; - wfd_addr = arg3; - efd_addr = arg4; - ts_addr = arg5; - - ret = copy_from_user_fdset_ptr(&rfds, &rfds_ptr, rfd_addr, n); - if (ret) { - return ret; - } - ret = copy_from_user_fdset_ptr(&wfds, &wfds_ptr, wfd_addr, n); - if (ret) { - return ret; - } - ret = copy_from_user_fdset_ptr(&efds, &efds_ptr, efd_addr, n); - if (ret) { - return ret; - } - - /* - * This takes a timespec, and not a timeval, so we cannot - * use the do_select() helper ... - */ - if (ts_addr) { - if (target_to_host_timespec(&ts, ts_addr)) { - return -TARGET_EFAULT; - } - ts_ptr = &ts; - } else { - ts_ptr = NULL; - } - - /* Extract the two packed args for the sigset */ - if (arg6) { - sig_ptr = &sig; - sig.size = SIGSET_T_SIZE; - - arg7 = lock_user(VERIFY_READ, arg6, sizeof(*arg7) * 2, 1); - if (!arg7) { - return -TARGET_EFAULT; - } - arg_sigset = tswapal(arg7[0]); - arg_sigsize = tswapal(arg7[1]); - unlock_user(arg7, arg6, 0); - - if (arg_sigset) { - sig.set = &set; - if (arg_sigsize != sizeof(*target_sigset)) { - /* Like the kernel, we enforce correct size sigsets */ - return -TARGET_EINVAL; - } - target_sigset = lock_user(VERIFY_READ, arg_sigset, - sizeof(*target_sigset), 1); - if (!target_sigset) { - return -TARGET_EFAULT; - } - target_to_host_sigset(&set, target_sigset); - unlock_user(target_sigset, arg_sigset, 0); - } else { - sig.set = NULL; - } - } else { - sig_ptr = NULL; - } - - ret = get_errno(safe_pselect6(n, rfds_ptr, wfds_ptr, efds_ptr, - ts_ptr, sig_ptr)); - - if (!is_error(ret)) { - if (rfd_addr && copy_to_user_fdset(rfd_addr, &rfds, n)) - return -TARGET_EFAULT; - if (wfd_addr && copy_to_user_fdset(wfd_addr, &wfds, n)) - return -TARGET_EFAULT; - if (efd_addr && copy_to_user_fdset(efd_addr, &efds, n)) - return -TARGET_EFAULT; - - if (ts_addr && host_to_target_timespec(ts_addr, &ts)) - return -TARGET_EFAULT; - } - } - return ret; + return do_pselect6(arg1, arg2, arg3, arg4, arg5, arg6, false); +#endif +#ifdef TARGET_NR_pselect6_time64 + case TARGET_NR_pselect6_time64: + return do_pselect6(arg1, arg2, arg3, arg4, arg5, arg6, true); #endif #ifdef TARGET_NR_symlink case TARGET_NR_symlink: @@ -10306,114 +10443,17 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, case TARGET_NR__newselect: return do_select(arg1, arg2, arg3, arg4, arg5); #endif -#if defined(TARGET_NR_poll) || defined(TARGET_NR_ppoll) -# ifdef TARGET_NR_poll +#ifdef TARGET_NR_poll case TARGET_NR_poll: -# endif -# ifdef TARGET_NR_ppoll + return do_ppoll(arg1, arg2, arg3, arg4, arg5, false, false); +#endif +#ifdef TARGET_NR_ppoll case TARGET_NR_ppoll: -# endif - { - struct target_pollfd *target_pfd; - unsigned int nfds = arg2; - struct pollfd *pfd; - unsigned int i; - - pfd = NULL; - target_pfd = NULL; - if (nfds) { - if (nfds > (INT_MAX / sizeof(struct target_pollfd))) { - return -TARGET_EINVAL; - } - - target_pfd = lock_user(VERIFY_WRITE, arg1, - sizeof(struct target_pollfd) * nfds, 1); - if (!target_pfd) { - return -TARGET_EFAULT; - } - - pfd = alloca(sizeof(struct pollfd) * nfds); - for (i = 0; i < nfds; i++) { - pfd[i].fd = tswap32(target_pfd[i].fd); - pfd[i].events = tswap16(target_pfd[i].events); - } - } - - switch (num) { -# ifdef TARGET_NR_ppoll - case TARGET_NR_ppoll: - { - struct timespec _timeout_ts, *timeout_ts = &_timeout_ts; - target_sigset_t *target_set; - sigset_t _set, *set = &_set; - - if (arg3) { - if (target_to_host_timespec(timeout_ts, arg3)) { - unlock_user(target_pfd, arg1, 0); - return -TARGET_EFAULT; - } - } else { - timeout_ts = NULL; - } - - if (arg4) { - if (arg5 != sizeof(target_sigset_t)) { - unlock_user(target_pfd, arg1, 0); - return -TARGET_EINVAL; - } - - target_set = lock_user(VERIFY_READ, arg4, sizeof(target_sigset_t), 1); - if (!target_set) { - unlock_user(target_pfd, arg1, 0); - return -TARGET_EFAULT; - } - target_to_host_sigset(set, target_set); - } else { - set = NULL; - } - - ret = get_errno(safe_ppoll(pfd, nfds, timeout_ts, - set, SIGSET_T_SIZE)); - - if (!is_error(ret) && arg3) { - host_to_target_timespec(arg3, timeout_ts); - } - if (arg4) { - unlock_user(target_set, arg4, 0); - } - break; - } -# endif -# ifdef TARGET_NR_poll - case TARGET_NR_poll: - { - struct timespec ts, *pts; - - if (arg3 >= 0) { - /* Convert ms to secs, ns */ - ts.tv_sec = arg3 / 1000; - ts.tv_nsec = (arg3 % 1000) * 1000000LL; - pts = &ts; - } else { - /* -ve poll() timeout means "infinite" */ - pts = NULL; - } - ret = get_errno(safe_ppoll(pfd, nfds, pts, NULL, 0)); - break; - } -# endif - default: - g_assert_not_reached(); - } - - if (!is_error(ret)) { - for(i = 0; i < nfds; i++) { - target_pfd[i].revents = tswap16(pfd[i].revents); - } - } - unlock_user(target_pfd, arg1, sizeof(struct target_pollfd) * nfds); - } - return ret; + return do_ppoll(arg1, arg2, arg3, arg4, arg5, true, false); +#endif +#ifdef TARGET_NR_ppoll_time64 + case TARGET_NR_ppoll_time64: + return do_ppoll(arg1, arg2, arg3, arg4, arg5, true, true); #endif case TARGET_NR_flock: /* NOTE: the flock constant seems to be the same for every From patchwork Mon Sep 7 09:17:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 249207 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp3522504ilg; Mon, 7 Sep 2020 02:19:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZhG6RImWrBu+G0slE/E03A9t7YAlFovCArdymoHauwZ+Qhy7mgsn2NCMtNog6BufKRslZ X-Received: by 2002:a5b:38a:: with SMTP id k10mr5844215ybp.430.1599470388751; Mon, 07 Sep 2020 02:19:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599470388; cv=none; d=google.com; s=arc-20160816; b=G04i5iPqomqKdtWWhZXD6o6FfRS0uy6B/fCyBoDEImiCPJ3cigPX+Fs0V7x4uZXeQ6 d5wpZsbWTCtFJlWwNYOZbQbEYbfL7JZ2oyPfJBMX5jrwcsp4jEnBIQQH6scj+69H+OES xaTqS+Ncxyrn1+1a/RzpnywX/RZAZIbdQqCx/euPtqhWmsryTaekXSPjX4Mz/eY4/vYZ JFX3/sLieuQqvitJbHjlR5OQagNr62MN9yXAar0Ixk44OIJWTMOUZh3K4CaAotNIVggP tveeHBKQ4hs281XuMgN+onTWk5Y9y+0kAh+JzNSsIEL7NzTSWWxWIz33uXwXxko4jocc uN+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=Kv3gQBgkNCSeLLc29LhBwqGJvzgykLc8Sx9oPbZj1Uk=; b=lXHN1xPjsxvP0UpUBjUlZ2J0FPd5qdmpCQzM3n5Lffh0AkJ2k+Kxrdi8KEg/KcoYzO tmLqnXhya0Br6zJ8729n0Oq0IBEt9fMpGRkM+My1nDbf8BJdMB9mnt7ELis8Rv0tl0H2 kzDGk09s0O0hBsx2mr5yeGbW0HMdoox0ig4DVPhfrPt83NUVAjXt0OmShmzJ+Go8pzNK bjrrpcdAHGW137nPB9eXAFAQUxMmQNTifd1I6b6jR2SHiPaefrTRa4jn+z5z9SbGGT4f qrUQBHhYCaMGQgtOKwRay+jNZ9Od3tetyDnmvdp6B6UWEqXrOz9EKqfDTLsXPbSC2E3f yNWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k2si15149875ybg.157.2020.09.07.02.19.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Sep 2020 02:19:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:33896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFDJU-0008H4-9e for patch@linaro.org; Mon, 07 Sep 2020 05:19:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34090) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFDHl-0005Wb-OI for qemu-devel@nongnu.org; Mon, 07 Sep 2020 05:18:01 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:38333) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFDHi-0002ah-AJ for qemu-devel@nongnu.org; Mon, 07 Sep 2020 05:18:01 -0400 Received: from localhost.localdomain ([82.252.135.186]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MYLqs-1k2RRG0GHK-00VMwQ; Mon, 07 Sep 2020 11:17:56 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 2/5] linux-user: Correctly start brk after executable Date: Mon, 7 Sep 2020 11:17:45 +0200 Message-Id: <20200907091748.376101-3-laurent@vivier.eu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200907091748.376101-1-laurent@vivier.eu> References: <20200907091748.376101-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:HLvEtCc5PtWXC2xo7Ndqgm+mYK96AUT4t6eH5zgwKk045TqSoB9 c6h/Un65x8n32V5gK1YPWQVW1DxBfk4s0QF9DWPQx9b9W1p2AxygNz2lTP0Wsfk9LE0BkF+ o1u1lJ0tR2pky9aG1t1rVg697oajUhNWfPSrbkeeXQFsclmot/52DfVE4dYM2TpprR4Fm2n xDvso3j/jof631DVgdliQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:1qbchAxfz4I=:iMPVq6XjzZf2oP1FW46DYE +wzJPWgqCjlaezwMhbc15gskMs9fJeweEBb1RK8PaaYr/xnLU5677u/Yf804hwfz+i3LpXIfk kr3HuZ+brQUvP6cqwZpuu++LNSLoEEt51lLRJw45vjissKiyaARNzkOWes6mnYWZV7Ezh+ZQz pVRFgduJK75QumxgedgrzgzWZWNg/nYjzI9ziOmtZDnYPwTxOC0LsU3XLsHzPldP2Q3c2NQ8k 3/iAxvk0RBoFSntzhyIHB1tCfHVSh6jxhQSn33a1L7ZPhZ/EmAlogkDcwmEvAsMVSR56UolUN enw36cbQkKUksZaQakQoJ+zP5LtUl/8N0KY1n8EaPVt7ezDN/IRpXCQ38H0W+bZK9biwLelEg 5vqolg637i9ph8+G6OQRrS/7tu6pUqKkgZjJl2ut8EAG8n9RL25BFDSJkMfLnfcgjskMhNR+1 6/4VHkxAMfUg5JrcurWTpbAjMeaaQOZKDH0oaQMGmCk9nMglOgSVx+aU44wyf3+sZSmMbKWIm dfsVc4j0f5ScWmD/f5uY0ier758zhzToku3K4dNZmOkjqe1gLnedLNb0YzZdwWPXliBKA8TO7 dtf0aLufeSevupE+lpNB0hTLS/lmWgV4i9bqSy9R/eIYt/Huo7zs462F7oiDIzTMDv2i5dbOX 5jI+pYQjtM+GAfnQnYWbBIuxOh1mKLzjj5+d0pfL5jbm3MEJEpuQyE9gDqVVT5uzuB+h63ebW Q99n9MiFzcb+YfJdLMZAcrRYAFi6NdKR8DhjvGf/zDa9mG6yn9YRuiadpzjSjwT4f43JpWflF QIEIUENTX4j5xmLXd1jUWYOEHd+rMEkUSjK326wWGnf59MfKH4G7E1ia3ZmFZLjHOE7kvsh Received-SPF: none client-ip=212.227.126.130; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/07 05:17:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Timothy E Baldwin , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Timothy E Baldwin info->brk was erroneously set to the end of highest addressed writable segment which could result it in overlapping the executable. As per load_elf_binary in fs/binfmt_elf.c in Linux, it should be set to end of highest addressed segment. Signed-off-by: Timothy E Baldwin Reviewed-by: Richard Henderson Message-Id: <20200728224615.326675-1-T.E.Baldwin99@members.leeds.ac.uk> Signed-off-by: Laurent Vivier --- linux-user/elfload.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 2.26.2 diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 04c28cbb9ecb..4961e6119e24 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2580,9 +2580,9 @@ static void load_elf_image(const char *image_name, int image_fd, if (vaddr_ef > info->end_data) { info->end_data = vaddr_ef; } - if (vaddr_em > info->brk) { - info->brk = vaddr_em; - } + } + if (vaddr_em > info->brk) { + info->brk = vaddr_em; } } else if (eppnt->p_type == PT_INTERP && pinterp_name) { char *interp_name; @@ -2637,7 +2637,6 @@ static void load_elf_image(const char *image_name, int image_fd, if (info->end_data == 0) { info->start_data = info->end_code; info->end_data = info->end_code; - info->brk = info->end_code; } if (qemu_log_enabled()) { From patchwork Mon Sep 7 09:17:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 249206 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp3521656ilg; Mon, 7 Sep 2020 02:18:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2xhW80ZaSDShI8Pl9Q7t8pY4eYWyHl38sjE9j9RSSBU1GjoTD5ewOMUFED7yjn0M4oJaX X-Received: by 2002:a25:ca85:: with SMTP id a127mr27032618ybg.113.1599470292457; Mon, 07 Sep 2020 02:18:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599470292; cv=none; d=google.com; s=arc-20160816; b=wEpenyLbm3MeFjvWAA8GVobtaOy7cTnJb/5Z3krg4E0zpH5RQEeV/cSaeb9KrTFCWG 37T3DbbsqyBmZ+yxAIHMu3y9BBB224OWIXOJOuuDSsOMHNPOAMbMSo0oPa1uLwnAPbSn 4Xg432vJB6SZ8YRYDZDxKLlXjtln2r4AQ8vjuCxBEj+VFi2MUMiEhUmbpn5qCQtkvQXQ ivZO2As95hjU/X8hwW6Fab9tdoZ2CKr6VHSeC1f9V1QZL6+3TupYxc720mMmMJLdT/d6 JbzLTSYPDiY+vWDwubUDUT0tXHsRYt5SAofsGt3adZ5wm7yRxM1csYGmeR/HOqiaMn23 zGwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=md1P8Uif5ME2GGnXcajEwOthl/Frv+0F7X6L7JuA0rY=; b=CCq2XcPQuNK0tmIfgG/afd2Whu76T4nYzSBM8ylnW1xctv4fOkh1Yz4wgV3xKEC+zD pdLb5zQZVkRJSIol1o0lj0r6q+yeBN0ABdDcBH8obzD9fpFoZpUtG9sOvjTV5DoGTRb5 eYd1CZfTugcOsLbncwv3C1eyne8mb1j7850hbyBfTq71MVVxQeNavRo9M0onoLrkoVWv To/jQ68TGCjR9FZkVmMKxLTd9Dr/Y96UMQ4caKXH9qeKqLf+I6j5QgU1GifEvMlQLmdi LBlLfF+bIDahO4YIKh86tJpuDgJaV3legO1CNKFV/nGJ2QFlv88GkqbiZUSuvgujHR9A 5Mfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t4si2313133ybo.60.2020.09.07.02.18.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Sep 2020 02:18:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:55276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFDHv-0005Yu-Sw for patch@linaro.org; Mon, 07 Sep 2020 05:18:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFDHl-0005Vs-8V for qemu-devel@nongnu.org; Mon, 07 Sep 2020 05:18:01 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:39529) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFDHi-0002ag-9u for qemu-devel@nongnu.org; Mon, 07 Sep 2020 05:18:00 -0400 Received: from localhost.localdomain ([82.252.135.186]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M1rGy-1kHP9226vo-002JmW; Mon, 07 Sep 2020 11:17:56 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 3/5] linux-user: Map signal numbers in fcntl Date: Mon, 7 Sep 2020 11:17:46 +0200 Message-Id: <20200907091748.376101-4-laurent@vivier.eu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200907091748.376101-1-laurent@vivier.eu> References: <20200907091748.376101-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:5I++V1PHEcNFxv/1ac2bZzma1ITTIKhJYuE8s/AfKGb4vpTiCw3 YGroeprqgP2T2IC7BAs8yLq2OqzkW5wXeGuu6aHmX8V73lD5D7HDkyE7WV+tRbq7XOfVQe8 V8pzkuT8r2q4Ytsr8iQKDDDhfmRh7bpdDF4bvnlUKY6KOCnruLFNUqdsgPjzIOYnj2YL9Wd HQxM0SI9pxIfLnk2p8r3g== X-UI-Out-Filterresults: notjunk:1; V03:K0:omUjcF4NAKc=:ZiK7KcfGJ4VdFphpz3bv5T QjDk1zQVs/ji+alkD+HVlHEUS6w/8TbVHOIW0fC4WV68iHBmO2XNi83e1+64MZsKl52olhn+l 98a+3Ar/+tBL/5QO52E3F5FKnTppjxTvFLt9XlI+dawq+cjf20xczSeWLTe0LeUUUmEwkojfm i2QgDM6S3dfmeTHzNL4x10rU3ep0WkbwPcwoJ58C54WZReQ8Cvtsxvu7omwO+cDJHMhfGeR9t 7T9kIco8jruh8sPtqgFlN7V0XRN8WP2zt61zVhyuyXWRk53MzlFRVD2d5j+JAhcy7KVM84Eqo 7QhRydGxhXXY6XxhsnsBcVTyVVk3pj8cNGWfSY2zRvkpTonWFJrDMEJS1tZNmzkcB5C+iRp3k ssvtVtEw2R6XSjlgtDIvceW6Zw/onJ4dZrXQ9yc07rD14R1klwE3Io+jmbpnZJ1TH/kg3kdLB U/5bmwWL3kzQbdwJ5bRVEUPGcoLfYJTwL0KexXF5OHBVUHfiB7xSJwB7NxNYiBF3fGibVQAwE fmPxL0OvmvH49xvKZflrRrCNUXYYaTl9lp9j0YXiiraHDQmD78BETTWmYBf0sOyViS3al4gvH bEdMHPmIliI204zuQx+u3evZB1oEr5FCAKKAglZf7UESaG4P725ES/XVEfhToWpeO2onoIbBM DpzieR40HqJtKaSHolZV1czD1cPEG+87j9yzPneXRvGPWKXKcsacW22kJuE9tHCW5JPPH3o0t a79CGRmOZJ7ShJpJFTrAKqW1rvMm0dzSUGd7SKPONtgJ+6b9uOl8ThlyrBc1g2+riLCOR/4Xs vPwc/6YBvZ/KHrA7D3cJ83IhdhqzKUWz7PCRCVV2IC7Bwj2B3ndlfLDmmrwFTPeR4tLjlgV Received-SPF: none client-ip=212.227.126.130; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/07 05:17:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Timothy Baldwin , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Timothy Baldwin Map signal numbers in fcntl F_SETSIG and F_GETSIG. Signed-off-by: Timothy E Baldwin Reviewed-by: Laurent Vivier Message-Id: <72cc725c-f344-b7f1-d559-401867067d80@members.leeds.ac.uk> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.26.2 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 07220eee40c5..55ac5c320825 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6874,10 +6874,16 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) break; #endif - case TARGET_F_SETOWN: - case TARGET_F_GETOWN: case TARGET_F_SETSIG: + ret = get_errno(safe_fcntl(fd, host_cmd, target_to_host_signal(arg))); + break; + case TARGET_F_GETSIG: + ret = host_to_target_signal(get_errno(safe_fcntl(fd, host_cmd, arg))); + break; + + case TARGET_F_SETOWN: + case TARGET_F_GETOWN: case TARGET_F_SETLEASE: case TARGET_F_GETLEASE: case TARGET_F_SETPIPE_SZ: From patchwork Mon Sep 7 09:17:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 274415 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3250C2BB84 for ; Mon, 7 Sep 2020 09:20:10 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 984B42078E for ; Mon, 7 Sep 2020 09:20:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 984B42078E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=vivier.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFDJp-0000k8-Q1 for qemu-devel@archiver.kernel.org; Mon, 07 Sep 2020 05:20:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFDHl-0005Vy-Bk for qemu-devel@nongnu.org; Mon, 07 Sep 2020 05:18:01 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:51277) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFDHj-0002aw-MV for qemu-devel@nongnu.org; Mon, 07 Sep 2020 05:18:01 -0400 Received: from localhost.localdomain ([82.252.135.186]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MjxW4-1kzEI03xea-00kPxU; Mon, 07 Sep 2020 11:17:57 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 4/5] linux-user: fix ppc/termbits.h Date: Mon, 7 Sep 2020 11:17:47 +0200 Message-Id: <20200907091748.376101-5-laurent@vivier.eu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200907091748.376101-1-laurent@vivier.eu> References: <20200907091748.376101-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:jbfamT63ByKgicL18n+NOk+WGLQ5ri9tl1iJxUTyhdVCJtk26up QUAA7RbxsPcF0ALzWe9+6fR2VirMm2+Gb0ypvZ2LQL5LqvbTAYWSBU4GXjL4CYptmxvNiEi 7tR5OsHD77b9AJm5FNyGN0PaZMW/JE4IUaeWhghozbq4nemENndf8yBevKq/vKxEVwmVbtM QfuUEe1X19Ck/GOCiKxcQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:EfuTBAaUjK8=:fY6Dpel4KIoCuH3NVoUfQH +VKR2wWXPPRkghXhWWzHhOENfDR9I7jko8cLn57LBv549RNuNRcg22PMeb/qX6nzBSGjN15+q cLDj/fR6wBm7LStVxbKCu95Gh/ns0P2U6TKrRtxyoFN/lMifIcG2aCnDihOj9c9nrUwz3JzMo JS8pl8AQ2jZR4uQ2jgU5xsOcg4yrOlvUMJHUAJFP3JHtBuJRO1wv/qneLc41brfYTH0c3oyKh SKgylYVohGrsExL+Mcf3Rna91vyZQy//Qk7N84eCV+vBJ5vyGiC6cuabMl0oNSLZU08UbKprq P38UyoPEgHFzwVKnJ26V2omL5PS7dIvsUMcE/Qx5f7T7g97NVglXnG2O2KFf3EkK3FHxPThpb 3g67Y5DAPKLlXmLgaEQTn+2QXXRtDXbPpSpoqVOZ783U2nCfSpryVRjEUwofKmP2PCx35OKcR aekSI9Pzd0AwIQrD5TM3FWoC/jW5XtENOaOHPEcBOuk446QJ4tPpZLGJoF5m4IIvcsohGot1h ATDqMzcj5mvRZOnGySXdvs/CyBbX+A4JQCaET1v9p1m4PMcyD4MKI6yeELiJPSVv0P/uvsuIF RId4JetrmZQaseIjfMrQmgT3/Jlixoysv9A6+hdzn23SCiQ+mpwVW83CpUvL8cQEk0tmRz6pl I1CPXLrtf/JpzAoaxqqlWw5DAT9i25rVwogTthPpJjOTFMAnU/9TPC6PWUhbiCWqI3OeV63Vz /M/ueYplHcIZU/k/HhiF9A3GBocS8cJIHfoMogYBKP4WTyFdACbY7+HqI7BMgH9T6FzJ5+rK6 51dK/DUJ5bZXbjzHHdmatcw2qUgLSA383LnQyzdX+cKzkLNmJw/HjIpRITecHxCpHMJ6ybg Received-SPF: none client-ip=212.227.126.135; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/07 05:17:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Filip.Bozuta@syrmia.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On ppc, in termios, c_line is after c_cc, not before . Fixes: c218b4ede4f9 ("linux-user: Add missing termbits types and values definitions") Cc: Filip.Bozuta@syrmia.com Signed-off-by: Laurent Vivier Message-Id: <20200830181620.422036-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier --- linux-user/ppc/termbits.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/ppc/termbits.h b/linux-user/ppc/termbits.h index 7066d1e5523d..eb226e099980 100644 --- a/linux-user/ppc/termbits.h +++ b/linux-user/ppc/termbits.h @@ -14,8 +14,8 @@ struct target_termios { target_tcflag_t c_oflag; /* output mode flags */ target_tcflag_t c_cflag; /* control mode flags */ target_tcflag_t c_lflag; /* local mode flags */ - target_cc_t c_line; /* line discipline */ target_cc_t c_cc[TARGET_NCCS]; /* control characters */ + target_cc_t c_line; /* line discipline */ target_speed_t c_ispeed; /* input speed */ target_speed_t c_ospeed; /* output speed */ }; From patchwork Mon Sep 7 09:17:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 306089 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 287FCC43461 for ; Mon, 7 Sep 2020 09:21:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7E7922078E for ; Mon, 7 Sep 2020 09:21:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E7922078E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=vivier.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFDL2-0002Pg-Lt for qemu-devel@archiver.kernel.org; Mon, 07 Sep 2020 05:21:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFDHm-0005Xp-D9 for qemu-devel@nongnu.org; Mon, 07 Sep 2020 05:18:02 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:44743) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFDHj-0002ay-QE for qemu-devel@nongnu.org; Mon, 07 Sep 2020 05:18:02 -0400 Received: from localhost.localdomain ([82.252.135.186]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Md76B-1koXyA1bnP-00aGgh; Mon, 07 Sep 2020 11:17:57 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 5/5] linux-user: Protect btrfs ioctl target definitions Date: Mon, 7 Sep 2020 11:17:48 +0200 Message-Id: <20200907091748.376101-6-laurent@vivier.eu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200907091748.376101-1-laurent@vivier.eu> References: <20200907091748.376101-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:9bTeDSuOVnORdAtmx/OWwYEKWqgey9U/ZpINi2pdSvTFbm6Lnd8 xaCjsLmhsoaaIqAOxPmwIx+QIlBoJ5MpESjaNijkpgj51xpWbm41RTVur+97CLfRfHl12t/ edg1gRKyWToVamSNhS7NDoO1TMnIOnQJODrxmyvog95/9TvCC0MAzQQBD0WPo+TlK5SaYeo IFgJJ1n/jjHWphtJkLgMw== X-UI-Out-Filterresults: notjunk:1; V03:K0:nggVGtVBxcU=:3oFpqTkngSIWMbILRsmrlZ GHjQLIMcVPJkpETcDDylszV7AKPnALCSuKnFtq+tUT1UrFvKxGJ4eouQIBcgTXwHIzHw+5sBB xbJbwycRRM/xoIxX8jJTVE6d7hls0CceA/obc4w6mlTZ40hgkTDslI9h73evD6Lwfiyek1Qvt Q/r4ol2z/HOyMcfj1/7cUjPgbXPNp21LHlD5mshRJwt3jWodvFkS3t8Md/uVi6NZoOzK278RA RbsyuTabZjI3sHWf7orkRL1QjW9Yp1HsZnKV7UI8COiC35my1xjdL95irglWtZKIyUfn+6C5t /gP7cshpWV6MCVmUfSu6DMzdajDMqu9lwj3GSpZtiB6UA13t1iT9qK9LjUSL7Vqwo7FANv+8P FyGv+xqhqpUfPaWTwNRjY/fzPsDqcfK2KhfGTmixxkOqCBWEtLxqXnZDuoRjhj4q4e8OVhipT 09izLHL4Q6Rhtr3VKGLT9m4iZd1nbNCk3hlYqQaGJxmWzd7kDwnk24Xiu6ZAHVPzYeyIOLNa8 W90JNrKyG6akk+doFW4g0neOa4z6KFztYaFqD7BGSouKWHoMrEQrBoY42G4djtZwj8eAJ4nIp GPSXw7SwjNuY7ST11IZtXaPZGsoMNfb8BKkh/66VM7Wi5dHAHmvGUU3kUQmYemgzTK6k64Vuk oOveavdgKGtICNsw3AkQcnk0cIA1aqVbQNjvRmJq97eiaSfXulY2nvZe9TRI/wYPmItlX+tZb ekTKSJnFbUGXH+IMADmDXQ/cCMQrkGBnsc1g6MVrOQb3NwrAsVEH1kcqQ9EI30cbIHNNc+5cy s8ZCqgRe2BVsvV4SMDsmdmRl64rBPhHYuO8Xvvzlr/HzQoKtJl21HYksGa3nKG9SA5kiLJf Received-SPF: none client-ip=212.227.126.130; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/07 05:17:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Filip Bozuta Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Filip Bozuta Target definitions of btrfs ioctls in 'syscall_defs.h' use the value BTRFS_IOCTL_MAGIC that is defined header 'btrfs.h'. This header is not available in kernel versions before 3.9. For that reason, these target ioctl definitions should be enwrapped in an #ifdef directive to check whether the 'btrfs.h' header is available as to not cause build errors on older Linux systems. Signed-off-by: Filip Bozuta Reviewed-by: Laurent Vivier Message-Id: <20200905163802.2666-1-Filip.Bozuta@syrmia.com> Signed-off-by: Laurent Vivier --- linux-user/syscall_defs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 33a414c50f19..731c3d5341a9 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1006,6 +1006,7 @@ struct target_rtc_pll_info { #define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int) /* btrfs ioctls */ +#ifdef CONFIG_BTRFS #define TARGET_BTRFS_IOC_SNAP_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 1) #define TARGET_BTRFS_IOC_SCAN_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 4) #define TARGET_BTRFS_IOC_FORGET_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 5) @@ -1041,6 +1042,7 @@ struct target_rtc_pll_info { #define TARGET_BTRFS_IOC_GET_SUBVOL_INFO TARGET_IORU(BTRFS_IOCTL_MAGIC, 60) #define TARGET_BTRFS_IOC_GET_SUBVOL_ROOTREF TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 61) #define TARGET_BTRFS_IOC_INO_LOOKUP_USER TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 62) +#endif /* usb ioctls */ #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)