X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=kernel-vserver-fixes.patch;h=3d6ca5d93e0a5009417529be328c856c385926a0;hb=ef303193c7928d8890eb686786f9c436bc90ee74;hp=92eae753dea4f8e1a10ed938c870f5010a4ab35c;hpb=372f0e0c8d04370a658d7d1e79cc378ac89594a0;p=packages%2Fkernel.git diff --git a/kernel-vserver-fixes.patch b/kernel-vserver-fixes.patch index 92eae753..3d6ca5d9 100644 --- a/kernel-vserver-fixes.patch +++ b/kernel-vserver-fixes.patch @@ -1,241 +1,80 @@ -Missing header for routes patch, caused vs2.3 route.h mixing ---- a/net/ipv4/netfilter/nf_nat_core.c~ 2008-01-24 23:58:37.000000000 +0100 -+++ a/net/ipv4/netfilter/nf_nat_core.c 2008-03-30 21:00:19.349593833 +0200 -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include /* For tcp_prot in getorigdst */ - #include - #include ---- linux-2.6.33/arch/x86/kernel/process.c~ 2010-02-24 19:52:17.000000000 +0100 -+++ linux-2.6.33/arch/x86/kernel/process.c 2010-02-25 23:44:56.487156216 +0100 -@@ -110,8 +110,8 @@ - board = dmi_get_system_info(DMI_BOARD_NAME); - - printk(KERN_CONT "\n"); -- printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s", -- current->pid, current->comm, print_tainted(), -+ printk(KERN_DEFAULT "Pid: %d, xid: #%u, comm: %.20s %s %s %.*s", -+ current->pid, current->xid, current->comm, print_tainted(), - init_utsname()->release, - (int)strcspn(init_utsname()->version, " "), - init_utsname()->version); ---- linux-2.6.31/arch/x86/kernel/dumpstack.c~ 2009-09-16 08:32:02.000000000 +0200 -+++ linux-2.6.31/arch/x86/kernel/dumpstack.c 2009-09-17 21:58:13.778791960 +0200 -@@ -180,8 +180,8 @@ - unsigned long stack; - - bp = stack_frame(current, NULL); -- printk("Pid: %d, comm: %.20s %s %s %.*s\n", -- current->pid, current->comm, print_tainted(), -+ printk("Pid: %d, comm: %.20s xid: #%u %s %s %.*s\n", -+ current->pid, current->comm, current->xid, print_tainted(), - init_utsname()->release, - (int)strcspn(init_utsname()->version, " "), - init_utsname()->version); -diff -NurpP --minimal linux-3.0.4-vs2.3.1-pre10.3/kernel/vserver/limit.c linux-3.0.4-vs2.3.1-pre10.4/kernel/vserver/limit.c ---- linux-3.0.4-vs2.3.1-pre10.3/kernel/vserver/limit.c 2011-06-10 22:11:24.000000000 +0200 -+++ linux-3.0.4-vs2.3.1-pre10.4/kernel/vserver/limit.c 2011-10-11 20:48:08.000000000 +0200 -@@ -304,14 +304,20 @@ void vx_vsi_swapinfo(struct sysinfo *val - memsw_limit = mem_cgroup_memsw_read_u64(mcg, RES_LIMIT); - memsw_usage = mem_cgroup_memsw_read_u64(mcg, RES_USAGE); - -+ /* memory unlimited */ - if (res_limit == RESOURCE_MAX) - return; - - swap_limit = memsw_limit - res_limit; -+ /* we have a swap limit? */ - if (memsw_limit != RESOURCE_MAX) - val->totalswap = swap_limit >> PAGE_SHIFT; - -- swap_usage = memsw_usage - res_usage; -+ /* calculate swap part */ -+ swap_usage = (memsw_usage > res_usage) ? -+ memsw_usage - res_usage : 0; -+ -+ /* total shown minus usage gives free swap */ - val->freeswap = (swap_usage < swap_limit) ? - val->totalswap - (swap_usage >> PAGE_SHIFT) : 0; - #else /* !CONFIG_CGROUP_MEM_RES_CTLR_SWAP */ ---- linux-3.0.4-vs2.3.1-pre10.1/fs/namei.c 2011-10-03 20:49:18.000000000 +0200 -+++ devon-3.0.4/fs/namei.c 2011-10-03 23:24:26.323655073 +0200 -@@ -2307,6 +2307,16 @@ ok: - } - common: - error = may_open(&nd->path, acc_mode, open_flag); -+#ifdef CONFIG_VSERVER_COWBL -+ if (error == -EMLINK) { -+ struct dentry *dentry; -+ dentry = cow_break_link(pathname); -+ if (IS_ERR(dentry)) -+ error = PTR_ERR(dentry); -+ else -+ dput(dentry); -+ } -+#endif - if (error) - goto exit; - filp = nameidata_to_filp(nd); -@@ -2349,6 +2359,7 @@ static struct file *path_openat(int dfd, - struct path path; - int error; - -+restart: - filp = get_empty_filp(); - if (!filp) - return ERR_PTR(-ENFILE); -@@ -2386,6 +2397,17 @@ static struct file *path_openat(int dfd, - filp = do_last(nd, &path, op, pathname); - put_link(nd, &link, cookie); - } -+ -+#ifdef CONFIG_VSERVER_COWBL -+ if (filp == ERR_PTR(-EMLINK)) { -+ if (nd->root.mnt && !(nd->flags & LOOKUP_ROOT)) -+ path_put(&nd->root); -+ if (base) -+ fput(base); -+ release_open_intent(nd); -+ goto restart; -+ } -+#endif - out: - if (nd->root.mnt && !(nd->flags & LOOKUP_ROOT)) - path_put(&nd->root); -@@ -3356,8 +3378,6 @@ int vfs_follow_link(struct nameidata *nd - - #ifdef CONFIG_VSERVER_COWBL - --#include -- - static inline - long do_cow_splice(struct file *in, struct file *out, size_t len) +--- linux-3.3/fs/proc/base.c~ 2012-03-19 21:44:42.000000000 +0100 ++++ linux-3.3/fs/proc/base.c 2012-03-21 12:25:28.051092423 +0100 +@@ -568,6 +568,8 @@ + struct task_struct *task, + int hide_pid_min) { -diff -NurpP --minimal linux-3.0.4-vs2.3.1-pre10.3/fs/nfs/inode.c linux-3.0.4-vs2.3.1-pre10.4/fs/nfs/inode.c ---- linux-3.0.4-vs2.3.1-pre10.3/fs/nfs/inode.c 2011-07-01 11:35:34.000000000 +0200 -+++ linux-3.0.4-vs2.3.1-pre10.4/fs/nfs/inode.c 2011-09-30 00:22:02.000000000 +0200 -@@ -1333,9 +1341,9 @@ static int nfs_update_inode(struct inode - | NFS_INO_REVAL_PAGECACHE - | NFS_INO_REVAL_FORCED); - -- uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid); -- gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid); -- tag = INOTAG_TAG(DX_TAG(inode), fattr->uid, fattr->gid, 0); -+ uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag); -+ gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag); -+ tag = inode->i_tag; - - if (fattr->valid & NFS_ATTR_FATTR_ATIME) - memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime)); -@@ -1378,9 +1386,9 @@ static int nfs_update_inode(struct inode - | NFS_INO_INVALID_ACL - | NFS_INO_REVAL_FORCED); - -- inode->i_uid = uid; -- inode->i_gid = gid; -- inode->i_tag = tag; -+ inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid); -+ inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid); -+ inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid, tag); - - if (fattr->valid & NFS_ATTR_FATTR_NLINK) { - if (inode->i_nlink != fattr->nlink) { -diff -NurpP --minimal linux-3.0.4-vs2.3.1-pre10.2/net/ipv4/tcp_ipv4.c linux-3.0.4-vs2.3.1-pre10.3/net/ipv4/tcp_ipv4.c ---- linux-3.0.4-vs2.3.1-pre10.2/net/ipv4/tcp_ipv4.c 2011-08-29 03:45:10.000000000 +0200 -+++ linux-3.0.4-vs2.3.1-pre10.3/net/ipv4/tcp_ipv4.c 2011-09-29 16:44:29.000000000 +0200 -@@ -2426,8 +2426,8 @@ static void get_tcp4_sock(struct sock *s - struct tcp_sock *tp = tcp_sk(sk); - const struct inet_connection_sock *icsk = inet_csk(sk); - struct inet_sock *inet = inet_sk(sk); -- __be32 dest = inet->inet_daddr; -- __be32 src = inet->inet_rcv_saddr; -+ __be32 dest = nx_map_sock_lback(current_nx_info(), inet->inet_daddr); -+ __be32 src = nx_map_sock_lback(current_nx_info(), inet->inet_rcv_saddr); - __u16 destp = ntohs(inet->inet_dport); - __u16 srcp = ntohs(inet->inet_sport); - int rx_queue; -@@ -2484,8 +2484,8 @@ static void get_timewait4_sock(struct in - if (ttd < 0) - ttd = 0; - -- dest = tw->tw_daddr; -- src = tw->tw_rcv_saddr; -+ dest = nx_map_sock_lback(current_nx_info(), tw->tw_daddr); -+ src = nx_map_sock_lback(current_nx_info(), tw->tw_rcv_saddr); - destp = ntohs(tw->tw_dport); - srcp = ntohs(tw->tw_sport); - -diff -NurpP --minimal linux-3.0.4-vs2.3.1-pre10.1/include/linux/netdevice.h linux-3.0.4-vs2.3.1-pre10.2/include/linux/netdevice.h ---- linux-3.0.4-vs2.3.1-pre10.1/include/linux/netdevice.h 2011-08-08 23:04:47.000000000 +0200 -+++ linux-3.0.4-vs2.3.1-pre10.2/include/linux/netdevice.h 2011-09-17 19:22:49.000000000 +0200 -@@ -1650,6 +1650,7 @@ extern void netdev_resync_ops(struct ne - extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); - extern struct net_device *dev_get_by_index(struct net *net, int ifindex); - extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); -+extern struct net_device *dev_get_by_index_real_rcu(struct net *net, int ifindex); - extern struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); - extern int dev_restart(struct net_device *dev); - #ifdef CONFIG_NETPOLL_TRAP -diff -NurpP --minimal linux-3.0.4-vs2.3.1-pre10.1/net/core/dev.c linux-3.0.4-vs2.3.1-pre10.2/net/core/dev.c ---- linux-3.0.4-vs2.3.1-pre10.1/net/core/dev.c 2011-06-15 02:40:14.000000000 +0200 -+++ linux-3.0.4-vs2.3.1-pre10.2/net/core/dev.c 2011-09-17 19:20:44.000000000 +0200 -@@ -708,19 +708,28 @@ EXPORT_SYMBOL(__dev_get_by_index); - * about locking. The caller must hold RCU lock. - */ - --struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex) -+struct net_device *dev_get_by_index_real_rcu(struct net *net, int ifindex) - { - struct hlist_node *p; - struct net_device *dev; - struct hlist_head *head = dev_index_hash(net, ifindex); ++ if (vx_check(0, VS_WATCH_P)) ++ return true; + if (pid->hide_pid < hide_pid_min) + return true; + if (in_group_p(pid->pid_gid)) + + + +diff -NurpP --minimal linux-4.9.217-vs2.3.9.12/fs/proc/array.c linux-4.9.217-vs2.3.9.13/fs/proc/array.c +--- linux-4.9.217-vs2.3.9.12/fs/proc/array.c 2019-10-05 14:58:45.660307716 +0000 ++++ linux-4.9.217-vs2.3.9.13/fs/proc/array.c 2020-04-19 00:54:52.163080084 +0000 +@@ -567,17 +567,6 @@ static int do_task_stat(struct seq_file + /* convert nsec -> ticks */ + start_time = nsec_to_clock_t(task->real_start_time); + +- /* fixup start time for virt uptime */ +- if (vx_flags(VXF_VIRT_UPTIME, 0)) { +- unsigned long long bias = +- current->vx_info->cvirt.bias_clock; +- +- if (start_time > bias) +- start_time -= bias; +- else +- start_time = 0; +- } +- + seq_printf(m, "%d (%s) %c", pid_nr_ns(pid, ns), tcomm, state); + seq_put_decimal_ll(m, " ", ppid); + seq_put_decimal_ll(m, " ", pgid); +diff -NurpP --minimal linux-4.9.217-vs2.3.9.12/fs/proc/uptime.c linux-4.9.217-vs2.3.9.13/fs/proc/uptime.c +--- linux-4.9.217-vs2.3.9.12/fs/proc/uptime.c 2019-10-13 16:02:19.324763467 +0000 ++++ linux-4.9.217-vs2.3.9.13/fs/proc/uptime.c 2020-04-18 23:42:47.412036999 +0000 +@@ -23,6 +23,9 @@ static int uptime_proc_show(struct seq_f + idle.tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem); + idle.tv_nsec = rem; + ++ if (vx_flags(VXF_VIRT_UPTIME, 0)) ++ vx_vsi_uptime(&uptime, &idle); ++ + seq_printf(m, "%lu.%02lu %lu.%02lu\n", + (unsigned long) uptime.tv_sec, + (uptime.tv_nsec / (NSEC_PER_SEC / 100)), +diff -NurpP --minimal linux-4.9.217-vs2.3.9.12/include/linux/vserver/cvirt.h linux-4.9.217-vs2.3.9.13/include/linux/vserver/cvirt.h +--- linux-4.9.217-vs2.3.9.12/include/linux/vserver/cvirt.h 2019-10-13 16:04:08.203030205 +0000 ++++ linux-4.9.217-vs2.3.9.13/include/linux/vserver/cvirt.h 2020-04-19 00:30:46.735970074 +0000 +@@ -5,6 +5,9 @@ struct vx_info; - hlist_for_each_entry_rcu(dev, p, head, index_hlist) -- if ((dev->ifindex == ifindex) && -- nx_dev_visible(current_nx_info(), dev)) -+ if (dev->ifindex == ifindex) - return dev; + void vx_update_load(struct vx_info *); - return NULL; - } -+EXPORT_SYMBOL(dev_get_by_index_real_rcu); ++struct timespec; + -+struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex) -+{ -+ struct net_device *dev = dev_get_by_index_real_rcu(net, ifindex); -+ -+ if (nx_dev_visible(current_nx_info(), dev)) -+ return dev; -+ return NULL; -+} - EXPORT_SYMBOL(dev_get_by_index_rcu); ++void vx_vsi_uptime(struct timespec *, struct timespec *); + int vx_do_syslog(int, char __user *, int); -diff -NurpP --minimal linux-3.0.4-vs2.3.1-pre10.1/net/ipv4/route.c linux-3.0.4-vs2.3.1-pre10.2/net/ipv4/route.c ---- linux-3.0.4-vs2.3.1-pre10.1/net/ipv4/route.c 2011-08-29 03:45:10.000000000 +0200 -+++ linux-3.0.4-vs2.3.1-pre10.2/net/ipv4/route.c 2011-09-17 19:23:37.000000000 +0200 -@@ -2525,7 +2525,7 @@ static struct rtable *ip_route_output_sl +diff -NurpP --minimal linux-4.9.217-vs2.3.9.12/kernel/time/timekeeping.c linux-4.9.217-vs2.3.9.13/kernel/time/timekeeping.c +--- linux-4.9.217-vs2.3.9.12/kernel/time/timekeeping.c 2019-12-25 15:09:47.185439847 +0000 ++++ linux-4.9.217-vs2.3.9.13/kernel/time/timekeeping.c 2020-04-19 00:55:09.072812292 +0000 +@@ -770,15 +770,6 @@ ktime_t ktime_get_with_offset(enum tk_of + } while (read_seqcount_retry(&tk_core.seq, seq)); - if (fl4->flowi4_oif) { -- dev_out = dev_get_by_index_rcu(net, fl4->flowi4_oif); -+ dev_out = dev_get_by_index_real_rcu(net, fl4->flowi4_oif); - rth = ERR_PTR(-ENODEV); - if (dev_out == NULL) - goto out; -diff -NurpP --minimal linux-3.0.4-vs2.3.1-pre10.1/net/ipv6/datagram.c linux-3.0.4-vs2.3.1-pre10.2/net/ipv6/datagram.c ---- linux-3.0.4-vs2.3.1-pre10.1/net/ipv6/datagram.c 2011-05-22 16:18:00.000000000 +0200 -+++ linux-3.0.4-vs2.3.1-pre10.2/net/ipv6/datagram.c 2011-09-17 19:24:15.000000000 +0200 -@@ -639,7 +639,7 @@ int datagram_send_ctl(struct net *net, +-#ifdef CONFIG_VSERVER_VTIME +- if ((offs == TK_OFFS_BOOT) && +- vx_flags(VXF_VIRT_UPTIME, 0) && +- !vx_check(0, VS_ADMIN|VS_WATCH)) { +- struct vx_info *vxi = current_vx_info(); +- ktime_t bias_uptime = timespec64_to_ktime(vxi->cvirt.bias_uptime); +- base = ktime_sub(base, bias_uptime); +- } +-#endif + return ktime_add_ns(base, nsecs); - rcu_read_lock(); - if (fl6->flowi6_oif) { -- dev = dev_get_by_index_rcu(net, fl6->flowi6_oif); -+ dev = dev_get_by_index_real_rcu(net, fl6->flowi6_oif); - if (!dev) { - rcu_read_unlock(); - return -ENODEV; - + }