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.

Merge tag 'uml-for-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux

Pull UML updates from Johannes Berg:
"UML was _really_ quiet, with just four small commits:

- two signal handling fixes

- dynamic addition of virtio devices

- a single code cleanup"

* tag 'uml-for-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux:
arch/um: remove unused varible err in remove_files_and_dir()
um: virtio_uml: Support adding devices via mconsole
um: Handle SIGCHLD in seccomp mode like other IRQ signals
um: Preserve errno within signal handler

+57 -6
+50 -1
arch/um/drivers/virtio_uml.c
··· 34 34 #include <irq_kern.h> 35 35 #include <init.h> 36 36 #include <os.h> 37 + #include "mconsole_kern.h" 37 38 #include "vhost_user.h" 38 39 39 40 #define MAX_SUPPORTED_QUEUE_SIZE 256 ··· 1283 1282 .release = vu_cmdline_release_dev, 1284 1283 }; 1285 1284 1285 + static DEFINE_MUTEX(vu_cmdline_lock); 1286 1286 static bool vu_cmdline_parent_registered; 1287 1287 static int vu_cmdline_id; 1288 1288 ··· 1311 1309 vu_unregister_cmdline_device(&pdata->pdev->dev, NULL); 1312 1310 } 1313 1311 1314 - static int vu_cmdline_set(const char *device, const struct kernel_param *kp) 1312 + static int vu_cmdline_set_device(const char *device) 1315 1313 { 1316 1314 const char *ids = strchr(device, ':'); 1317 1315 unsigned int virtio_device_id; ··· 1322 1320 1323 1321 if (!ids || ids == device) 1324 1322 return -EINVAL; 1323 + 1324 + guard(mutex)(&vu_cmdline_lock); 1325 1325 1326 1326 processed = sscanf(ids, ":%u%n:%d%n", 1327 1327 &virtio_device_id, &consumed, ··· 1370 1366 return err; 1371 1367 } 1372 1368 1369 + static int vu_cmdline_set(const char *device, const struct kernel_param *kp) 1370 + { 1371 + return vu_cmdline_set_device(device); 1372 + } 1373 + 1373 1374 static int vu_cmdline_get_device(struct device *dev, void *data) 1374 1375 { 1375 1376 struct platform_device *pdev = to_platform_device(dev); ··· 1389 1380 1390 1381 static int vu_cmdline_get(char *buffer, const struct kernel_param *kp) 1391 1382 { 1383 + guard(mutex)(&vu_cmdline_lock); 1384 + 1392 1385 buffer[0] = '\0'; 1393 1386 if (vu_cmdline_parent_registered) 1394 1387 device_for_each_child(&vu_cmdline_parent, buffer, ··· 1414 1403 1415 1404 static void vu_unregister_cmdline_devices(void) 1416 1405 { 1406 + guard(mutex)(&vu_cmdline_lock); 1407 + 1417 1408 if (vu_cmdline_parent_registered) { 1418 1409 device_for_each_child(&vu_cmdline_parent, NULL, 1419 1410 vu_unregister_cmdline_device); ··· 1423 1410 vu_cmdline_parent_registered = false; 1424 1411 } 1425 1412 } 1413 + 1414 + static int vu_mc_config(char *str, char **error_out) 1415 + { 1416 + if (*str != '=') { 1417 + *error_out = "Invalid config"; 1418 + return -EINVAL; 1419 + } 1420 + str += 1; 1421 + return vu_cmdline_set_device(str); 1422 + } 1423 + 1424 + static int vu_mc_id(char **str, int *start_out, int *end_out) 1425 + { 1426 + return -EOPNOTSUPP; 1427 + } 1428 + 1429 + static int vu_mc_remove(int n, char **error_out) 1430 + { 1431 + return -EOPNOTSUPP; 1432 + } 1433 + 1434 + static struct mc_device virtio_uml_mc = { 1435 + .list = LIST_HEAD_INIT(virtio_uml_mc.list), 1436 + .name = "virtio_uml.device", 1437 + .config = vu_mc_config, 1438 + .get_config = NULL, 1439 + .id = vu_mc_id, 1440 + .remove = vu_mc_remove, 1441 + }; 1442 + 1443 + static int __init virtio_uml_mc_init(void) 1444 + { 1445 + mconsole_register_dev(&virtio_uml_mc); 1446 + return 0; 1447 + } 1448 + late_initcall(virtio_uml_mc_init); 1426 1449 1427 1450 /* Platform driver */ 1428 1451
+6 -3
arch/um/os-Linux/signal.c
··· 16 16 #include <as-layout.h> 17 17 #include <kern_util.h> 18 18 #include <os.h> 19 + #include <skas.h> 19 20 #include <sysdep/mcontext.h> 20 21 #include <um_malloc.h> 21 22 #include <sys/ucontext.h> ··· 37 36 static void sig_handler_common(int sig, struct siginfo *si, mcontext_t *mc) 38 37 { 39 38 struct uml_pt_regs r; 40 - int save_errno = errno; 41 39 42 40 r.is_user = 0; 43 41 if (sig == SIGSEGV) { ··· 50 50 unblock_signals_trace(); 51 51 52 52 (*sig_info[sig])(sig, si, &r, mc); 53 - 54 - errno = save_errno; 55 53 } 56 54 57 55 /* ··· 205 207 { 206 208 ucontext_t *uc = p; 207 209 mcontext_t *mc = &uc->uc_mcontext; 210 + int save_errno = errno; 208 211 209 212 (*handlers[sig])(sig, (struct siginfo *)si, mc); 213 + 214 + errno = save_errno; 210 215 } 211 216 212 217 void set_handler(int sig) ··· 225 224 sigaddset(&action.sa_mask, SIGIO); 226 225 sigaddset(&action.sa_mask, SIGWINCH); 227 226 sigaddset(&action.sa_mask, SIGALRM); 227 + if (using_seccomp) 228 + sigaddset(&action.sa_mask, SIGCHLD); 228 229 229 230 if (sig == SIGSEGV) 230 231 flags |= SA_NODEFER;
+1 -2
arch/um/os-Linux/umid.c
··· 136 136 static inline int is_umdir_used(char *dir) 137 137 { 138 138 char pid[sizeof("nnnnnnnnn")], *end, *file; 139 - int fd, p, n, err; 139 + int fd, p, n; 140 140 size_t filelen = strlen(dir) + sizeof("/pid") + 1; 141 141 142 142 file = malloc(filelen); ··· 155 155 goto out; 156 156 } 157 157 158 - err = 0; 159 158 n = read(fd, pid, sizeof(pid)); 160 159 if (n < 0) { 161 160 printk(UM_KERN_ERR "is_umdir_used : couldn't read pid file "