binfmt_misc.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766
  1. /*
  2. * binfmt_misc.c
  3. *
  4. * Copyright (C) 1997 Richard Günther
  5. *
  6. * binfmt_misc detects binaries via a magic or filename extension and invokes
  7. * a specified wrapper. This should obsolete binfmt_java, binfmt_em86 and
  8. * binfmt_mz.
  9. *
  10. * 1997-04-25 first version
  11. * [...]
  12. * 1997-05-19 cleanup
  13. * 1997-06-26 hpa: pass the real filename rather than argv[0]
  14. * 1997-06-30 minor cleanup
  15. * 1997-08-09 removed extension stripping, locking cleanup
  16. * 2001-02-28 AV: rewritten into something that resembles C. Original didn't.
  17. */
  18. #include <linux/module.h>
  19. #include <linux/init.h>
  20. #include <linux/sched.h>
  21. #include <linux/binfmts.h>
  22. #include <linux/slab.h>
  23. #include <linux/ctype.h>
  24. #include <linux/file.h>
  25. #include <linux/pagemap.h>
  26. #include <linux/namei.h>
  27. #include <linux/mount.h>
  28. #include <linux/syscalls.h>
  29. #include <asm/uaccess.h>
  30. enum {
  31. VERBOSE_STATUS = 1 /* make it zero to save 400 bytes kernel memory */
  32. };
  33. static LIST_HEAD(entries);
  34. static int enabled = 1;
  35. enum {Enabled, Magic};
  36. #define MISC_FMT_PRESERVE_ARGV0 (1<<31)
  37. #define MISC_FMT_OPEN_BINARY (1<<30)
  38. #define MISC_FMT_CREDENTIALS (1<<29)
  39. typedef struct {
  40. struct list_head list;
  41. unsigned long flags; /* type, status, etc. */
  42. int offset; /* offset of magic */
  43. int size; /* size of magic/mask */
  44. char *magic; /* magic or filename extension */
  45. char *mask; /* mask, NULL for exact match */
  46. char *interpreter; /* filename of interpreter */
  47. char *name;
  48. struct dentry *dentry;
  49. } Node;
  50. static DEFINE_RWLOCK(entries_lock);
  51. static struct file_system_type bm_fs_type;
  52. static struct vfsmount *bm_mnt;
  53. static int entry_count;
  54. /*
  55. * Check if we support the binfmt
  56. * if we do, return the node, else NULL
  57. * locking is done in load_misc_binary
  58. */
  59. static Node *check_file(struct linux_binprm *bprm)
  60. {
  61. char *p = strrchr(bprm->interp, '.');
  62. struct list_head *l;
  63. list_for_each(l, &entries) {
  64. Node *e = list_entry(l, Node, list);
  65. char *s;
  66. int j;
  67. if (!test_bit(Enabled, &e->flags))
  68. continue;
  69. if (!test_bit(Magic, &e->flags)) {
  70. if (p && !strcmp(e->magic, p + 1))
  71. return e;
  72. continue;
  73. }
  74. s = bprm->buf + e->offset;
  75. if (e->mask) {
  76. for (j = 0; j < e->size; j++)
  77. if ((*s++ ^ e->magic[j]) & e->mask[j])
  78. break;
  79. } else {
  80. for (j = 0; j < e->size; j++)
  81. if ((*s++ ^ e->magic[j]))
  82. break;
  83. }
  84. if (j == e->size)
  85. return e;
  86. }
  87. return NULL;
  88. }
  89. /*
  90. * the loader itself
  91. */
  92. static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs)
  93. {
  94. Node *fmt;
  95. struct file * interp_file = NULL;
  96. char iname[BINPRM_BUF_SIZE];
  97. char *iname_addr = iname;
  98. int retval;
  99. int fd_binary = -1;
  100. struct files_struct *files = NULL;
  101. retval = -ENOEXEC;
  102. if (!enabled)
  103. goto _ret;
  104. /* to keep locking time low, we copy the interpreter string */
  105. read_lock(&entries_lock);
  106. fmt = check_file(bprm);
  107. if (fmt)
  108. strlcpy(iname, fmt->interpreter, BINPRM_BUF_SIZE);
  109. read_unlock(&entries_lock);
  110. if (!fmt)
  111. goto _ret;
  112. if (!(fmt->flags & MISC_FMT_PRESERVE_ARGV0)) {
  113. remove_arg_zero(bprm);
  114. }
  115. if (fmt->flags & MISC_FMT_OPEN_BINARY) {
  116. files = current->files;
  117. retval = unshare_files();
  118. if (retval < 0)
  119. goto _ret;
  120. if (files == current->files) {
  121. put_files_struct(files);
  122. files = NULL;
  123. }
  124. /* if the binary should be opened on behalf of the
  125. * interpreter than keep it open and assign descriptor
  126. * to it */
  127. fd_binary = get_unused_fd();
  128. if (fd_binary < 0) {
  129. retval = fd_binary;
  130. goto _unshare;
  131. }
  132. fd_install(fd_binary, bprm->file);
  133. /* if the binary is not readable than enforce mm->dumpable=0
  134. regardless of the interpreter's permissions */
  135. if (file_permission(bprm->file, MAY_READ))
  136. bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP;
  137. allow_write_access(bprm->file);
  138. bprm->file = NULL;
  139. /* mark the bprm that fd should be passed to interp */
  140. bprm->interp_flags |= BINPRM_FLAGS_EXECFD;
  141. bprm->interp_data = fd_binary;
  142. } else {
  143. allow_write_access(bprm->file);
  144. fput(bprm->file);
  145. bprm->file = NULL;
  146. }
  147. /* make argv[1] be the path to the binary */
  148. retval = copy_strings_kernel (1, &bprm->interp, bprm);
  149. if (retval < 0)
  150. goto _error;
  151. bprm->argc++;
  152. /* add the interp as argv[0] */
  153. retval = copy_strings_kernel (1, &iname_addr, bprm);
  154. if (retval < 0)
  155. goto _error;
  156. bprm->argc ++;
  157. bprm->interp = iname; /* for binfmt_script */
  158. interp_file = open_exec (iname);
  159. retval = PTR_ERR (interp_file);
  160. if (IS_ERR (interp_file))
  161. goto _error;
  162. bprm->file = interp_file;
  163. if (fmt->flags & MISC_FMT_CREDENTIALS) {
  164. /*
  165. * No need to call prepare_binprm(), it's already been
  166. * done. bprm->buf is stale, update from interp_file.
  167. */
  168. memset(bprm->buf, 0, BINPRM_BUF_SIZE);
  169. retval = kernel_read(bprm->file, 0, bprm->buf, BINPRM_BUF_SIZE);
  170. } else
  171. retval = prepare_binprm (bprm);
  172. if (retval < 0)
  173. goto _error;
  174. retval = search_binary_handler (bprm, regs);
  175. if (retval < 0)
  176. goto _error;
  177. if (files) {
  178. put_files_struct(files);
  179. files = NULL;
  180. }
  181. _ret:
  182. return retval;
  183. _error:
  184. if (fd_binary > 0)
  185. sys_close(fd_binary);
  186. bprm->interp_flags = 0;
  187. bprm->interp_data = 0;
  188. _unshare:
  189. if (files)
  190. reset_files_struct(current, files);
  191. goto _ret;
  192. }
  193. /* Command parsers */
  194. /*
  195. * parses and copies one argument enclosed in del from *sp to *dp,
  196. * recognising the \x special.
  197. * returns pointer to the copied argument or NULL in case of an
  198. * error (and sets err) or null argument length.
  199. */
  200. static char *scanarg(char *s, char del)
  201. {
  202. char c;
  203. while ((c = *s++) != del) {
  204. if (c == '\\' && *s == 'x') {
  205. s++;
  206. if (!isxdigit(*s++))
  207. return NULL;
  208. if (!isxdigit(*s++))
  209. return NULL;
  210. }
  211. }
  212. return s;
  213. }
  214. static int unquote(char *from)
  215. {
  216. char c = 0, *s = from, *p = from;
  217. while ((c = *s++) != '\0') {
  218. if (c == '\\' && *s == 'x') {
  219. s++;
  220. c = toupper(*s++);
  221. *p = (c - (isdigit(c) ? '0' : 'A' - 10)) << 4;
  222. c = toupper(*s++);
  223. *p++ |= c - (isdigit(c) ? '0' : 'A' - 10);
  224. continue;
  225. }
  226. *p++ = c;
  227. }
  228. return p - from;
  229. }
  230. static char * check_special_flags (char * sfs, Node * e)
  231. {
  232. char * p = sfs;
  233. int cont = 1;
  234. /* special flags */
  235. while (cont) {
  236. switch (*p) {
  237. case 'P':
  238. p++;
  239. e->flags |= MISC_FMT_PRESERVE_ARGV0;
  240. break;
  241. case 'O':
  242. p++;
  243. e->flags |= MISC_FMT_OPEN_BINARY;
  244. break;
  245. case 'C':
  246. p++;
  247. /* this flags also implies the
  248. open-binary flag */
  249. e->flags |= (MISC_FMT_CREDENTIALS |
  250. MISC_FMT_OPEN_BINARY);
  251. break;
  252. default:
  253. cont = 0;
  254. }
  255. }
  256. return p;
  257. }
  258. /*
  259. * This registers a new binary format, it recognises the syntax
  260. * ':name:type:offset:magic:mask:interpreter:flags'
  261. * where the ':' is the IFS, that can be chosen with the first char
  262. */
  263. static Node *create_entry(const char __user *buffer, size_t count)
  264. {
  265. Node *e;
  266. int memsize, err;
  267. char *buf, *p;
  268. char del;
  269. /* some sanity checks */
  270. err = -EINVAL;
  271. if ((count < 11) || (count > 256))
  272. goto out;
  273. err = -ENOMEM;
  274. memsize = sizeof(Node) + count + 8;
  275. e = kmalloc(memsize, GFP_USER);
  276. if (!e)
  277. goto out;
  278. p = buf = (char *)e + sizeof(Node);
  279. memset(e, 0, sizeof(Node));
  280. if (copy_from_user(buf, buffer, count))
  281. goto Efault;
  282. del = *p++; /* delimeter */
  283. memset(buf+count, del, 8);
  284. e->name = p;
  285. p = strchr(p, del);
  286. if (!p)
  287. goto Einval;
  288. *p++ = '\0';
  289. if (!e->name[0] ||
  290. !strcmp(e->name, ".") ||
  291. !strcmp(e->name, "..") ||
  292. strchr(e->name, '/'))
  293. goto Einval;
  294. switch (*p++) {
  295. case 'E': e->flags = 1<<Enabled; break;
  296. case 'M': e->flags = (1<<Enabled) | (1<<Magic); break;
  297. default: goto Einval;
  298. }
  299. if (*p++ != del)
  300. goto Einval;
  301. if (test_bit(Magic, &e->flags)) {
  302. char *s = strchr(p, del);
  303. if (!s)
  304. goto Einval;
  305. *s++ = '\0';
  306. e->offset = simple_strtoul(p, &p, 10);
  307. if (*p++)
  308. goto Einval;
  309. e->magic = p;
  310. p = scanarg(p, del);
  311. if (!p)
  312. goto Einval;
  313. p[-1] = '\0';
  314. if (!e->magic[0])
  315. goto Einval;
  316. e->mask = p;
  317. p = scanarg(p, del);
  318. if (!p)
  319. goto Einval;
  320. p[-1] = '\0';
  321. if (!e->mask[0])
  322. e->mask = NULL;
  323. e->size = unquote(e->magic);
  324. if (e->mask && unquote(e->mask) != e->size)
  325. goto Einval;
  326. if (e->size + e->offset > BINPRM_BUF_SIZE)
  327. goto Einval;
  328. } else {
  329. p = strchr(p, del);
  330. if (!p)
  331. goto Einval;
  332. *p++ = '\0';
  333. e->magic = p;
  334. p = strchr(p, del);
  335. if (!p)
  336. goto Einval;
  337. *p++ = '\0';
  338. if (!e->magic[0] || strchr(e->magic, '/'))
  339. goto Einval;
  340. p = strchr(p, del);
  341. if (!p)
  342. goto Einval;
  343. *p++ = '\0';
  344. }
  345. e->interpreter = p;
  346. p = strchr(p, del);
  347. if (!p)
  348. goto Einval;
  349. *p++ = '\0';
  350. if (!e->interpreter[0])
  351. goto Einval;
  352. p = check_special_flags (p, e);
  353. if (*p == '\n')
  354. p++;
  355. if (p != buf + count)
  356. goto Einval;
  357. return e;
  358. out:
  359. return ERR_PTR(err);
  360. Efault:
  361. kfree(e);
  362. return ERR_PTR(-EFAULT);
  363. Einval:
  364. kfree(e);
  365. return ERR_PTR(-EINVAL);
  366. }
  367. /*
  368. * Set status of entry/binfmt_misc:
  369. * '1' enables, '0' disables and '-1' clears entry/binfmt_misc
  370. */
  371. static int parse_command(const char __user *buffer, size_t count)
  372. {
  373. char s[4];
  374. if (!count)
  375. return 0;
  376. if (count > 3)
  377. return -EINVAL;
  378. if (copy_from_user(s, buffer, count))
  379. return -EFAULT;
  380. if (s[count-1] == '\n')
  381. count--;
  382. if (count == 1 && s[0] == '0')
  383. return 1;
  384. if (count == 1 && s[0] == '1')
  385. return 2;
  386. if (count == 2 && s[0] == '-' && s[1] == '1')
  387. return 3;
  388. return -EINVAL;
  389. }
  390. /* generic stuff */
  391. static void entry_status(Node *e, char *page)
  392. {
  393. char *dp;
  394. char *status = "disabled";
  395. const char * flags = "flags: ";
  396. if (test_bit(Enabled, &e->flags))
  397. status = "enabled";
  398. if (!VERBOSE_STATUS) {
  399. sprintf(page, "%s\n", status);
  400. return;
  401. }
  402. sprintf(page, "%s\ninterpreter %s\n", status, e->interpreter);
  403. dp = page + strlen(page);
  404. /* print the special flags */
  405. sprintf (dp, "%s", flags);
  406. dp += strlen (flags);
  407. if (e->flags & MISC_FMT_PRESERVE_ARGV0) {
  408. *dp ++ = 'P';
  409. }
  410. if (e->flags & MISC_FMT_OPEN_BINARY) {
  411. *dp ++ = 'O';
  412. }
  413. if (e->flags & MISC_FMT_CREDENTIALS) {
  414. *dp ++ = 'C';
  415. }
  416. *dp ++ = '\n';
  417. if (!test_bit(Magic, &e->flags)) {
  418. sprintf(dp, "extension .%s\n", e->magic);
  419. } else {
  420. int i;
  421. sprintf(dp, "offset %i\nmagic ", e->offset);
  422. dp = page + strlen(page);
  423. for (i = 0; i < e->size; i++) {
  424. sprintf(dp, "%02x", 0xff & (int) (e->magic[i]));
  425. dp += 2;
  426. }
  427. if (e->mask) {
  428. sprintf(dp, "\nmask ");
  429. dp += 6;
  430. for (i = 0; i < e->size; i++) {
  431. sprintf(dp, "%02x", 0xff & (int) (e->mask[i]));
  432. dp += 2;
  433. }
  434. }
  435. *dp++ = '\n';
  436. *dp = '\0';
  437. }
  438. }
  439. static struct inode *bm_get_inode(struct super_block *sb, int mode)
  440. {
  441. struct inode * inode = new_inode(sb);
  442. if (inode) {
  443. inode->i_mode = mode;
  444. inode->i_uid = 0;
  445. inode->i_gid = 0;
  446. inode->i_blocks = 0;
  447. inode->i_atime = inode->i_mtime = inode->i_ctime =
  448. current_fs_time(inode->i_sb);
  449. }
  450. return inode;
  451. }
  452. static void bm_clear_inode(struct inode *inode)
  453. {
  454. kfree(inode->i_private);
  455. }
  456. static void kill_node(Node *e)
  457. {
  458. struct dentry *dentry;
  459. write_lock(&entries_lock);
  460. dentry = e->dentry;
  461. if (dentry) {
  462. list_del_init(&e->list);
  463. e->dentry = NULL;
  464. }
  465. write_unlock(&entries_lock);
  466. if (dentry) {
  467. dentry->d_inode->i_nlink--;
  468. d_drop(dentry);
  469. dput(dentry);
  470. simple_release_fs(&bm_mnt, &entry_count);
  471. }
  472. }
  473. /* /<entry> */
  474. static ssize_t
  475. bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos)
  476. {
  477. Node *e = file->f_path.dentry->d_inode->i_private;
  478. loff_t pos = *ppos;
  479. ssize_t res;
  480. char *page;
  481. int len;
  482. if (!(page = (char*) __get_free_page(GFP_KERNEL)))
  483. return -ENOMEM;
  484. entry_status(e, page);
  485. len = strlen(page);
  486. res = -EINVAL;
  487. if (pos < 0)
  488. goto out;
  489. res = 0;
  490. if (pos >= len)
  491. goto out;
  492. if (len < pos + nbytes)
  493. nbytes = len - pos;
  494. res = -EFAULT;
  495. if (copy_to_user(buf, page + pos, nbytes))
  496. goto out;
  497. *ppos = pos + nbytes;
  498. res = nbytes;
  499. out:
  500. free_page((unsigned long) page);
  501. return res;
  502. }
  503. static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
  504. size_t count, loff_t *ppos)
  505. {
  506. struct dentry *root;
  507. Node *e = file->f_path.dentry->d_inode->i_private;
  508. int res = parse_command(buffer, count);
  509. switch (res) {
  510. case 1: clear_bit(Enabled, &e->flags);
  511. break;
  512. case 2: set_bit(Enabled, &e->flags);
  513. break;
  514. case 3: root = dget(file->f_path.mnt->mnt_sb->s_root);
  515. mutex_lock(&root->d_inode->i_mutex);
  516. kill_node(e);
  517. mutex_unlock(&root->d_inode->i_mutex);
  518. dput(root);
  519. break;
  520. default: return res;
  521. }
  522. return count;
  523. }
  524. static const struct file_operations bm_entry_operations = {
  525. .read = bm_entry_read,
  526. .write = bm_entry_write,
  527. };
  528. /* /register */
  529. static ssize_t bm_register_write(struct file *file, const char __user *buffer,
  530. size_t count, loff_t *ppos)
  531. {
  532. Node *e;
  533. struct inode *inode;
  534. struct dentry *root, *dentry;
  535. struct super_block *sb = file->f_path.mnt->mnt_sb;
  536. int err = 0;
  537. e = create_entry(buffer, count);
  538. if (IS_ERR(e))
  539. return PTR_ERR(e);
  540. root = dget(sb->s_root);
  541. mutex_lock(&root->d_inode->i_mutex);
  542. dentry = lookup_one_len(e->name, root, strlen(e->name));
  543. err = PTR_ERR(dentry);
  544. if (IS_ERR(dentry))
  545. goto out;
  546. err = -EEXIST;
  547. if (dentry->d_inode)
  548. goto out2;
  549. inode = bm_get_inode(sb, S_IFREG | 0644);
  550. err = -ENOMEM;
  551. if (!inode)
  552. goto out2;
  553. err = simple_pin_fs(&bm_fs_type, &bm_mnt, &entry_count);
  554. if (err) {
  555. iput(inode);
  556. inode = NULL;
  557. goto out2;
  558. }
  559. e->dentry = dget(dentry);
  560. inode->i_private = e;
  561. inode->i_fop = &bm_entry_operations;
  562. d_instantiate(dentry, inode);
  563. write_lock(&entries_lock);
  564. list_add(&e->list, &entries);
  565. write_unlock(&entries_lock);
  566. err = 0;
  567. out2:
  568. dput(dentry);
  569. out:
  570. mutex_unlock(&root->d_inode->i_mutex);
  571. dput(root);
  572. if (err) {
  573. kfree(e);
  574. return -EINVAL;
  575. }
  576. return count;
  577. }
  578. static const struct file_operations bm_register_operations = {
  579. .write = bm_register_write,
  580. };
  581. /* /status */
  582. static ssize_t
  583. bm_status_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
  584. {
  585. char *s = enabled ? "enabled" : "disabled";
  586. return simple_read_from_buffer(buf, nbytes, ppos, s, strlen(s));
  587. }
  588. static ssize_t bm_status_write(struct file * file, const char __user * buffer,
  589. size_t count, loff_t *ppos)
  590. {
  591. int res = parse_command(buffer, count);
  592. struct dentry *root;
  593. switch (res) {
  594. case 1: enabled = 0; break;
  595. case 2: enabled = 1; break;
  596. case 3: root = dget(file->f_path.mnt->mnt_sb->s_root);
  597. mutex_lock(&root->d_inode->i_mutex);
  598. while (!list_empty(&entries))
  599. kill_node(list_entry(entries.next, Node, list));
  600. mutex_unlock(&root->d_inode->i_mutex);
  601. dput(root);
  602. default: return res;
  603. }
  604. return count;
  605. }
  606. static const struct file_operations bm_status_operations = {
  607. .read = bm_status_read,
  608. .write = bm_status_write,
  609. };
  610. /* Superblock handling */
  611. static const struct super_operations s_ops = {
  612. .statfs = simple_statfs,
  613. .clear_inode = bm_clear_inode,
  614. };
  615. static int bm_fill_super(struct super_block * sb, void * data, int silent)
  616. {
  617. static struct tree_descr bm_files[] = {
  618. [2] = {"status", &bm_status_operations, S_IWUSR|S_IRUGO},
  619. [3] = {"register", &bm_register_operations, S_IWUSR},
  620. /* last one */ {""}
  621. };
  622. int err = simple_fill_super(sb, 0x42494e4d, bm_files);
  623. if (!err)
  624. sb->s_op = &s_ops;
  625. return err;
  626. }
  627. static int bm_get_sb(struct file_system_type *fs_type,
  628. int flags, const char *dev_name, void *data, struct vfsmount *mnt)
  629. {
  630. return get_sb_single(fs_type, flags, data, bm_fill_super, mnt);
  631. }
  632. static struct linux_binfmt misc_format = {
  633. .module = THIS_MODULE,
  634. .load_binary = load_misc_binary,
  635. };
  636. static struct file_system_type bm_fs_type = {
  637. .owner = THIS_MODULE,
  638. .name = "binfmt_misc",
  639. .get_sb = bm_get_sb,
  640. .kill_sb = kill_litter_super,
  641. };
  642. static int __init init_misc_binfmt(void)
  643. {
  644. int err = register_filesystem(&bm_fs_type);
  645. if (!err) {
  646. err = register_binfmt(&misc_format);
  647. if (err)
  648. unregister_filesystem(&bm_fs_type);
  649. }
  650. return err;
  651. }
  652. static void __exit exit_misc_binfmt(void)
  653. {
  654. unregister_binfmt(&misc_format);
  655. unregister_filesystem(&bm_fs_type);
  656. }
  657. core_initcall(init_misc_binfmt);
  658. module_exit(exit_misc_binfmt);
  659. MODULE_LICENSE("GPL");