From: "Lai, Yi" <yi1.lai@intel.com>
To: Shuah Khan <skhan@linuxfoundation.org>
Cc: brauner@kernel.org, shuah@kernel.org, areber@redhat.com,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
yi1.lai@linux.intel.com
Subject: Re: [PATCH] selftests/clone3: Fix capability dropping by using standard libcap API
Date: Wed, 6 May 2026 16:16:40 +0800 [thread overview]
Message-ID: <afr46ClR+mm7cAGV@ly-workstation> (raw)
In-Reply-To: <acxw3gZcmX8Hmiuh@ly-workstation>
On Wed, Apr 01, 2026 at 09:11:59AM +0800, Lai, Yi wrote:
> On Tue, Mar 31, 2026 at 02:10:09PM -0600, Shuah Khan wrote:
> > On 3/9/26 21:14, Yi Lai wrote:
> > > The clone3_cap_checkpoint_restore.c selftest defined its own 'struct
> > > libcap' to manually cast and manipulate the internal memory layout of
> > > the opaque 'cap_t' type.
> > >
> > > Starting with libcap v2.60 (commit aca076443591 "Make cap_t operations
> > > thread safe"), a '__u8 mutex' was added to the beginning of the internal
> > > 'struct _cap_struct'. This structural shift breaks the selftest's custom
> > > struct layout assumptions, causing capability corruption and leading to
> > > failures during test execution.
> > >
> > > Fix this by removing the custom struct definition and use the standard
> > > cap_set_flag() API.
> >
> > What king of failures are you seeing? Can you send the failures from
> > the run?
> >
>
> I can reproduce the failure on CentOS Stream 10 with libcap 2.69:
>
> TAP version 13
> 1..1
> # Starting 1 tests from 1 test cases.
> # RUN global.clone3_cap_checkpoint_restore ...
> # clone3() syscall supported
> # clone3_cap_checkpoint_restore.c:151:clone3_cap_checkpoint_restore:Child has PID 10647
> cap_set_proc: Operation not permitted
> # clone3_cap_checkpoint_restore.c:160:clone3_cap_checkpoint_restore:Expected set_capability() (-1) == 0 (0)
> # clone3_cap_checkpoint_restore.c:161:clone3_cap_checkpoint_restore:Could not set CAP_CHECKPOINT_RESTORE
> # clone3_cap_checkpoint_restore: Test terminated by assertion
> # FAIL global.clone3_cap_checkpoint_restore
> not ok 1 global.clone3_cap_checkpoint_restore
> # FAILED: 0 / 1 tests passed.
> # Totals: pass:0 fail:1 xfail:0 xpass:0 skip:0 error:0
>
> After applying the proposed fix patch that uses standard libcap APIs,
> the test passes in my test environment. It also passes on CentOS Stream
> 9 with libcap 2.48 (<2.60).
>
Hi Shuah,
Do you have concerns in terms of this fix? Please let me know if any
suggestions.
Thank you,
Yi Lai
> Regards,
> Yi Lai
>
> > >
> > > Fixes: 1d27a0be16d6 ("selftests: add clone3() CAP_CHECKPOINT_RESTORE test")
> > > Signed-off-by: Yi Lai <yi1.lai@intel.com>
> > > ---
> >
> > thanks,
> > -- Shuah
prev parent reply other threads:[~2026-05-06 8:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 3:14 [PATCH] selftests/clone3: Fix capability dropping by using standard libcap API Yi Lai
2026-03-31 20:10 ` Shuah Khan
2026-04-01 1:11 ` Lai, Yi
2026-05-06 8:16 ` Lai, Yi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=afr46ClR+mm7cAGV@ly-workstation \
--to=yi1.lai@intel.com \
--cc=areber@redhat.com \
--cc=brauner@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=yi1.lai@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox