Re: [PATCH v3 3/4 qemu] Exclude TPM ioctls definitions for the GNU/Hurd

2026-02-10 Thread Samuel Thibault
Hello,

Stefan Berger, le mar. 10 févr. 2026 12:58:24 -0500, a ecrit:
> On 2/7/26 11:03 PM, Damien Zammit wrote:
> > On 2/4/26 2:21 AM, Stefan Berger wrote:
> > > enum {
> > >PTM_GET_CAPABILITY = _IOR('P', 0, ptm_cap),
> > >PTM_INIT   = _IOWR('P', 1, ptm_init),
> > >PTM_SHUTDOWN   = _IOR('P', 2, ptm_res),
> > 
> > No, this wont work because the _IOT__IOTBASE_* symbols are missing for
> > the tpm structs on GNU platform:
> 
> > 
> > In file included from /usr/include/x86_64-gnu/sys/ioctl.h:26,
> >    from ../backends/tpm/tpm_ioctl.h:17,
> >    from ../backends/tpm/tpm_emulator.c:39:
> > ../backends/tpm/tpm_ioctl.h:290:30: error: ‘_IOT__IOTBASE_ptm_cap’
> > undeclared here (not in a function)
> >     290 | PTM_GET_CAPABILITY = _IOR('P', 0, ptm_cap),
> >     |  ^~~~
> 
> I have it compile because I added this here (above):
> 
> #ifdef __gnu_hurd__
> #include 
> #endif

This mach-ish ioccom.h is not the way ioctls are defined in the Hurd. I
have actually even dropped it from gnumach, since we don't actually use
this way of defining ioctls any more. _IOT macros for ptm_capt/init/res
really need to be defined for _IOR/WR to be usable.

Samuel



Re: [PATCH v3 3/4 qemu] Exclude TPM ioctls definitions for the GNU/Hurd

2026-02-10 Thread Stefan Berger




On 2/7/26 11:03 PM, Damien Zammit wrote:

Hi Stefan,

On 2/4/26 2:21 AM, Stefan Berger wrote:

So this file comes originally from swtpm here:
https://github.com/stefanberger/swtpm/blob/master/include/swtpm/tpm_ioctl.h

To keep them in sync as much as possible -- would this here work?

#ifndef _WIN32
#include 
#include 
#endif

#ifdef HAVE_SYS_IOCCOM_H
#include 
#endif

#ifdef __gnu_hurd__
#include 
#endif

and then keep this as-is?

#if !defined(_WIN32)
enum {
   PTM_GET_CAPABILITY = _IOR('P', 0, ptm_cap),
   PTM_INIT   = _IOWR('P', 1, ptm_init),
   PTM_SHUTDOWN   = _IOR('P', 2, ptm_res),


No, this wont work because the _IOT__IOTBASE_* symbols are missing for
the tpm structs on GNU platform:




In file included from /usr/include/x86_64-gnu/sys/ioctl.h:26,
   from ../backends/tpm/tpm_ioctl.h:17,
   from ../backends/tpm/tpm_emulator.c:39:
../backends/tpm/tpm_ioctl.h:290:30: error: ‘_IOT__IOTBASE_ptm_cap’
undeclared here (not in a function)
    290 | PTM_GET_CAPABILITY = _IOR('P', 0, ptm_cap),
    |  ^~~~


I have it compile because I added this here (above):

#ifdef __gnu_hurd__
#include 
#endif

Without this header I do see these errors as well. Either way, am fine 
with your suggestion in v5.


 Stefan





Re: [PATCH v3 3/4 qemu] Exclude TPM ioctls definitions for the GNU/Hurd

2026-02-07 Thread Damien Zammit
Hi Stefan,

On 2/4/26 2:21 AM, Stefan Berger wrote:
> So this file comes originally from swtpm here:
> https://github.com/stefanberger/swtpm/blob/master/include/swtpm/tpm_ioctl.h
>
> To keep them in sync as much as possible -- would this here work?
>
> #ifndef _WIN32
> #include 
> #include 
> #endif
>
> #ifdef HAVE_SYS_IOCCOM_H
> #include 
> #endif
>
> #ifdef __gnu_hurd__
> #include 
> #endif
>
> and then keep this as-is?
>
> #if !defined(_WIN32)
> enum {
>   PTM_GET_CAPABILITY = _IOR('P', 0, ptm_cap),
>   PTM_INIT   = _IOWR('P', 1, ptm_init),
>   PTM_SHUTDOWN   = _IOR('P', 2, ptm_res),

No, this wont work because the _IOT__IOTBASE_* symbols are missing for 
the tpm structs on GNU platform:

In file included from /usr/include/x86_64-gnu/sys/ioctl.h:26,
  from ../backends/tpm/tpm_ioctl.h:17,
  from ../backends/tpm/tpm_emulator.c:39:
../backends/tpm/tpm_ioctl.h:290:30: error: ‘_IOT__IOTBASE_ptm_cap’ 
undeclared here (not in a function)
   290 | PTM_GET_CAPABILITY = _IOR('P', 0, ptm_cap),
   |  ^~~~
../backends/tpm/tpm_ioctl.h:291:30: error: ‘_IOT__IOTBASE_ptm_init’ 
undeclared here (not in a function)
   291 | PTM_INIT   = _IOWR('P', 1, ptm_init),
   |  ^
../backends/tpm/tpm_ioctl.h:292:30: error: ‘_IOT__IOTBASE_ptm_res’ 
undeclared here (not in a function)
   292 | PTM_SHUTDOWN   = _IOR('P', 2, ptm_res),
   |  ^~~~
../backends/tpm/tpm_ioctl.h:293:30: error: ‘_IOT__IOTBASE_ptm_est’ 
undeclared here (not in a function)
   293 | PTM_GET_TPMESTABLISHED = _IOR('P', 3, ptm_est),
   |  ^~~~
../backends/tpm/tpm_ioctl.h:294:30: error: ‘_IOT__IOTBASE_ptm_loc’ 
undeclared here (not in a function)
   294 | PTM_SET_LOCALITY   = _IOWR('P', 4, ptm_loc),
   |  ^
../backends/tpm/tpm_ioctl.h:296:30: error: ‘_IOT__IOTBASE_ptm_hdata’ 
undeclared here (not in a function)
   296 | PTM_HASH_DATA  = _IOWR('P', 6, ptm_hdata),
   |  ^
../backends/tpm/tpm_ioctl.h:300:32: error: ‘_IOT__IOTBASE_ptm_reset_est’ 
undeclared here (not in a function)
   300 | PTM_RESET_TPMESTABLISHED = _IOWR('P', 10, ptm_reset_est),
   |    ^
../backends/tpm/tpm_ioctl.h:301:30: error: ‘_IOT__IOTBASE_ptm_getstate’ 
undeclared here (not in a function)
   301 | PTM_GET_STATEBLOB  = _IOWR('P', 11, ptm_getstate),
   |  ^
../backends/tpm/tpm_ioctl.h:302:30: error: ‘_IOT__IOTBASE_ptm_setstate’ 
undeclared here (not in a function)
   302 | PTM_SET_STATEBLOB  = _IOWR('P', 12, ptm_setstate),
   |  ^
../backends/tpm/tpm_ioctl.h:304:30: error: ‘_IOT__IOTBASE_ptm_getconfig’ 
undeclared here (not in a function)
   304 | PTM_GET_CONFIG = _IOR('P', 14, ptm_getconfig),
   |  ^~~~
../backends/tpm/tpm_ioctl.h:306:30: error: 
‘_IOT__IOTBASE_ptm_setbuffersize’ undeclared here (not in a function)
   306 | PTM_SET_BUFFERSIZE = _IOWR('P', 16, ptm_setbuffersize),
   |  ^
../backends/tpm/tpm_ioctl.h:307:30: error: ‘_IOT__IOTBASE_ptm_getinfo’ 
undeclared here (not in a function)
   307 | PTM_GET_INFO   = _IOWR('P', 17, ptm_getinfo),
   |  ^
../backends/tpm/tpm_ioctl.h:308:30: error: 
‘_IOT__IOTBASE_ptm_lockstorage’ undeclared here (not in a function)
   308 | PTM_LOCK_STORAGE   = _IOWR('P', 18, ptm_lockstorage),

If you want to preserve the enum, I am happy to put an ifdef instead of 
removing it.

That would be exactly what we had in v3 3/4.

Damien





Re: [PATCH v3 3/4 qemu] Exclude TPM ioctls definitions for the GNU/Hurd

2026-02-03 Thread Stefan Berger




On 1/30/26 3:27 AM, Paolo Bonzini wrote:

On 1/30/26 04:20, Damien Zammit wrote:

From: Manolo de Medici 

The Hurd currently doesn't have any TPM driver, compilation fails
for missing symbols unless these are left undefined.


This is due to the missing _IO* symbols, not the TPM driver.

Fortunately, these are unused and the whole enum can be removed.  Please 
check if it's also possible to remove


#ifndef _WIN32
#include 
#include 
#endif

#ifdef HAVE_SYS_IOCCOM_H
#include 
#endif


So this file comes originally from swtpm here: 
https://github.com/stefanberger/swtpm/blob/master/include/swtpm/tpm_ioctl.h


To keep them in sync as much as possible -- would this here work?

#ifndef _WIN32
#include 
#include 
#endif

#ifdef HAVE_SYS_IOCCOM_H
#include 
#endif

#ifdef __gnu_hurd__
#include 
#endif

and then keep this as-is?

#if !defined(_WIN32)
enum {
PTM_GET_CAPABILITY = _IOR('P', 0, ptm_cap),
PTM_INIT   = _IOWR('P', 1, ptm_init),
PTM_SHUTDOWN   = _IOR('P', 2, ptm_res),





at the top of the file.

Paolo


Signed-off-by: Manolo de Medici 
Reviewed-by: Stefan Berger 
---
  backends/tpm/tpm_ioctl.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
index ee2dd15d35..e466311455 100644
--- a/backends/tpm/tpm_ioctl.h
+++ b/backends/tpm/tpm_ioctl.h
@@ -285,7 +285,7 @@ typedef struct ptm_lockstorage ptm_lockstorage;
  #define PTM_CAP_SEND_COMMAND_HEADER (1 << 15)
  #define PTM_CAP_LOCK_STORAGE   (1 << 16)
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__GNU__)
  enum {
  PTM_GET_CAPABILITY = _IOR('P', 0, ptm_cap),
  PTM_INIT   = _IOWR('P', 1, ptm_init),








Re: [PATCH v3 3/4 qemu] Exclude TPM ioctls definitions for the GNU/Hurd

2026-01-30 Thread Paolo Bonzini

On 1/30/26 04:20, Damien Zammit wrote:

From: Manolo de Medici 

The Hurd currently doesn't have any TPM driver, compilation fails
for missing symbols unless these are left undefined.


This is due to the missing _IO* symbols, not the TPM driver.

Fortunately, these are unused and the whole enum can be removed.  Please 
check if it's also possible to remove


#ifndef _WIN32
#include 
#include 
#endif

#ifdef HAVE_SYS_IOCCOM_H
#include 
#endif

at the top of the file.

Paolo


Signed-off-by: Manolo de Medici 
Reviewed-by: Stefan Berger 
---
  backends/tpm/tpm_ioctl.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
index ee2dd15d35..e466311455 100644
--- a/backends/tpm/tpm_ioctl.h
+++ b/backends/tpm/tpm_ioctl.h
@@ -285,7 +285,7 @@ typedef struct ptm_lockstorage ptm_lockstorage;
  #define PTM_CAP_SEND_COMMAND_HEADER (1 << 15)
  #define PTM_CAP_LOCK_STORAGE   (1 << 16)
  
-#ifndef _WIN32

+#if !defined(_WIN32) && !defined(__GNU__)
  enum {
  PTM_GET_CAPABILITY = _IOR('P', 0, ptm_cap),
  PTM_INIT   = _IOWR('P', 1, ptm_init),