Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: change sock.sk_ino and sock_i_ino() to u64

inode->i_ino is being converted to a u64. sock.sk_ino (which caches the
inode number) must also be widened to avoid truncation on 32-bit
architectures where unsigned long is only 32 bits.

Change sk_ino from unsigned long to u64, and update the return type
of sock_i_ino() to match. Fix all format strings that print the
result of sock_i_ino() (%lu -> %llu), and widen the intermediate
variables and function parameters in the diag modules that were
using int to hold the inode number.

Note that the UAPI socket diag structures (inet_diag_msg.idiag_inode,
unix_diag_msg.udiag_ino, etc.) are all __u32 and cannot be changed
without breaking the ABI. The assignments to those fields will
silently truncate, which is the existing behavior.

Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> # for net/can
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://patch.msgid.link/20260304-iino-u64-v3-3-2257ad83d372@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Jeff Layton and committed by
Christian Brauner
0fe27e59 125dfa21

+26 -26
+2 -2
include/net/sock.h
··· 537 537 rwlock_t sk_callback_lock; 538 538 u32 sk_ack_backlog; 539 539 u32 sk_max_ack_backlog; 540 - unsigned long sk_ino; 540 + u64 sk_ino; 541 541 spinlock_t sk_peer_lock; 542 542 int sk_bind_phc; 543 543 struct pid *sk_peer_pid; ··· 2140 2140 write_unlock_bh(&sk->sk_callback_lock); 2141 2141 } 2142 2142 2143 - static inline unsigned long sock_i_ino(const struct sock *sk) 2143 + static inline u64 sock_i_ino(const struct sock *sk) 2144 2144 { 2145 2145 /* Paired with WRITE_ONCE() in sock_graft() and sock_orphan() */ 2146 2146 return READ_ONCE(sk->sk_ino);
+1 -1
net/ax25/af_ax25.c
··· 1986 1986 ax25->paclen); 1987 1987 1988 1988 if (ax25->sk != NULL) { 1989 - seq_printf(seq, " %d %d %lu\n", 1989 + seq_printf(seq, " %d %d %llu\n", 1990 1990 sk_wmem_alloc_get(ax25->sk), 1991 1991 sk_rmem_alloc_get(ax25->sk), 1992 1992 sock_i_ino(ax25->sk));
+2 -2
net/bluetooth/af_bluetooth.c
··· 817 817 struct bt_sock *bt = bt_sk(sk); 818 818 819 819 seq_printf(seq, 820 - "%pK %-6d %-6u %-6u %-6u %-6lu %-6lu", 820 + "%pK %-6d %-6u %-6u %-6u %-6llu %-6llu", 821 821 sk, 822 822 refcount_read(&sk->sk_refcnt), 823 823 sk_rmem_alloc_get(sk), 824 824 sk_wmem_alloc_get(sk), 825 825 from_kuid(seq_user_ns(seq), sk_uid(sk)), 826 826 sock_i_ino(sk), 827 - bt->parent ? sock_i_ino(bt->parent) : 0LU); 827 + bt->parent ? sock_i_ino(bt->parent) : 0ULL); 828 828 829 829 if (l->custom_seq_show) { 830 830 seq_putc(seq, ' ');
+1 -1
net/can/bcm.c
··· 1712 1712 #if IS_ENABLED(CONFIG_PROC_FS) 1713 1713 if (net->can.bcmproc_dir) { 1714 1714 /* unique socket address as filename */ 1715 - sprintf(bo->procname, "%lu", sock_i_ino(sk)); 1715 + sprintf(bo->procname, "%llu", sock_i_ino(sk)); 1716 1716 bo->bcm_proc_read = proc_create_net_single(bo->procname, 0644, 1717 1717 net->can.bcmproc_dir, 1718 1718 bcm_proc_show, sk);
+1 -1
net/ipv4/ping.c
··· 1111 1111 __u16 srcp = ntohs(inet->inet_sport); 1112 1112 1113 1113 seq_printf(f, "%5d: %08X:%04X %08X:%04X" 1114 - " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %u", 1114 + " %02X %08X:%08X %02X:%08lX %08X %5u %8d %llu %d %pK %u", 1115 1115 bucket, src, srcp, dest, destp, sp->sk_state, 1116 1116 sk_wmem_alloc_get(sp), 1117 1117 sk_rmem_alloc_get(sp),
+1 -1
net/ipv4/raw.c
··· 1041 1041 srcp = inet->inet_num; 1042 1042 1043 1043 seq_printf(seq, "%4d: %08X:%04X %08X:%04X" 1044 - " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %u\n", 1044 + " %02X %08X:%08X %02X:%08lX %08X %5u %8d %llu %d %pK %u\n", 1045 1045 i, src, srcp, dest, destp, sp->sk_state, 1046 1046 sk_wmem_alloc_get(sp), 1047 1047 sk_rmem_alloc_get(sp),
+1 -1
net/ipv4/tcp_ipv4.c
··· 2883 2883 READ_ONCE(tp->copied_seq), 0); 2884 2884 2885 2885 seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX " 2886 - "%08X %5u %8d %lu %d %pK %lu %lu %u %u %d", 2886 + "%08X %5u %8d %llu %d %pK %lu %lu %u %u %d", 2887 2887 i, src, srcp, dest, destp, state, 2888 2888 READ_ONCE(tp->write_seq) - tp->snd_una, 2889 2889 rx_queue,
+1 -1
net/ipv4/udp.c
··· 3428 3428 __u16 srcp = ntohs(inet->inet_sport); 3429 3429 3430 3430 seq_printf(f, "%5d: %08X:%04X %08X:%04X" 3431 - " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %u", 3431 + " %02X %08X:%08X %02X:%08lX %08X %5u %8d %llu %d %pK %u", 3432 3432 bucket, src, srcp, dest, destp, sp->sk_state, 3433 3433 sk_wmem_alloc_get(sp), 3434 3434 udp_rqueue_get(sp),
+1 -1
net/ipv6/datagram.c
··· 1055 1055 src = &sp->sk_v6_rcv_saddr; 1056 1056 seq_printf(seq, 1057 1057 "%5d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " 1058 - "%02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %u\n", 1058 + "%02X %08X:%08X %02X:%08lX %08X %5u %8d %llu %d %pK %u\n", 1059 1059 bucket, 1060 1060 src->s6_addr32[0], src->s6_addr32[1], 1061 1061 src->s6_addr32[2], src->s6_addr32[3], srcp,
+1 -1
net/ipv6/tcp_ipv6.c
··· 2189 2189 2190 2190 seq_printf(seq, 2191 2191 "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " 2192 - "%02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %lu %lu %u %u %d\n", 2192 + "%02X %08X:%08X %02X:%08lX %08X %5u %8d %llu %d %pK %lu %lu %u %u %d\n", 2193 2193 i, 2194 2194 src->s6_addr32[0], src->s6_addr32[1], 2195 2195 src->s6_addr32[2], src->s6_addr32[3], srcp,
+1 -1
net/key/af_key.c
··· 3783 3783 if (v == SEQ_START_TOKEN) 3784 3784 seq_printf(f ,"sk RefCnt Rmem Wmem User Inode\n"); 3785 3785 else 3786 - seq_printf(f, "%pK %-6d %-6u %-6u %-6u %-6lu\n", 3786 + seq_printf(f, "%pK %-6d %-6u %-6u %-6u %-6llu\n", 3787 3787 s, 3788 3788 refcount_read(&s->sk_refcnt), 3789 3789 sk_rmem_alloc_get(s),
+1 -1
net/netlink/af_netlink.c
··· 2700 2700 struct sock *s = v; 2701 2701 struct netlink_sock *nlk = nlk_sk(s); 2702 2702 2703 - seq_printf(seq, "%pK %-3d %-10u %08x %-8d %-8d %-5d %-8d %-8u %-8lu\n", 2703 + seq_printf(seq, "%pK %-3d %-10u %08x %-8d %-8d %-5d %-8d %-8u %-8llu\n", 2704 2704 s, 2705 2705 s->sk_protocol, 2706 2706 nlk->portid,
+1 -1
net/netlink/diag.c
··· 43 43 44 44 static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, 45 45 struct netlink_diag_req *req, 46 - u32 portid, u32 seq, u32 flags, int sk_ino) 46 + u32 portid, u32 seq, u32 flags, u64 sk_ino) 47 47 { 48 48 struct nlmsghdr *nlh; 49 49 struct netlink_diag_msg *rep;
+1 -1
net/packet/af_packet.c
··· 4721 4721 const struct packet_sock *po = pkt_sk(s); 4722 4722 4723 4723 seq_printf(seq, 4724 - "%pK %-6d %-4d %04x %-5d %1d %-6u %-6u %-6lu\n", 4724 + "%pK %-6d %-4d %04x %-5d %1d %-6u %-6u %-6llu\n", 4725 4725 s, 4726 4726 refcount_read(&s->sk_refcnt), 4727 4727 s->sk_type,
+1 -1
net/packet/diag.c
··· 130 130 struct packet_diag_req *req, 131 131 bool may_report_filterinfo, 132 132 struct user_namespace *user_ns, 133 - u32 portid, u32 seq, u32 flags, int sk_ino) 133 + u32 portid, u32 seq, u32 flags, u64 sk_ino) 134 134 { 135 135 struct nlmsghdr *nlh; 136 136 struct packet_diag_msg *rp;
+2 -2
net/phonet/socket.c
··· 579 579 struct sock *sk = v; 580 580 struct pn_sock *pn = pn_sk(sk); 581 581 582 - seq_printf(seq, "%2d %04X:%04X:%02X %02X %08X:%08X %5d %lu " 582 + seq_printf(seq, "%2d %04X:%04X:%02X %02X %08X:%08X %5d %llu " 583 583 "%d %pK %u", 584 584 sk->sk_protocol, pn->sobject, pn->dobject, 585 585 pn->resource, sk->sk_state, ··· 754 754 struct sock *sk = rcu_dereference_protected(*psk, 755 755 lockdep_is_held(&resource_mutex)); 756 756 757 - seq_printf(seq, "%02X %5u %lu", 757 + seq_printf(seq, "%02X %5u %llu", 758 758 (int) (psk - pnres.sk), 759 759 from_kuid_munged(seq_user_ns(seq), sk_uid(sk)), 760 760 sock_i_ino(sk));
+2 -2
net/sctp/proc.c
··· 174 174 sk = ep->base.sk; 175 175 if (!net_eq(sock_net(sk), seq_file_net(seq))) 176 176 continue; 177 - seq_printf(seq, "%8pK %8pK %-3d %-3d %-4d %-5d %5u %5lu ", ep, sk, 177 + seq_printf(seq, "%8pK %8pK %-3d %-3d %-4d %-5d %5u %5llu ", ep, sk, 178 178 sctp_sk(sk)->type, sk->sk_state, hash, 179 179 ep->base.bind_addr.port, 180 180 from_kuid_munged(seq_user_ns(seq), sk_uid(sk)), ··· 261 261 262 262 seq_printf(seq, 263 263 "%8pK %8pK %-3d %-3d %-2d %-4d " 264 - "%4d %8d %8d %7u %5lu %-5d %5d ", 264 + "%4d %8d %8d %7u %5llu %-5d %5d ", 265 265 assoc, sk, sctp_sk(sk)->type, sk->sk_state, 266 266 assoc->state, 0, 267 267 assoc->assoc_id,
+1 -1
net/unix/af_unix.c
··· 3537 3537 struct unix_sock *u = unix_sk(s); 3538 3538 unix_state_lock(s); 3539 3539 3540 - seq_printf(seq, "%pK: %08X %08X %08X %04X %02X %5lu", 3540 + seq_printf(seq, "%pK: %08X %08X %08X %04X %02X %5llu", 3541 3541 s, 3542 3542 refcount_read(&s->sk_refcnt), 3543 3543 0,
+3 -3
net/unix/diag.c
··· 45 45 static int sk_diag_dump_peer(struct sock *sk, struct sk_buff *nlskb) 46 46 { 47 47 struct sock *peer; 48 - int ino; 48 + u64 ino; 49 49 50 50 peer = unix_peer_get(sk); 51 51 if (peer) { ··· 112 112 113 113 static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct unix_diag_req *req, 114 114 struct user_namespace *user_ns, 115 - u32 portid, u32 seq, u32 flags, int sk_ino) 115 + u32 portid, u32 seq, u32 flags, u64 sk_ino) 116 116 { 117 117 struct nlmsghdr *nlh; 118 118 struct unix_diag_msg *rep; ··· 186 186 num = 0; 187 187 spin_lock(&net->unx.table.locks[slot]); 188 188 sk_for_each(sk, &net->unx.table.buckets[slot]) { 189 - int sk_ino; 189 + u64 sk_ino; 190 190 191 191 if (num < s_num) 192 192 goto next;
+1 -1
net/xdp/xsk_diag.c
··· 92 92 static int xsk_diag_fill(struct sock *sk, struct sk_buff *nlskb, 93 93 struct xdp_diag_req *req, 94 94 struct user_namespace *user_ns, 95 - u32 portid, u32 seq, u32 flags, int sk_ino) 95 + u32 portid, u32 seq, u32 flags, u64 sk_ino) 96 96 { 97 97 struct xdp_sock *xs = xdp_sk(sk); 98 98 struct xdp_diag_msg *msg;