mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
Merge patch series "selftests/clone3: fix cap_checkpoint_restore test"
Eva Kurchatova <eva.kurchatova@virtuozzo.com> says: This patchset fixes misuse of libcap library interface, and existing compilation warnings due to unused variables. * patches from https://patch.msgid.link/20260524163840.34247-1-eva.kurchatova@virtuozzo.com: selftests/clone3: remove unused variables selftests/clone3: fix libcap interface usage Link: https://patch.msgid.link/20260524163840.34247-1-eva.kurchatova@virtuozzo.com Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
commit
ee8ab98f83
|
|
@ -53,9 +53,6 @@ static int call_clone3_set_tid(struct __test_metadata *_metadata,
|
|||
}
|
||||
|
||||
if (pid == 0) {
|
||||
int ret;
|
||||
char tmp = 0;
|
||||
|
||||
TH_LOG("I am the child, my PID is %d (expected %d)", getpid(), set_tid[0]);
|
||||
|
||||
if (set_tid[0] != getpid())
|
||||
|
|
@ -87,15 +84,11 @@ static int test_clone3_set_tid(struct __test_metadata *_metadata,
|
|||
return ret;
|
||||
}
|
||||
|
||||
struct libcap {
|
||||
struct __user_cap_header_struct hdr;
|
||||
struct __user_cap_data_struct data[2];
|
||||
};
|
||||
|
||||
static int set_capability(void)
|
||||
{
|
||||
cap_value_t cap_values[] = { CAP_SETUID, CAP_SETGID };
|
||||
struct libcap *cap;
|
||||
cap_value_t cap_values[] = {
|
||||
CAP_SETUID, CAP_SETGID, CAP_CHECKPOINT_RESTORE
|
||||
};
|
||||
int ret = -1;
|
||||
cap_t caps;
|
||||
|
||||
|
|
@ -111,14 +104,8 @@ static int set_capability(void)
|
|||
goto out;
|
||||
}
|
||||
|
||||
cap_set_flag(caps, CAP_EFFECTIVE, 2, cap_values, CAP_SET);
|
||||
cap_set_flag(caps, CAP_PERMITTED, 2, cap_values, CAP_SET);
|
||||
|
||||
cap = (struct libcap *) caps;
|
||||
|
||||
/* 40 -> CAP_CHECKPOINT_RESTORE */
|
||||
cap->data[1].effective |= 1 << (40 - 32);
|
||||
cap->data[1].permitted |= 1 << (40 - 32);
|
||||
cap_set_flag(caps, CAP_EFFECTIVE, 3, cap_values, CAP_SET);
|
||||
cap_set_flag(caps, CAP_PERMITTED, 3, cap_values, CAP_SET);
|
||||
|
||||
if (cap_set_proc(caps)) {
|
||||
perror("cap_set_proc");
|
||||
|
|
@ -135,7 +122,6 @@ TEST(clone3_cap_checkpoint_restore)
|
|||
{
|
||||
pid_t pid;
|
||||
int status;
|
||||
int ret = 0;
|
||||
pid_t set_tid[1];
|
||||
|
||||
test_clone3_supported();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user