@@ -204,12 +204,17 @@ static bool is_abstract_socket(struct sock *const sock)
204
204
return false;
205
205
}
206
206
207
+ static const struct access_masks unix_scope = {
208
+ .scope = LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET ,
209
+ };
210
+
207
211
static int hook_unix_stream_connect (struct sock * const sock ,
208
212
struct sock * const other ,
209
213
struct sock * const newsk )
210
214
{
211
215
const struct landlock_ruleset * const dom =
212
- landlock_get_current_domain ();
216
+ landlock_get_applicable_domain (landlock_get_current_domain (),
217
+ unix_scope );
213
218
214
219
/* Quick return for non-landlocked tasks. */
215
220
if (!dom )
@@ -225,7 +230,8 @@ static int hook_unix_may_send(struct socket *const sock,
225
230
struct socket * const other )
226
231
{
227
232
const struct landlock_ruleset * const dom =
228
- landlock_get_current_domain ();
233
+ landlock_get_applicable_domain (landlock_get_current_domain (),
234
+ unix_scope );
229
235
230
236
if (!dom )
231
237
return 0 ;
@@ -243,6 +249,10 @@ static int hook_unix_may_send(struct socket *const sock,
243
249
return 0 ;
244
250
}
245
251
252
+ static const struct access_masks signal_scope = {
253
+ .scope = LANDLOCK_SCOPE_SIGNAL ,
254
+ };
255
+
246
256
static int hook_task_kill (struct task_struct * const p ,
247
257
struct kernel_siginfo * const info , const int sig ,
248
258
const struct cred * const cred )
@@ -256,6 +266,7 @@ static int hook_task_kill(struct task_struct *const p,
256
266
} else {
257
267
dom = landlock_get_current_domain ();
258
268
}
269
+ dom = landlock_get_applicable_domain (dom , signal_scope );
259
270
260
271
/* Quick return for non-landlocked tasks. */
261
272
if (!dom )
@@ -279,7 +290,8 @@ static int hook_file_send_sigiotask(struct task_struct *tsk,
279
290
280
291
/* Lock already held by send_sigio() and send_sigurg(). */
281
292
lockdep_assert_held (& fown -> lock );
282
- dom = landlock_file (fown -> file )-> fown_domain ;
293
+ dom = landlock_get_applicable_domain (
294
+ landlock_file (fown -> file )-> fown_domain , signal_scope );
283
295
284
296
/* Quick return for unowned socket. */
285
297
if (!dom )
0 commit comments