.. | .. |
---|
32 | 32 | int argv_count = bprm->argc; |
---|
33 | 33 | int envp_count = bprm->envc; |
---|
34 | 34 | bool truncated = false; |
---|
| 35 | + |
---|
35 | 36 | if (!buffer) |
---|
36 | 37 | return NULL; |
---|
37 | 38 | len = snprintf(buffer, tomoyo_buffer_len - 1, "argv[]={ "); |
---|
.. | .. |
---|
49 | 50 | while (offset < PAGE_SIZE) { |
---|
50 | 51 | const char *kaddr = dump->data; |
---|
51 | 52 | const unsigned char c = kaddr[offset++]; |
---|
| 53 | + |
---|
52 | 54 | if (cp == last_start) |
---|
53 | 55 | *cp++ = '"'; |
---|
54 | 56 | if (cp >= buffer + tomoyo_buffer_len - 32) { |
---|
.. | .. |
---|
154 | 156 | char *buffer = kmalloc(tomoyo_buffer_len, GFP_NOFS); |
---|
155 | 157 | int pos; |
---|
156 | 158 | u8 i; |
---|
| 159 | + |
---|
157 | 160 | if (!buffer) |
---|
158 | 161 | return NULL; |
---|
159 | 162 | |
---|
160 | 163 | tomoyo_convert_time(ktime_get_real_seconds(), &stamp); |
---|
161 | 164 | |
---|
162 | 165 | pos = snprintf(buffer, tomoyo_buffer_len - 1, |
---|
163 | | - "#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s " |
---|
164 | | - "granted=%s (global-pid=%u) task={ pid=%u ppid=%u " |
---|
165 | | - "uid=%u gid=%u euid=%u egid=%u suid=%u sgid=%u " |
---|
166 | | - "fsuid=%u fsgid=%u }", stamp.year, stamp.month, |
---|
167 | | - stamp.day, stamp.hour, stamp.min, stamp.sec, r->profile, |
---|
168 | | - tomoyo_mode[r->mode], tomoyo_yesno(r->granted), gpid, |
---|
169 | | - tomoyo_sys_getpid(), tomoyo_sys_getppid(), |
---|
| 166 | + "#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s granted=%s (global-pid=%u) task={ pid=%u ppid=%u uid=%u gid=%u euid=%u egid=%u suid=%u sgid=%u fsuid=%u fsgid=%u }", |
---|
| 167 | + stamp.year, stamp.month, stamp.day, stamp.hour, |
---|
| 168 | + stamp.min, stamp.sec, r->profile, tomoyo_mode[r->mode], |
---|
| 169 | + tomoyo_yesno(r->granted), gpid, tomoyo_sys_getpid(), |
---|
| 170 | + tomoyo_sys_getppid(), |
---|
170 | 171 | from_kuid(&init_user_ns, current_uid()), |
---|
171 | 172 | from_kgid(&init_user_ns, current_gid()), |
---|
172 | 173 | from_kuid(&init_user_ns, current_euid()), |
---|
.. | .. |
---|
185 | 186 | struct tomoyo_mini_stat *stat; |
---|
186 | 187 | unsigned int dev; |
---|
187 | 188 | umode_t mode; |
---|
| 189 | + |
---|
188 | 190 | if (!obj->stat_valid[i]) |
---|
189 | 191 | continue; |
---|
190 | 192 | stat = &obj->stat[i]; |
---|
.. | .. |
---|
193 | 195 | if (i & 1) { |
---|
194 | 196 | pos += snprintf(buffer + pos, |
---|
195 | 197 | tomoyo_buffer_len - 1 - pos, |
---|
196 | | - " path%u.parent={ uid=%u gid=%u " |
---|
197 | | - "ino=%lu perm=0%o }", (i >> 1) + 1, |
---|
| 198 | + " path%u.parent={ uid=%u gid=%u ino=%lu perm=0%o }", |
---|
| 199 | + (i >> 1) + 1, |
---|
198 | 200 | from_kuid(&init_user_ns, stat->uid), |
---|
199 | 201 | from_kgid(&init_user_ns, stat->gid), |
---|
200 | 202 | (unsigned long)stat->ino, |
---|
.. | .. |
---|
202 | 204 | continue; |
---|
203 | 205 | } |
---|
204 | 206 | pos += snprintf(buffer + pos, tomoyo_buffer_len - 1 - pos, |
---|
205 | | - " path%u={ uid=%u gid=%u ino=%lu major=%u" |
---|
206 | | - " minor=%u perm=0%o type=%s", (i >> 1) + 1, |
---|
| 207 | + " path%u={ uid=%u gid=%u ino=%lu major=%u minor=%u perm=0%o type=%s", |
---|
| 208 | + (i >> 1) + 1, |
---|
207 | 209 | from_kuid(&init_user_ns, stat->uid), |
---|
208 | 210 | from_kgid(&init_user_ns, stat->gid), |
---|
209 | 211 | (unsigned long)stat->ino, |
---|
.. | .. |
---|
249 | 251 | const char *symlink = NULL; |
---|
250 | 252 | int pos; |
---|
251 | 253 | const char *domainname = r->domain->domainname->name; |
---|
| 254 | + |
---|
252 | 255 | header = tomoyo_print_header(r); |
---|
253 | 256 | if (!header) |
---|
254 | 257 | return NULL; |
---|
.. | .. |
---|
256 | 259 | len += strlen(domainname) + strlen(header) + 10; |
---|
257 | 260 | if (r->ee) { |
---|
258 | 261 | struct file *file = r->ee->bprm->file; |
---|
| 262 | + |
---|
259 | 263 | realpath = tomoyo_realpath_from_path(&file->f_path); |
---|
260 | 264 | bprm_info = tomoyo_print_bprm(r->ee->bprm, &r->ee->dump); |
---|
261 | 265 | if (!realpath || !bprm_info) |
---|
.. | .. |
---|
275 | 279 | pos = snprintf(buf, len, "%s", header); |
---|
276 | 280 | if (realpath) { |
---|
277 | 281 | struct linux_binprm *bprm = r->ee->bprm; |
---|
| 282 | + |
---|
278 | 283 | pos += snprintf(buf + pos, len - pos, |
---|
279 | 284 | " exec={ realpath=\"%s\" argc=%d envc=%d %s }", |
---|
280 | 285 | realpath, bprm->argc, bprm->envc, bprm_info); |
---|
.. | .. |
---|
328 | 333 | const u8 category = tomoyo_index2category[index] + |
---|
329 | 334 | TOMOYO_MAX_MAC_INDEX; |
---|
330 | 335 | struct tomoyo_profile *p; |
---|
| 336 | + |
---|
331 | 337 | if (!tomoyo_policy_loaded) |
---|
332 | 338 | return false; |
---|
333 | 339 | p = tomoyo_profile(ns, profile); |
---|
.. | .. |
---|
362 | 368 | char *buf; |
---|
363 | 369 | struct tomoyo_log *entry; |
---|
364 | 370 | bool quota_exceeded = false; |
---|
| 371 | + |
---|
365 | 372 | if (!tomoyo_get_audit(r->domain->ns, r->profile, r->type, |
---|
366 | 373 | r->matched_acl, r->granted)) |
---|
367 | 374 | goto out; |
---|
.. | .. |
---|
413 | 420 | { |
---|
414 | 421 | va_list args; |
---|
415 | 422 | int len; |
---|
| 423 | + |
---|
416 | 424 | va_start(args, fmt); |
---|
417 | 425 | len = vsnprintf((char *) &len, 1, fmt, args) + 1; |
---|
418 | 426 | va_end(args); |
---|
.. | .. |
---|
431 | 439 | void tomoyo_read_log(struct tomoyo_io_buffer *head) |
---|
432 | 440 | { |
---|
433 | 441 | struct tomoyo_log *ptr = NULL; |
---|
| 442 | + |
---|
434 | 443 | if (head->r.w_pos) |
---|
435 | 444 | return; |
---|
436 | 445 | kfree(head->read_buf); |
---|