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.

tomoyo: use u64 for holding inode->i_ino value

TOMOYO is treating numeric fields (including inode->i_ino) as "unsigned
long". Now that commit 0b2600f81cef ("treewide: change inode->i_ino from
unsigned long to u64") went upstream, update affected portions in TOMOYO.

While an administrator might write a rule that compares inode->i_ino with
an immediate value, this patch changes type of variable for inode->i_ino
to "u64" but does not change type of variable for the corresponding
immediate value to "u64" due to the following reasons.

It is likely that rules that compare inode->i_ino are for testing whether
the directories involved in e.g. rename() operation are the same (i.e.
comparison between two inode->i_ino values rather than one inode->i_ino
value and one immediate value).

It unlikely makes sense to compare inode->i_ino with an immediate value
larger than UINT_MAX.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

+8 -10
+4 -6
security/tomoyo/audit.c
··· 195 195 if (i & 1) { 196 196 pos += snprintf(buffer + pos, 197 197 tomoyo_buffer_len - 1 - pos, 198 - " path%u.parent={ uid=%u gid=%u ino=%lu perm=0%o }", 198 + " path%u.parent={ uid=%u gid=%u ino=%llu perm=0%o }", 199 199 (i >> 1) + 1, 200 200 from_kuid(&init_user_ns, stat->uid), 201 201 from_kgid(&init_user_ns, stat->gid), 202 - (unsigned long)stat->ino, 203 - stat->mode & S_IALLUGO); 202 + stat->ino, stat->mode & S_IALLUGO); 204 203 continue; 205 204 } 206 205 pos += snprintf(buffer + pos, tomoyo_buffer_len - 1 - pos, 207 - " path%u={ uid=%u gid=%u ino=%lu major=%u minor=%u perm=0%o type=%s", 206 + " path%u={ uid=%u gid=%u ino=%llu major=%u minor=%u perm=0%o type=%s", 208 207 (i >> 1) + 1, 209 208 from_kuid(&init_user_ns, stat->uid), 210 209 from_kgid(&init_user_ns, stat->gid), 211 - (unsigned long)stat->ino, 212 - MAJOR(dev), MINOR(dev), 210 + stat->ino, MAJOR(dev), MINOR(dev), 213 211 mode & S_IALLUGO, tomoyo_filetype(mode)); 214 212 if (S_ISCHR(mode) || S_ISBLK(mode)) { 215 213 dev = stat->rdev;
+1 -1
security/tomoyo/common.h
··· 567 567 struct tomoyo_mini_stat { 568 568 kuid_t uid; 569 569 kgid_t gid; 570 - ino_t ino; 570 + u64 ino; 571 571 umode_t mode; 572 572 dev_t dev; 573 573 dev_t rdev;
+3 -3
security/tomoyo/condition.c
··· 766 766 const struct tomoyo_condition *cond) 767 767 { 768 768 u32 i; 769 - unsigned long min_v[2] = { 0, 0 }; 770 - unsigned long max_v[2] = { 0, 0 }; 769 + u64 min_v[2] = { 0, 0 }; 770 + u64 max_v[2] = { 0, 0 }; 771 771 const struct tomoyo_condition_element *condp; 772 772 const struct tomoyo_number_union *numbers_p; 773 773 const struct tomoyo_name_union *names_p; ··· 834 834 /* Check numeric or bit-op expressions. */ 835 835 for (j = 0; j < 2; j++) { 836 836 const u8 index = j ? right : left; 837 - unsigned long value = 0; 837 + u64 value = 0; 838 838 839 839 switch (index) { 840 840 case TOMOYO_TASK_UID: