Skip to content

Attester: remove libtdx feature for TDX attester#1470

Draft
Xynnn007 wants to merge 3 commits into
confidential-containers:mainfrom
Xynnn007:attester/tdx-remove-ioctl
Draft

Attester: remove libtdx feature for TDX attester#1470
Xynnn007 wants to merge 3 commits into
confidential-containers:mainfrom
Xynnn007:attester/tdx-remove-ioctl

Conversation

@Xynnn007

Copy link
Copy Markdown
Member

No description provided.

@mythi

mythi commented May 13, 2026

Copy link
Copy Markdown
Contributor

Thanks! Just one quick comment: I know at least Openshift does not have RTMRs available so TDX_CMD_GET_REPORT0 ioctl is still needed to do MRCONFIGID parsing.

Could this PR be about dropping tdx-attest-dcap-ioctls featured code only?

@Xynnn007

Xynnn007 commented May 14, 2026

Copy link
Copy Markdown
Member Author

@mythi Thanks for the information. Do you mean that

  1. read/write rtmrs via configfs sysfs
  2. read mrconfigid via configfs
    are not supported by Openshift?

@mythi

mythi commented May 14, 2026

Copy link
Copy Markdown
Contributor

Yes. mrconfigid for initdata is read from report0 ioctl which is available without the DCAP wrapper in the default configuration.

Another clarification: the rtmr abi is not related to configfs reports abi

@Xynnn007 Xynnn007 force-pushed the attester/tdx-remove-ioctl branch 3 times, most recently from 5d91279 to 0397f03 Compare May 14, 2026 08:28
This patch adds the initdata (mr_configid) reading and RTMR
reading/writes via sysfs on TDX platform.

This is a feature of kernel >= 6.16 version.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
@Xynnn007 Xynnn007 force-pushed the attester/tdx-remove-ioctl branch 2 times, most recently from c2e5040 to dccb63e Compare May 14, 2026 09:26
@Xynnn007 Xynnn007 changed the title Attester: remove ioctl/libtdx feature for TDX attester Attester: remove libtdx feature for TDX attester May 14, 2026
@Xynnn007

Copy link
Copy Markdown
Member Author

Intel's DCAP internally has a compiler switch called V3_DRIVER that controls the type of ioctl writes for RTMR. I've implemented support for this in my PR. For IOR scenarios, the iocuddle crate can only make read requests with the req parameter using unsafe. Maybe there is better ways I did not know to avoid unsafe.

@Xynnn007 Xynnn007 marked this pull request as ready for review May 14, 2026 11:01
@Xynnn007 Xynnn007 requested a review from a team as a code owner May 14, 2026 11:01
@Xynnn007

Copy link
Copy Markdown
Member Author

Test with all configfs/sysfs/ioctl scenarios.

@mythi

mythi commented May 17, 2026

Copy link
Copy Markdown
Contributor

There are no kernels with ioctl RTMR extend so I don't think we need to add that here. RTMR extend is only available via sysfs. Upstream kernels have only report0 ioctl (no get quote nor rtmr extend).

@Xynnn007

Copy link
Copy Markdown
Member Author

There are no kernels with ioctl RTMR extend so I don't think we need to add that here. RTMR extend is only available via sysfs. Upstream kernels have only report0 ioctl (no get quote nor rtmr extend).

We alibaba cloud kernel is using a version with ioctl RTMR, which might be an out-of-tree code. This is what the DCAP lib is doing such and with this PR we can get rid of DCAP but still, keep the functionality work.

I am not sure how other CSPs support the RTMR extending if they does not have 6.16 sysfs patch. Let me make a comment upon the codes to show that this is for out-of-tree code and TODO is to use sysfs when all projects are ready.

Xynnn007 added 2 commits May 17, 2026 15:47
Now with new version of guest kernel it's practical to use TSM to do
quote generation and use sysfs to do initdata reading/rtmr
read-writing.

This patch deprecates legacy libtdx related features to get quotes.
Also, natively use ioctl to get reports for initdata/rtmr reading on
kernel version < 6.16 and use sysfs to do initdata reading/rtmr
read-writing on kernel version >= 6.16.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
The tests are ignored because they require to be run inside a TDX guest.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
@Xynnn007 Xynnn007 force-pushed the attester/tdx-remove-ioctl branch from dccb63e to fe9e11c Compare May 17, 2026 07:47
@mythi

mythi commented May 18, 2026

Copy link
Copy Markdown
Contributor

There are no kernels with ioctl RTMR extend so I don't think we need to add that here. RTMR extend is only available via sysfs. Upstream kernels have only report0 ioctl (no get quote nor rtmr extend).

We alibaba cloud kernel is using a version with ioctl RTMR, which might be an out-of-tree code. This is what the DCAP lib is doing such and with this PR we can get rid of DCAP but still, keep the functionality work.

are you saying you moved to configfs-tsm reports for Qutoes but kept ioctl RTMR?

@Xynnn007

Copy link
Copy Markdown
Member Author

There are no kernels with ioctl RTMR extend so I don't think we need to add that here. RTMR extend is only available via sysfs. Upstream kernels have only report0 ioctl (no get quote nor rtmr extend).

We alibaba cloud kernel is using a version with ioctl RTMR, which might be an out-of-tree code. This is what the DCAP lib is doing such and with this PR we can get rid of DCAP but still, keep the functionality work.

are you saying you moved to configfs-tsm reports for Qutoes but kept ioctl RTMR?

Yes. configfs for quotes; ioctl/sysfs for RTMR

@mythi

mythi commented May 18, 2026

Copy link
Copy Markdown
Contributor

; ioctl/sysfs for RTMR

If both are available, we can drop ioctl RTMR extend. I'm not OK to support out-of-tree functionality unconditionally and/or enabled by default.

@Xynnn007

Copy link
Copy Markdown
Member Author

@mythi Ok. Another choice is to have a feature flag to cover the ioctl code and have an explicit roadmap that delete them once main CSPs/distros to support sysfs. But this seems the same as we keep DCAP here also.

So, this work can be pending as now the upstream kernel 6.16 is not widely used and we can wait for main CSPs/distros to support sysfs. At the same time, the DCAP dep can be fully removed. Before that, as the runtime measurement is still under use, DCAP is still required (if we do not allow ioctl MVP codes to get into this repo).

@Xynnn007 Xynnn007 marked this pull request as draft May 19, 2026 11:04
@mythi

mythi commented May 19, 2026

Copy link
Copy Markdown
Contributor

One optimization we could do already today is to try to get mrconfigid for initdata via sysfs if it's avaiable and only to report0 ioctl as the fallback (similar to how get quote works but so that the fallback is unconditionally enabled).

@Xynnn007

Copy link
Copy Markdown
Member Author

One optimization we could do already today is to try to get mrconfigid for initdata via sysfs if it's avaiable and only to report0 ioctl as the fallback (similar to how get quote works but so that the fallback is unconditionally enabled).

Let me implement it in another PR.

@mythi

mythi commented May 20, 2026

Copy link
Copy Markdown
Contributor

One optimization we could do already today is to try to get mrconfigid for initdata via sysfs if it's avaiable and only to report0 ioctl as the fallback (similar to how get quote works but so that the fallback is unconditionally enabled).

Let me implement it in another PR.

OK. This PR can be closed?

@Xynnn007

Xynnn007 commented May 20, 2026

Copy link
Copy Markdown
Member Author

One optimization we could do already today is to try to get mrconfigid for initdata via sysfs if it's avaiable and only to report0 ioctl as the fallback (similar to how get quote works but so that the fallback is unconditionally enabled).

Let me implement it in another PR.

OK. This PR can be closed?

Let's keep it a draft and then we can track the thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants