@@ -69,38 +69,38 @@ int main(int argc, char **argv)
69
69
if (passp ) {
70
70
printf ("Unlocking LUKS root filesystem\n" );
71
71
72
- if (mount ("proc" , "/proc" , "proc" ,
73
- MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME , NULL ) < 0 ) {
74
- perror ("mount(/proc)" );
75
- exit (-1 );
76
- }
72
+ if (mount ("proc" , "/proc" , "proc" ,
73
+ MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME , NULL ) < 0 ) {
74
+ perror ("mount(/proc)" );
75
+ exit (-1 );
76
+ }
77
77
78
- pipe (pipefd );
78
+ pipe (pipefd );
79
79
80
- pid = fork ();
81
- if (pid == 0 ) {
80
+ pid = fork ();
81
+ if (pid == 0 ) {
82
82
close (pipefd [1 ]);
83
- dup2 (pipefd [0 ], 0 );
84
- close (pipefd [0 ]);
83
+ dup2 (pipefd [0 ], 0 );
84
+ close (pipefd [0 ]);
85
85
86
- if (execl ("/sbin/cryptsetup" , "cryptsetup" , "open" , "/dev/vda" , "luksroot" , "-" , NULL ) < 0 ) {
86
+ if (execl ("/sbin/cryptsetup" , "cryptsetup" , "open" , "/dev/vda" , "luksroot" , "-" , NULL ) < 0 ) {
87
87
perror ("execl" );
88
88
exit (-1 );
89
89
}
90
- } else {
91
- write (pipefd [1 ], passp , strnlen (passp , 128 ));
92
- close (pipefd [1 ]);
93
- waitpid (pid , & wstatus , 0 );
94
- }
90
+ } else {
91
+ write (pipefd [1 ], passp , strnlen (passp , 128 ));
92
+ close (pipefd [1 ]);
93
+ waitpid (pid , & wstatus , 0 );
94
+ }
95
95
96
96
printf ("Mounting LUKS root filesystem\n" );
97
97
98
- if (mount ("/dev/mapper/luksroot" , "/luksroot" , "ext4" , 0 , NULL ) < 0 ) {
99
- perror ("mount(/luksroot)" );
100
- exit (-1 );
101
- }
98
+ if (mount ("/dev/mapper/luksroot" , "/luksroot" , "ext4" , 0 , NULL ) < 0 ) {
99
+ perror ("mount(/luksroot)" );
100
+ exit (-1 );
101
+ }
102
102
103
- chdir ("/luksroot" );
103
+ chdir ("/luksroot" );
104
104
105
105
if (mount ("." , "/" , NULL , MS_MOVE , NULL )) {
106
106
perror ("remount root" );
@@ -110,19 +110,19 @@ int main(int argc, char **argv)
110
110
}
111
111
112
112
if (mount ("proc" , "/proc" , "proc" ,
113
- MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME , NULL ) < 0 ) {
113
+ MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME , NULL ) < 0 ) {
114
114
perror ("mount(/proc)" );
115
115
exit (-1 );
116
116
}
117
117
118
118
if (mount ("sysfs" , "/sys" , "sysfs" ,
119
- MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME , NULL ) < 0 ) {
119
+ MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME , NULL ) < 0 ) {
120
120
perror ("mount(/sys)" );
121
121
exit (-1 );
122
122
}
123
123
124
124
if (mount ("cgroup2" , "/sys/fs/cgroup" , "cgroup2" ,
125
- MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME , NULL ) < 0 ) {
125
+ MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME , NULL ) < 0 ) {
126
126
perror ("mount(/sys/fs/cgroup)" );
127
127
exit (-1 );
128
128
}
@@ -133,7 +133,7 @@ int main(int argc, char **argv)
133
133
}
134
134
135
135
if (mount ("devpts" , "/dev/pts" , "devpts" ,
136
- MS_NOEXEC | MS_NOSUID | MS_RELATIME , NULL ) < 0 ) {
136
+ MS_NOEXEC | MS_NOSUID | MS_RELATIME , NULL ) < 0 ) {
137
137
perror ("mount(/dev/pts)" );
138
138
exit (-1 );
139
139
}
@@ -144,7 +144,7 @@ int main(int argc, char **argv)
144
144
}
145
145
146
146
if (mount ("tmpfs" , "/dev/shm" , "tmpfs" ,
147
- MS_NOEXEC | MS_NOSUID | MS_RELATIME , NULL ) < 0 ) {
147
+ MS_NOEXEC | MS_NOSUID | MS_RELATIME , NULL ) < 0 ) {
148
148
perror ("mount(/dev/shm)" );
149
149
exit (-1 );
150
150
}
0 commit comments