Project

General

Profile

Bug #269

Modload functions use unsafe operations with configuration files

Added by Alexander Eremin over 9 years ago. Updated over 9 years ago.

Status:
Resolved
Priority:
Normal
Category:
-
Start date:
2010-09-27
Due date:
2010-10-12
% Done:

100%

Estimated time:
Difficulty:
Tags:

Description

For example, in case of some error while deleting entry from minor_perm we can leave our system unbootable.
This may be due to the fact that in case of error, "unlink" function is used for existing config file:
drvsubr.c:
...
} else if (rename(newfile, oldfile) -1) {
perror(NULL);
(void) fprintf(stderr, gettext(ERR_UPDATE), oldfile);
(void) unlink(oldfile); /* here we can lose old file in case of error of next "link" */
(void) unlink(newfile);
if (link(tmphold, oldfile) -1) {
...

A possible solution is to create the new temporary file and then just rename it to the old file.


Files

mail_msg (1.81 KB) mail_msg Alexander Eremin, 2010-10-01 04:17 AM

History

#1

Updated by Garrett D'Amore over 9 years ago

  • Assignee set to Alexander Eremin
#2

Updated by Alexander Eremin over 9 years ago

Webrev is available at http://cr.illumos.org/view/7gt0oztx/
Dependent cmds were tested, adding and deleting records are correctly,
mail_msg is attached.

#3

Updated by Alexander Eremin over 9 years ago

  • Status changed from New to In Progress
#4

Updated by Alexander Eremin over 9 years ago

  • Due date set to 2010-10-12
  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Fixed in changeset: 13207:4f482eb481b3

Also available in: Atom PDF