Skip to content

Commit

Permalink
request_key: Convert docs to docparse
Browse files Browse the repository at this point in the history
+ update copyright

Signed-off-by: Petr Vorel <[email protected]>
  • Loading branch information
pevik committed Jul 30, 2024
1 parent aaa210b commit 3115d5e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 25 deletions.
11 changes: 5 additions & 6 deletions testcases/kernel/syscalls/request_key/request_key01.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@
/*
* Copyright (c) 2016 Fujitsu Ltd.
* Copyright (c) 2017 Petr Vorel <[email protected]>
*
* Copyright (c) Linux Test Project, 2017-2024
* Author: Xiao Yang <[email protected]>
*/

/*
* Test Name: request_key01
/*\
* [Description]
*
* Test basic functionality of the request_key(2).
*
* Description:
* The testcase checks basic functionality of the request_key(2).
* request_key(2) asks the kernel to find a key which matches the
* specified description. If successful, it attaches it to the
* nominated keyring and returns its serial number.
*
*/

#include <errno.h>
Expand Down
19 changes: 8 additions & 11 deletions testcases/kernel/syscalls/request_key/request_key02.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@
/*
* Copyright (c) 2016 Fujitsu Ltd.
* Copyright (c) 2017 Petr Vorel <[email protected]>
*
* Copyright (c) Linux Test Project, 2017-2024
* Author: Xiao Yang <[email protected]>
*/

/*
* Test Name: request_key02
/*\
* [Description]
*
* Description:
* 1) request_key(2) fails if no matching key was found.
* 2) request_key(2) fails if A revoked key was found.
* 3) request_key(2) fails if An expired key was found.
* Basic request_key(2) failure checking. request_key(2) should return -1 and
* set expected errno:
*
* Expected Result:
* 1) request_key(2) should return -1 and set errno to ENOKEY.
* 2) request_key(2) should return -1 and set errno to EKEYREVOKED.
* 3) request_key(2) should return -1 and set errno to EKEYEXPIRED.
* 1. ENOKEY (no matching key was found),
* 2. EKEYREVOKED (revoked key was found)
* 3. EKEYEXPIRED (expired key was found)
*/

#include <errno.h>
Expand Down
13 changes: 8 additions & 5 deletions testcases/kernel/syscalls/request_key/request_key03.c
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2017 Google, Inc.
* Copyright (c) Linux Test Project, 2018-2024
*/

/*
/*\
* [Description]
*
* Regression test for two related bugs:
*
* (1) CVE-2017-15299, fixed by commit 60ff5b2f547a ("KEYS: don't let add_key()
* update an uninstantiated key")
* (2) CVE-2017-15951, fixed by commit 363b02dab09b ("KEYS: Fix race between
* updating and finding a negative key")
* 1. CVE-2017-15299, fixed by commit 60ff5b2f547a ("KEYS: don't let add_key()
* update an uninstantiated key")
* 2. CVE-2017-15951, fixed by commit 363b02dab09b ("KEYS: Fix race between
* updating and finding a negative key")
*
* We test for the bugs together because the reproduction steps are essentially
* the same: repeatedly try to add/update a key with add_key() while requesting
Expand Down
5 changes: 4 additions & 1 deletion testcases/kernel/syscalls/request_key/request_key04.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2018 Google, Inc.
* Copyright (c) Linux Test Project, 2018-2024
*/

/*
/*\
* [Description]
*
* Regression test for commit 4dca6ea1d943 ("KEYS: add missing permission check
* for request_key() destination"), or CVE-2017-17807. This bug allowed adding
* a key to a keyring given only Search permission to that keyring, rather than
Expand Down
8 changes: 6 additions & 2 deletions testcases/kernel/syscalls/request_key/request_key05.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2017 Richard Palethorpe <[email protected]>
* Copyright (c) Linux Test Project, 2018-2024
*/
/*
* Test for CVE-2017-6951, original reproducer can be found here:

/*\
* [Description]
*
* Test for CVE-2017-6951, original reproducer:
* http://www.spinics.net/lists/keyrings/msg01845.html
*
* request_key() is not in glibc, so we just use the syscall directly instead
Expand Down

0 comments on commit 3115d5e

Please sign in to comment.