]> Git Repo - linux.git/commitdiff
Merge branch 'linus' into timers/2038
authorThomas Gleixner <[email protected]>
Sat, 19 May 2018 11:55:40 +0000 (13:55 +0200)
committerThomas Gleixner <[email protected]>
Sat, 19 May 2018 11:55:40 +0000 (13:55 +0200)
Merge upstream to pick up changes on which pending patches depend on.

1  2 
arch/Kconfig
arch/x86/events/core.c
arch/x86/include/asm/ftrace.h
drivers/s390/net/qeth_core_main.c
include/uapi/linux/time.h
kernel/compat.c
kernel/time/hrtimer.c
kernel/time/posix-stubs.c
kernel/time/posix-timers.c

diff --combined arch/Kconfig
index 4377b0cec976bb8d4632721b2a68ef984b6af626,75dd23acf133b089384db7e9071a37980e98c5ea..e30c3fa343bde72a24b5b23efb24efc454e7d735
@@@ -464,6 -464,10 +464,10 @@@ config GCC_PLUGIN_LATENT_ENTROP
  config GCC_PLUGIN_STRUCTLEAK
        bool "Force initialization of variables containing userspace addresses"
        depends on GCC_PLUGINS
+       # Currently STRUCTLEAK inserts initialization out of live scope of
+       # variables from KASAN point of view. This leads to KASAN false
+       # positive reports. Prohibit this combination for now.
+       depends on !KASAN_EXTRA
        help
          This plugin zero-initializes any structures containing a
          __user attribute. This can prevent some classes of information
@@@ -870,21 -874,6 +874,21 @@@ config OLD_SIGACTIO
  config COMPAT_OLD_SIGACTION
        bool
  
 +config 64BIT_TIME
 +      def_bool ARCH_HAS_64BIT_TIME
 +      help
 +        This should be selected by all architectures that need to support
 +        new system calls with a 64-bit time_t. This is relevant on all 32-bit
 +        architectures, and 64-bit architectures as part of compat syscall
 +        handling.
 +
 +config COMPAT_32BIT_TIME
 +      def_bool (!64BIT && 64BIT_TIME) || COMPAT
 +      help
 +        This enables 32 bit time_t support in addition to 64 bit time_t support.
 +        This is relevant on all 32-bit architectures, and 64-bit architectures
 +        as part of compat syscall handling.
 +
  config ARCH_NO_COHERENT_DMA_MMAP
        bool
  
diff --combined arch/x86/events/core.c
index 7a987e6c7c356faa88f0c4cfbea7ebb377173115,45b2b1c93d042231979e621970167f583cb444f5..6e461fb1e0d476f80def177b43c7cc01726d89ce
@@@ -27,6 -27,7 +27,7 @@@
  #include <linux/cpu.h>
  #include <linux/bitops.h>
  #include <linux/device.h>
+ #include <linux/nospec.h>
  
  #include <asm/apic.h>
  #include <asm/stacktrace.h>
@@@ -304,17 -305,20 +305,20 @@@ set_ext_hw_attr(struct hw_perf_event *h
  
        config = attr->config;
  
-       cache_type = (config >>  0) & 0xff;
+       cache_type = (config >> 0) & 0xff;
        if (cache_type >= PERF_COUNT_HW_CACHE_MAX)
                return -EINVAL;
+       cache_type = array_index_nospec(cache_type, PERF_COUNT_HW_CACHE_MAX);
  
        cache_op = (config >>  8) & 0xff;
        if (cache_op >= PERF_COUNT_HW_CACHE_OP_MAX)
                return -EINVAL;
+       cache_op = array_index_nospec(cache_op, PERF_COUNT_HW_CACHE_OP_MAX);
  
        cache_result = (config >> 16) & 0xff;
        if (cache_result >= PERF_COUNT_HW_CACHE_RESULT_MAX)
                return -EINVAL;
+       cache_result = array_index_nospec(cache_result, PERF_COUNT_HW_CACHE_RESULT_MAX);
  
        val = hw_cache_event_ids[cache_type][cache_op][cache_result];
  
@@@ -421,6 -425,8 +425,8 @@@ int x86_setup_perfctr(struct perf_even
        if (attr->config >= x86_pmu.max_events)
                return -EINVAL;
  
+       attr->config = array_index_nospec((unsigned long)attr->config, x86_pmu.max_events);
        /*
         * The generic map:
         */
@@@ -2391,7 -2397,7 +2397,7 @@@ static unsigned long get_segment_base(u
  
  #ifdef CONFIG_IA32_EMULATION
  
 -#include <asm/compat.h>
 +#include <linux/compat.h>
  
  static inline int
  perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry_ctx *entry)
index db25aa15b7055fa57b729ff650ccea061507a135,cc8f8fcf9b4aad1031b80a37717e3fcbb7aced98..c18ed65287d5eda607c009bf747fc67f81743dfc
@@@ -46,10 -46,24 +46,24 @@@ int ftrace_int3_handler(struct pt_regs 
  #endif /* CONFIG_FUNCTION_TRACER */
  
  
- #if !defined(__ASSEMBLY__) && !defined(COMPILE_OFFSETS)
+ #ifndef __ASSEMBLY__
+ #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
+ static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
+ {
+       /*
+        * Compare the symbol name with the system call name. Skip the
+        * "__x64_sys", "__ia32_sys" or simple "sys" prefix.
+        */
+       return !strcmp(sym + 3, name + 3) ||
+               (!strncmp(sym, "__x64_", 6) && !strcmp(sym + 9, name + 3)) ||
+               (!strncmp(sym, "__ia32_", 7) && !strcmp(sym + 10, name + 3));
+ }
+ #ifndef COMPILE_OFFSETS
  
  #if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_IA32_EMULATION)
 -#include <asm/compat.h>
 +#include <linux/compat.h>
  
  /*
   * Because ia32 syscalls do not map to x86_64 syscall numbers
@@@ -67,6 -81,7 +81,7 @@@ static inline bool arch_trace_is_compat
        return false;
  }
  #endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_IA32_EMULATION */
- #endif /* !__ASSEMBLY__  && !COMPILE_OFFSETS */
+ #endif /* !COMPILE_OFFSETS */
+ #endif /* !__ASSEMBLY__ */
  
  #endif /* _ASM_X86_FTRACE_H */
index df5d8451a51a12760bcd2ef8893e61cf2f07ac1c,dffd820731f2a53f9a5c58f0f9da78df72c2a0cf..f5a0d894d9add3841dede0ad16303165910220e7
@@@ -10,7 -10,6 +10,7 @@@
  #define KMSG_COMPONENT "qeth"
  #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
  
 +#include <linux/compat.h>
  #include <linux/module.h>
  #include <linux/moduleparam.h>
  #include <linux/string.h>
@@@ -33,6 -32,7 +33,6 @@@
  #include <asm/chpid.h>
  #include <asm/io.h>
  #include <asm/sysinfo.h>
 -#include <asm/compat.h>
  #include <asm/diag.h>
  #include <asm/cio.h>
  #include <asm/ccwdev.h>
@@@ -706,7 -706,6 +706,6 @@@ void qeth_clear_ipacmd_list(struct qeth
                qeth_put_reply(reply);
        }
        spin_unlock_irqrestore(&card->lock, flags);
-       atomic_set(&card->write.irq_pending, 0);
  }
  EXPORT_SYMBOL_GPL(qeth_clear_ipacmd_list);
  
@@@ -818,7 -817,6 +817,6 @@@ void qeth_clear_cmd_buffers(struct qeth
  
        for (cnt = 0; cnt < QETH_CMD_BUFFER_NO; cnt++)
                qeth_release_buffer(channel, &channel->iob[cnt]);
-       channel->buf_no = 0;
        channel->io_buf_no = 0;
  }
  EXPORT_SYMBOL_GPL(qeth_clear_cmd_buffers);
@@@ -924,7 -922,6 +922,6 @@@ static int qeth_setup_channel(struct qe
                        kfree(channel->iob[cnt].data);
                return -ENOMEM;
        }
-       channel->buf_no = 0;
        channel->io_buf_no = 0;
        atomic_set(&channel->irq_pending, 0);
        spin_lock_init(&channel->iob_lock);
@@@ -1100,16 -1097,9 +1097,9 @@@ static void qeth_irq(struct ccw_device 
  {
        int rc;
        int cstat, dstat;
-       struct qeth_cmd_buffer *buffer;
+       struct qeth_cmd_buffer *iob = NULL;
        struct qeth_channel *channel;
        struct qeth_card *card;
-       struct qeth_cmd_buffer *iob;
-       __u8 index;
-       if (__qeth_check_irb_error(cdev, intparm, irb))
-               return;
-       cstat = irb->scsw.cmd.cstat;
-       dstat = irb->scsw.cmd.dstat;
  
        card = CARD_FROM_CDEV(cdev);
        if (!card)
                channel = &card->data;
                QETH_CARD_TEXT(card, 5, "data");
        }
+       if (qeth_intparm_is_iob(intparm))
+               iob = (struct qeth_cmd_buffer *) __va((addr_t)intparm);
+       if (__qeth_check_irb_error(cdev, intparm, irb)) {
+               /* IO was terminated, free its resources. */
+               if (iob)
+                       qeth_release_buffer(iob->channel, iob);
+               atomic_set(&channel->irq_pending, 0);
+               wake_up(&card->wait_q);
+               return;
+       }
        atomic_set(&channel->irq_pending, 0);
  
        if (irb->scsw.cmd.fctl & (SCSW_FCTL_CLEAR_FUNC))
                /* we don't have to handle this further */
                intparm = 0;
        }
+       cstat = irb->scsw.cmd.cstat;
+       dstat = irb->scsw.cmd.dstat;
        if ((dstat & DEV_STAT_UNIT_EXCEP) ||
            (dstat & DEV_STAT_UNIT_CHECK) ||
            (cstat)) {
                channel->state = CH_STATE_RCD_DONE;
                goto out;
        }
-       if (intparm) {
-               buffer = (struct qeth_cmd_buffer *) __va((addr_t)intparm);
-               buffer->state = BUF_STATE_PROCESSED;
-       }
        if (channel == &card->data)
                return;
        if (channel == &card->read &&
            channel->state == CH_STATE_UP)
                __qeth_issue_next_read(card);
  
-       iob = channel->iob;
-       index = channel->buf_no;
-       while (iob[index].state == BUF_STATE_PROCESSED) {
-               if (iob[index].callback != NULL)
-                       iob[index].callback(channel, iob + index);
+       if (iob && iob->callback)
+               iob->callback(iob->channel, iob);
  
-               index = (index + 1) % QETH_CMD_BUFFER_NO;
-       }
-       channel->buf_no = index;
  out:
        wake_up(&card->wait_q);
        return;
@@@ -1870,8 -1867,8 +1867,8 @@@ static int qeth_idx_activate_get_answer
                   atomic_cmpxchg(&channel->irq_pending, 0, 1) == 0);
        QETH_DBF_TEXT(SETUP, 6, "noirqpnd");
        spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags);
-       rc = ccw_device_start(channel->ccwdev,
-                             &channel->ccw, (addr_t) iob, 0, 0);
+       rc = ccw_device_start_timeout(channel->ccwdev, &channel->ccw,
+                                     (addr_t) iob, 0, 0, QETH_TIMEOUT);
        spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags);
  
        if (rc) {
        if (channel->state != CH_STATE_UP) {
                rc = -ETIME;
                QETH_DBF_TEXT_(SETUP, 2, "3err%d", rc);
-               qeth_clear_cmd_buffers(channel);
        } else
                rc = 0;
        return rc;
@@@ -1942,8 -1938,8 +1938,8 @@@ static int qeth_idx_activate_channel(st
                   atomic_cmpxchg(&channel->irq_pending, 0, 1) == 0);
        QETH_DBF_TEXT(SETUP, 6, "noirqpnd");
        spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags);
-       rc = ccw_device_start(channel->ccwdev,
-                             &channel->ccw, (addr_t) iob, 0, 0);
+       rc = ccw_device_start_timeout(channel->ccwdev, &channel->ccw,
+                                     (addr_t) iob, 0, 0, QETH_TIMEOUT);
        spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags);
  
        if (rc) {
                QETH_DBF_MESSAGE(2, "%s IDX activate timed out\n",
                        dev_name(&channel->ccwdev->dev));
                QETH_DBF_TEXT_(SETUP, 2, "2err%d", -ETIME);
-               qeth_clear_cmd_buffers(channel);
                return -ETIME;
        }
        return qeth_idx_activate_get_answer(channel, idx_reply_cb);
@@@ -2166,8 -2161,8 +2161,8 @@@ int qeth_send_control_data(struct qeth_
  
        QETH_CARD_TEXT(card, 6, "noirqpnd");
        spin_lock_irqsave(get_ccwdev_lock(card->write.ccwdev), flags);
-       rc = ccw_device_start(card->write.ccwdev, &card->write.ccw,
-                             (addr_t) iob, 0, 0);
+       rc = ccw_device_start_timeout(CARD_WDEV(card), &card->write.ccw,
+                                     (addr_t) iob, 0, 0, event_timeout);
        spin_unlock_irqrestore(get_ccwdev_lock(card->write.ccwdev), flags);
        if (rc) {
                QETH_DBF_MESSAGE(2, "%s qeth_send_control_data: "
                }
        }
  
-       if (reply->rc == -EIO)
-               goto error;
        rc = reply->rc;
        qeth_put_reply(reply);
        return rc;
@@@ -2211,10 -2204,6 +2204,6 @@@ time_err
        list_del_init(&reply->list);
        spin_unlock_irqrestore(&reply->card->lock, flags);
        atomic_inc(&reply->received);
- error:
-       atomic_set(&card->write.irq_pending, 0);
-       qeth_release_buffer(iob->channel, iob);
-       card->write.buf_no = (card->write.buf_no + 1) % QETH_CMD_BUFFER_NO;
        rc = reply->rc;
        qeth_put_reply(reply);
        return rc;
@@@ -3033,28 -3022,23 +3022,23 @@@ static int qeth_send_startlan(struct qe
        return rc;
  }
  
- static int qeth_default_setadapterparms_cb(struct qeth_card *card,
-               struct qeth_reply *reply, unsigned long data)
+ static int qeth_setadpparms_inspect_rc(struct qeth_ipa_cmd *cmd)
  {
-       struct qeth_ipa_cmd *cmd;
-       QETH_CARD_TEXT(card, 4, "defadpcb");
-       cmd = (struct qeth_ipa_cmd *) data;
-       if (cmd->hdr.return_code == 0)
+       if (!cmd->hdr.return_code)
                cmd->hdr.return_code =
                        cmd->data.setadapterparms.hdr.return_code;
-       return 0;
+       return cmd->hdr.return_code;
  }
  
  static int qeth_query_setadapterparms_cb(struct qeth_card *card,
                struct qeth_reply *reply, unsigned long data)
  {
-       struct qeth_ipa_cmd *cmd;
+       struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;
  
        QETH_CARD_TEXT(card, 3, "quyadpcb");
+       if (qeth_setadpparms_inspect_rc(cmd))
+               return 0;
  
-       cmd = (struct qeth_ipa_cmd *) data;
        if (cmd->data.setadapterparms.data.query_cmds_supp.lan_type & 0x7f) {
                card->info.link_type =
                      cmd->data.setadapterparms.data.query_cmds_supp.lan_type;
        }
        card->options.adp.supported_funcs =
                cmd->data.setadapterparms.data.query_cmds_supp.supported_cmds;
-       return qeth_default_setadapterparms_cb(card, reply, (unsigned long)cmd);
+       return 0;
  }
  
  static struct qeth_cmd_buffer *qeth_get_adapter_cmd(struct qeth_card *card,
@@@ -3154,22 -3138,20 +3138,20 @@@ EXPORT_SYMBOL_GPL(qeth_query_ipassists)
  static int qeth_query_switch_attributes_cb(struct qeth_card *card,
                                struct qeth_reply *reply, unsigned long data)
  {
-       struct qeth_ipa_cmd *cmd;
-       struct qeth_switch_info *sw_info;
+       struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;
        struct qeth_query_switch_attributes *attrs;
+       struct qeth_switch_info *sw_info;
  
        QETH_CARD_TEXT(card, 2, "qswiatcb");
-       cmd = (struct qeth_ipa_cmd *) data;
-       sw_info = (struct qeth_switch_info *)reply->param;
-       if (cmd->data.setadapterparms.hdr.return_code == 0) {
-               attrs = &cmd->data.setadapterparms.data.query_switch_attributes;
-               sw_info->capabilities = attrs->capabilities;
-               sw_info->settings = attrs->settings;
-               QETH_CARD_TEXT_(card, 2, "%04x%04x", sw_info->capabilities,
-                                                       sw_info->settings);
-       }
-       qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd);
+       if (qeth_setadpparms_inspect_rc(cmd))
+               return 0;
  
+       sw_info = (struct qeth_switch_info *)reply->param;
+       attrs = &cmd->data.setadapterparms.data.query_switch_attributes;
+       sw_info->capabilities = attrs->capabilities;
+       sw_info->settings = attrs->settings;
+       QETH_CARD_TEXT_(card, 2, "%04x%04x", sw_info->capabilities,
+                       sw_info->settings);
        return 0;
  }
  
@@@ -4207,16 -4189,13 +4189,13 @@@ EXPORT_SYMBOL_GPL(qeth_do_send_packet)
  static int qeth_setadp_promisc_mode_cb(struct qeth_card *card,
                struct qeth_reply *reply, unsigned long data)
  {
-       struct qeth_ipa_cmd *cmd;
+       struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;
        struct qeth_ipacmd_setadpparms *setparms;
  
        QETH_CARD_TEXT(card, 4, "prmadpcb");
  
-       cmd = (struct qeth_ipa_cmd *) data;
        setparms = &(cmd->data.setadapterparms);
-       qeth_default_setadapterparms_cb(card, reply, (unsigned long)cmd);
-       if (cmd->hdr.return_code) {
+       if (qeth_setadpparms_inspect_rc(cmd)) {
                QETH_CARD_TEXT_(card, 4, "prmrc%x", cmd->hdr.return_code);
                setparms->data.mode = SET_PROMISC_MODE_OFF;
        }
@@@ -4286,18 -4265,18 +4265,18 @@@ EXPORT_SYMBOL_GPL(qeth_get_stats)
  static int qeth_setadpparms_change_macaddr_cb(struct qeth_card *card,
                struct qeth_reply *reply, unsigned long data)
  {
-       struct qeth_ipa_cmd *cmd;
+       struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;
  
        QETH_CARD_TEXT(card, 4, "chgmaccb");
+       if (qeth_setadpparms_inspect_rc(cmd))
+               return 0;
  
-       cmd = (struct qeth_ipa_cmd *) data;
        if (!card->options.layer2 ||
            !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) {
                ether_addr_copy(card->dev->dev_addr,
                                cmd->data.setadapterparms.data.change_addr.addr);
                card->info.mac_bits |= QETH_LAYER2_MAC_READ;
        }
-       qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd);
        return 0;
  }
  
@@@ -4328,13 -4307,15 +4307,15 @@@ EXPORT_SYMBOL_GPL(qeth_setadpparms_chan
  static int qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card,
                struct qeth_reply *reply, unsigned long data)
  {
-       struct qeth_ipa_cmd *cmd;
+       struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;
        struct qeth_set_access_ctrl *access_ctrl_req;
        int fallback = *(int *)reply->param;
  
        QETH_CARD_TEXT(card, 4, "setaccb");
+       if (cmd->hdr.return_code)
+               return 0;
+       qeth_setadpparms_inspect_rc(cmd);
  
-       cmd = (struct qeth_ipa_cmd *) data;
        access_ctrl_req = &cmd->data.setadapterparms.data.set_access_ctrl;
        QETH_DBF_TEXT_(SETUP, 2, "setaccb");
        QETH_DBF_TEXT_(SETUP, 2, "%s", card->gdev->dev.kobj.name);
                        card->options.isolation = card->options.prev_isolation;
                break;
        }
-       qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd);
        return 0;
  }
  
  static int qeth_setadpparms_query_oat_cb(struct qeth_card *card,
                struct qeth_reply *reply, unsigned long data)
  {
-       struct qeth_ipa_cmd *cmd;
+       struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *)data;
        struct qeth_qoat_priv *priv;
        char *resdata;
        int resdatalen;
  
        QETH_CARD_TEXT(card, 3, "qoatcb");
