@@ -204,12 +204,22 @@ static bool is_abstract_socket(struct sock *const sock)
204
204
return false;
205
205
}
206
206
207
+ static const struct landlock_ruleset * get_current_unix_scope_domain (void )
208
+ {
209
+ const union access_masks unix_scope = {
210
+ .scope = LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET ,
211
+ };
212
+
213
+ return landlock_match_ruleset (landlock_get_current_domain (),
214
+ unix_scope );
215
+ }
216
+
207
217
static int hook_unix_stream_connect (struct sock * const sock ,
208
218
struct sock * const other ,
209
219
struct sock * const newsk )
210
220
{
211
221
const struct landlock_ruleset * const dom =
212
- landlock_get_current_domain ();
222
+ get_current_unix_scope_domain ();
213
223
214
224
/* Quick return for non-landlocked tasks. */
215
225
if (!dom )
@@ -225,7 +235,7 @@ static int hook_unix_may_send(struct socket *const sock,
225
235
struct socket * const other )
226
236
{
227
237
const struct landlock_ruleset * const dom =
228
- landlock_get_current_domain ();
238
+ get_current_unix_scope_domain ();
229
239
230
240
if (!dom )
231
241
return 0 ;
@@ -243,6 +253,10 @@ static int hook_unix_may_send(struct socket *const sock,
243
253
return 0 ;
244
254
}
245
255
256
+ static const union access_masks signal_scope = {
257
+ .scope = LANDLOCK_SCOPE_SIGNAL ,
258
+ };
259
+
246
260
static int hook_task_kill (struct task_struct * const p ,
247
261
struct kernel_siginfo * const info , const int sig ,
248
262
const struct cred * const cred )
@@ -256,6 +270,7 @@ static int hook_task_kill(struct task_struct *const p,
256
270
} else {
257
271
dom = landlock_get_current_domain ();
258
272
}
273
+ dom = landlock_match_ruleset (dom , signal_scope );
259
274
260
275
/* Quick return for non-landlocked tasks. */
261
276
if (!dom )
@@ -279,7 +294,8 @@ static int hook_file_send_sigiotask(struct task_struct *tsk,
279
294
280
295
/* Lock already held by send_sigio() and send_sigurg(). */
281
296
lockdep_assert_held (& fown -> lock );
282
- dom = landlock_file (fown -> file )-> fown_domain ;
297
+ dom = landlock_match_ruleset (landlock_file (fown -> file )-> fown_domain ,
298
+ signal_scope );
283
299
284
300
/* Quick return for unowned socket. */
285
301
if (!dom )
0 commit comments