+       if (qeth_setadpparms_inspect_rc(cmd))
+               return 0;
  
-       cmd = (struct qeth_ipa_cmd *)data;
        priv = (struct qeth_qoat_priv *)reply->param;
        resdatalen = cmd->data.setadapterparms.hdr.cmdlength;
        resdata = (char *)data + 28;
  static int qeth_query_card_info_cb(struct qeth_card *card,
                                   struct qeth_reply *reply, unsigned long data)
  {
-       struct qeth_ipa_cmd *cmd;
+       struct carrier_info *carrier_info = (struct carrier_info *)reply->param;
+       struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *)data;
        struct qeth_query_card_info *card_info;
-       struct carrier_info *carrier_info;
  
        QETH_CARD_TEXT(card, 2, "qcrdincb");
-       carrier_info = (struct carrier_info *)reply->param;
-       cmd = (struct qeth_ipa_cmd *)data;
-       card_info = &cmd->data.setadapterparms.data.card_info;
-       if (cmd->data.setadapterparms.hdr.return_code == 0) {
-               carrier_info->card_type = card_info->card_type;
-               carrier_info->port_mode = card_info->port_mode;
-               carrier_info->port_speed = card_info->port_speed;
-       }
+       if (qeth_setadpparms_inspect_rc(cmd))
+               return 0;
  
-       qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd);
+       card_info = &cmd->data.setadapterparms.data.card_info;
+       carrier_info->card_type = card_info->card_type;
+       carrier_info->port_mode = card_info->port_mode;
+       carrier_info->port_speed = card_info->port_speed;
        return 0;
  }
  
@@@ -4857,7 -4835,7 +4835,7 @@@ int qeth_vm_request_mac(struct qeth_car
                goto out;
        }
  
-       ccw_device_get_id(CARD_DDEV(card), &id);
+       ccw_device_get_id(CARD_RDEV(card), &id);
        request->resp_buf_len = sizeof(*response);
        request->resp_version = DIAG26C_VERSION2;
        request->op_code = DIAG26C_GET_MAC;
@@@ -6563,10 -6541,14 +6541,14 @@@ static int __init qeth_core_init(void
        mutex_init(&qeth_mod_mutex);
  
        qeth_wq = create_singlethread_workqueue("qeth_wq");
+       if (!qeth_wq) {
+               rc = -ENOMEM;
+               goto out_err;
+       }
  
        rc = qeth_register_dbf_views();
        if (rc)
-               goto out_err;
+               goto dbf_err;
        qeth_core_root_dev = root_device_register("qeth");
        rc = PTR_ERR_OR_ZERO(qeth_core_root_dev);
        if (rc)
@@@ -6603,6 -6585,8 +6585,8 @@@ slab_err
        root_device_unregister(qeth_core_root_dev);
  register_err:
        qeth_unregister_dbf_views();
+ dbf_err:
+       destroy_workqueue(qeth_wq);
  out_err:
        pr_err("Initializing the qeth device driver failed\n");
        return rc;
index 94adfae599e0179c990675d611dc26cab2f9f567,4c0338ea308a67b3f7dfe179651c7a55322ce6fb..fcf9366564936d5026c6e27cc56804debfb8eefb
@@@ -42,13 -42,6 +42,13 @@@ struct itimerval 
        struct timeval it_value;        /* current value */
  };
  
 +#ifndef __kernel_timespec
 +struct __kernel_timespec {
 +      __kernel_time64_t       tv_sec;                 /* seconds */
 +      long long               tv_nsec;                /* nanoseconds */
 +};
 +#endif
 +
  /*
   * legacy timeval structure, only embedded in structures that
   * traditionally used 'timeval' to pass time intervals (not absolute
@@@ -80,7 -73,6 +80,6 @@@ struct __kernel_old_timeval 
   */
  #define CLOCK_SGI_CYCLE                       10
  #define CLOCK_TAI                     11
- #define CLOCK_MONOTONIC_ACTIVE                12
  
  #define MAX_CLOCKS                    16
  #define CLOCKS_MASK                   (CLOCK_REALTIME | CLOCK_MONOTONIC)
diff --combined kernel/compat.c
index 51a081b468322b541b8d003ec0c413d197559b67,92d8c98c0f57ac92aacd888d9342debcdec46cdb..702aa846ddacabde1fdf4c0e29c491f5c9c10d00
@@@ -34,6 -34,7 +34,7 @@@ int compat_get_timex(struct timex *txc
  {
        struct compat_timex tx32;
  
+       memset(txc, 0, sizeof(struct timex));
        if (copy_from_user(&tx32, utp, sizeof(struct compat_timex)))
                return -EFAULT;
  
@@@ -120,6 -121,50 +121,6 @@@ static int __compat_put_timespec(const 
                        __put_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0;
  }
  
 -static int __compat_get_timespec64(struct timespec64 *ts64,
 -                                 const struct compat_timespec __user *cts)
 -{
 -      struct compat_timespec ts;
 -      int ret;
 -
 -      ret = copy_from_user(&ts, cts, sizeof(ts));
 -      if (ret)
 -              return -EFAULT;
 -
 -      ts64->tv_sec = ts.tv_sec;
 -      ts64->tv_nsec = ts.tv_nsec;
 -
 -      return 0;
 -}
 -
 -static int __compat_put_timespec64(const struct timespec64 *ts64,
 -                                 struct compat_timespec __user *cts)
 -{
 -      struct compat_timespec ts = {
 -              .tv_sec = ts64->tv_sec,
 -              .tv_nsec = ts64->tv_nsec
 -      };
 -      return copy_to_user(cts, &ts, sizeof(ts)) ? -EFAULT : 0;
 -}
 -
 -int compat_get_timespec64(struct timespec64 *ts, const void __user *uts)
 -{
 -      if (COMPAT_USE_64BIT_TIME)
 -              return copy_from_user(ts, uts, sizeof(*ts)) ? -EFAULT : 0;
 -      else
 -              return __compat_get_timespec64(ts, uts);
 -}
 -EXPORT_SYMBOL_GPL(compat_get_timespec64);
 -
 -int compat_put_timespec64(const struct timespec64 *ts, void __user *uts)
 -{
 -      if (COMPAT_USE_64BIT_TIME)
 -              return copy_to_user(uts, ts, sizeof(*ts)) ? -EFAULT : 0;
 -      else
 -              return __compat_put_timespec64(ts, uts);
 -}
 -EXPORT_SYMBOL_GPL(compat_put_timespec64);
 -
  int compat_get_timeval(struct timeval *tv, const void __user *utv)
  {
        if (COMPAT_USE_64BIT_TIME)
@@@ -323,14 -368,6 +324,14 @@@ COMPAT_SYSCALL_DEFINE3(sched_getaffinit
        return ret;
  }
  
 +/* Todo: Delete these extern declarations when get/put_compat_itimerspec64()
 + * are moved to kernel/time/time.c .
 + */
 +extern int __compat_get_timespec64(struct timespec64 *ts64,
 +                                 const struct compat_timespec __user *cts);
 +extern int __compat_put_timespec64(const struct timespec64 *ts64,
 +                                 struct compat_timespec __user *cts);
 +
  int get_compat_itimerspec64(struct itimerspec64 *its,
                        const struct compat_itimerspec __user *uits)
  {
diff --combined kernel/time/hrtimer.c
index d7051b3993b544b91c811183511fa04710122035,14e858753d7689d96392402ebce61e0116574efa..055a4a728c00cce3945afc04b9bee692b243896b
@@@ -90,6 -90,11 +90,11 @@@ DEFINE_PER_CPU(struct hrtimer_cpu_base
                        .clockid = CLOCK_REALTIME,
                        .get_time = &ktime_get_real,
                },
+               {
+                       .index = HRTIMER_BASE_BOOTTIME,
+                       .clockid = CLOCK_BOOTTIME,
+                       .get_time = &ktime_get_boottime,
+               },
                {
                        .index = HRTIMER_BASE_TAI,
                        .clockid = CLOCK_TAI,
                        .clockid = CLOCK_REALTIME,
                        .get_time = &ktime_get_real,
                },
+               {
+                       .index = HRTIMER_BASE_BOOTTIME_SOFT,
+                       .clockid = CLOCK_BOOTTIME,
+                       .get_time = &ktime_get_boottime,
+               },
                {
                        .index = HRTIMER_BASE_TAI_SOFT,
                        .clockid = CLOCK_TAI,
@@@ -119,7 -129,7 +129,7 @@@ static const int hrtimer_clock_to_base_
  
        [CLOCK_REALTIME]        = HRTIMER_BASE_REALTIME,
        [CLOCK_MONOTONIC]       = HRTIMER_BASE_MONOTONIC,
-       [CLOCK_BOOTTIME]        = HRTIMER_BASE_MONOTONIC,
+       [CLOCK_BOOTTIME]        = HRTIMER_BASE_BOOTTIME,
        [CLOCK_TAI]             = HRTIMER_BASE_TAI,
  };
  
@@@ -571,12 -581,14 +581,14 @@@ __hrtimer_get_next_event(struct hrtimer
  static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base)
  {
        ktime_t *offs_real = &base->clock_base[HRTIMER_BASE_REALTIME].offset;
+       ktime_t *offs_boot = &base->clock_base[HRTIMER_BASE_BOOTTIME].offset;
        ktime_t *offs_tai = &base->clock_base[HRTIMER_BASE_TAI].offset;
  
        ktime_t now = ktime_get_update_offsets_now(&base->clock_was_set_seq,
-                                                  offs_real, offs_tai);
+                                           offs_real, offs_boot, offs_tai);
  
        base->clock_base[HRTIMER_BASE_REALTIME_SOFT].offset = *offs_real;
+       base->clock_base[HRTIMER_BASE_BOOTTIME_SOFT].offset = *offs_boot;
        base->clock_base[HRTIMER_BASE_TAI_SOFT].offset = *offs_tai;
  
        return now;
        return ret;
  }
  
 -SYSCALL_DEFINE2(nanosleep, struct timespec __user *, rqtp,
 -              struct timespec __user *, rmtp)
 +#if !defined(CONFIG_64BIT_TIME) || defined(CONFIG_64BIT)
 +
 +SYSCALL_DEFINE2(nanosleep, struct __kernel_timespec __user *, rqtp,
 +              struct __kernel_timespec __user *, rmtp)
  {
        struct timespec64 tu;
  
        return hrtimer_nanosleep(&tu, HRTIMER_MODE_REL, CLOCK_MONOTONIC);
  }
  
 -#ifdef CONFIG_COMPAT
 +#endif
 +
 +#ifdef CONFIG_COMPAT_32BIT_TIME
  
  COMPAT_SYSCALL_DEFINE2(nanosleep, struct compat_timespec __user *, rqtp,
                       struct compat_timespec __user *, rmtp)
index 474e4ca2e28f33fa470073ad1e533dfe620bb352,69a937c3cd81260e8a83942ea0d21750c86fa5be..26aa9569e24a54a6060584a5931ce36748f36d83
@@@ -59,7 -59,7 +59,7 @@@ SYS_NI(alarm)
   */
  
  SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
 -              const struct timespec __user *, tp)
 +              const struct __kernel_timespec __user *, tp)
  {
        struct timespec64 new_tp;
  
@@@ -83,8 -83,6 +83,6 @@@ int do_clock_gettime(clockid_t which_cl
        case CLOCK_BOOTTIME:
                get_monotonic_boottime64(tp);
                break;
-       case CLOCK_MONOTONIC_ACTIVE:
-               ktime_get_active_ts64(tp);
        default:
                return -EINVAL;
        }
@@@ -92,7 -90,7 +90,7 @@@
        return 0;
  }
  SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
 -              struct timespec __user *, tp)
 +              struct __kernel_timespec __user *, tp)
  {
        int ret;
        struct timespec64 kernel_tp;
        return 0;
  }
  
 -SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, struct timespec __user *, tp)
 +SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, struct __kernel_timespec __user *, tp)
  {
        struct timespec64 rtn_tp = {
                .tv_sec = 0,
  }
  
  SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags,
 -              const struct timespec __user *, rqtp,
 -              struct timespec __user *, rmtp)
 +              const struct __kernel_timespec __user *, rqtp,
 +              struct __kernel_timespec __user *, rmtp)
  {
        struct timespec64 t;
  
@@@ -160,9 -158,7 +158,9 @@@ COMPAT_SYS_NI(timer_settime)
  COMPAT_SYS_NI(timer_gettime);
  COMPAT_SYS_NI(getitimer);
  COMPAT_SYS_NI(setitimer);
 +#endif
  
 +#ifdef CONFIG_COMPAT_32BIT_TIME
  COMPAT_SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
                       struct compat_timespec __user *, tp)
  {
index c21f4c4f86607fa5a1bdf1799f550ddd86027511,10b7186d063830b9e45a84146ed243a9f0e80b07..e08ce3f27447390846394e55a11cd4e9c029bb37
@@@ -252,16 -252,15 +252,15 @@@ static int posix_get_coarse_res(const c
        return 0;
  }
  
- static int posix_get_tai(clockid_t which_clock, struct timespec64 *tp)
+ static int posix_get_boottime(const clockid_t which_clock, struct timespec64 *tp)
  {
-       timekeeping_clocktai64(tp);
+       get_monotonic_boottime64(tp);
        return 0;
  }
  
- static int posix_get_monotonic_active(clockid_t which_clock,
-                                     struct timespec64 *tp)
+ static int posix_get_tai(clockid_t which_clock, struct timespec64 *tp)
  {
-       ktime_get_active_ts64(tp);
+       timekeeping_clocktai64(tp);
        return 0;
  }
  
@@@ -1041,7 -1040,7 +1040,7 @@@ void exit_itimers(struct signal_struct 
  }
  
  SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
 -              const struct timespec __user *, tp)
 +              const struct __kernel_timespec __user *, tp)
  {
        const struct k_clock *kc = clockid_to_kclock(which_clock);
        struct timespec64 new_tp;
  }
  
  SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
 -              struct timespec __user *,tp)
 +              struct __kernel_timespec __user *, tp)
  {
        const struct k_clock *kc = clockid_to_kclock(which_clock);
        struct timespec64 kernel_tp;
@@@ -1097,7 -1096,7 +1096,7 @@@ SYSCALL_DEFINE2(clock_adjtime, const cl
  }
  
  SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock,
 -              struct timespec __user *, tp)
 +              struct __kernel_timespec __user *, tp)
  {
        const struct k_clock *kc = clockid_to_kclock(which_clock);
        struct timespec64 rtn_tp;
        return error;
  }
  
 -#ifdef CONFIG_COMPAT
 +#ifdef CONFIG_COMPAT_32BIT_TIME
  
  COMPAT_SYSCALL_DEFINE2(clock_settime, clockid_t, which_clock,
                       struct compat_timespec __user *, tp)
@@@ -1149,10 -1148,6 +1148,10 @@@ COMPAT_SYSCALL_DEFINE2(clock_gettime, c
        return err;
  }
  
 +#endif
 +
 +#ifdef CONFIG_COMPAT
 +
  COMPAT_SYSCALL_DEFINE2(clock_adjtime, clockid_t, which_clock,
                       struct compat_timex __user *, utp)
  {
        return err;
  }
  
 +#endif
 +
 +#ifdef CONFIG_COMPAT_32BIT_TIME
 +
  COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock,
                       struct compat_timespec __user *, tp)
  {
@@@ -1212,8 -1203,8 +1211,8 @@@ static int common_nsleep(const clockid_
  }
  
  SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags,
 -              const struct timespec __user *, rqtp,
 -              struct timespec __user *, rmtp)
 +              const struct __kernel_timespec __user *, rqtp,
 +              struct __kernel_timespec __user *, rmtp)
  {
        const struct k_clock *kc = clockid_to_kclock(which_clock);
        struct timespec64 t;
        return kc->nsleep(which_clock, flags, &t);
  }
  
 -#ifdef CONFIG_COMPAT
 +#ifdef CONFIG_COMPAT_32BIT_TIME
 +
  COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags,
                       struct compat_timespec __user *, rqtp,
                       struct compat_timespec __user *, rmtp)
  
        return kc->nsleep(which_clock, flags, &t);
  }
 +
  #endif
  
  static const struct k_clock clock_realtime = {
@@@ -1327,9 -1316,19 +1326,19 @@@ static const struct k_clock clock_tai 
        .timer_arm              = common_hrtimer_arm,
  };
  
- static const struct k_clock clock_monotonic_active = {
+ static const struct k_clock clock_boottime = {
        .clock_getres           = posix_get_hrtimer_res,
-       .clock_get              = posix_get_monotonic_active,
+       .clock_get              = posix_get_boottime,
+       .nsleep                 = common_nsleep,
+       .timer_create           = common_timer_create,
+       .timer_set              = common_timer_set,
+       .timer_get              = common_timer_get,
+       .timer_del              = common_timer_del,
+       .timer_rearm            = common_hrtimer_rearm,
+       .timer_forward          = common_hrtimer_forward,
+       .timer_remaining        = common_hrtimer_remaining,
+       .timer_try_to_cancel    = common_hrtimer_try_to_cancel,
+       .timer_arm              = common_hrtimer_arm,
  };
  
  static const struct k_clock * const posix_clocks[] = {
        [CLOCK_MONOTONIC_RAW]           = &clock_monotonic_raw,
        [CLOCK_REALTIME_COARSE]         = &clock_realtime_coarse,
        [CLOCK_MONOTONIC_COARSE]        = &clock_monotonic_coarse,
-       [CLOCK_BOOTTIME]                = &clock_monotonic,
+       [CLOCK_BOOTTIME]                = &clock_boottime,
        [CLOCK_REALTIME_ALARM]          = &alarm_clock,
        [CLOCK_BOOTTIME_ALARM]          = &alarm_clock,
        [CLOCK_TAI]                     = &clock_tai,
-       [CLOCK_MONOTONIC_ACTIVE]        = &clock_monotonic_active,
  };
  
  static const struct k_clock *clockid_to_kclock(const clockid_t id)
This page took 0.142904 seconds and 4 git commands to generate.