Skip to contentSkip to conversation

golang: Binding fixes

PATCH In review Jason Andryuk 7 participants 16 messages Nov 3, 2023 – Nov 6, 2023

lore
Share & tools
lore
#0 lore raw

cover golang: Binding fixes

These two patches refresh the bindings which have gone a little stale. I used two separate patches since the XSA-443 one may want backporting.

Jason Andryuk (2):
golang: Fixup binding for Arm FF-A
golang: Fix bindings after XSA-443

 tools/golang/xenlight/helpers.gen.go | 9 +++++++++
 tools/golang/xenlight/types.gen.go   | 3 +++
 2 files changed, 12 insertions(+)
Signature · 1 line
2.41.0
#4 lore raw

PATCH 2/2 golang: Fix bindings after XSA-443

The new bootloader_restrict and bootloader_user fields in the libxl idl change the bindings. Update them.

Fixes 1f762642d2ca ("libxl: add support for running bootloader in restricted mode")
---
 tools/golang/xenlight/helpers.gen.go | 9 +++++++++
 tools/golang/xenlight/types.gen.go   | 2 ++
 2 files changed, 11 insertions(+)
tools/golang/xenlight/helpers.gen.go +9 -0
index 3ecffdf0ef..35e209ff1b 100644
@@ -1112,6 +1112,10 @@ x.Bootloader = C.GoString(xc.bootloader)
 if err := x.BootloaderArgs.fromC(&xc.bootloader_args);err != nil {
 return fmt.Errorf("converting field BootloaderArgs: %v", err)
 }
+if err := x.BootloaderRestrict.fromC(&xc.bootloader_restrict);err != nil {
+return fmt.Errorf("converting field BootloaderRestrict: %v", err)
+}
+x.BootloaderUser = C.GoString(xc.bootloader_user)
 x.TimerMode = TimerMode(xc.timer_mode)
 if err := x.NestedHvm.fromC(&xc.nested_hvm);err != nil {
 return fmt.Errorf("converting field NestedHvm: %v", err)
@@ -1465,6 +1469,11 @@ xc.bootloader = C.CString(x.Bootloader)}
 if err := x.BootloaderArgs.toC(&xc.bootloader_args); err != nil {
 return fmt.Errorf("converting field BootloaderArgs: %v", err)
 }
+if err := x.BootloaderRestrict.toC(&xc.bootloader_restrict); err != nil {
+return fmt.Errorf("converting field BootloaderRestrict: %v", err)
+}
+if x.BootloaderUser != "" {
+xc.bootloader_user = C.CString(x.BootloaderUser)}
 xc.timer_mode = C.libxl_timer_mode(x.TimerMode)
 if err := x.NestedHvm.toC(&xc.nested_hvm); err != nil {
 return fmt.Errorf("converting field NestedHvm: %v", err)
tools/golang/xenlight/types.gen.go +2 -0
index 6a9ebb3fec..7907aa8999 100644
@@ -577,6 +577,8 @@ DeviceTree string
 Acpi Defbool
 Bootloader string
 BootloaderArgs StringList
+BootloaderRestrict Defbool
+BootloaderUser string
 TimerMode TimerMode
 NestedHvm Defbool
 Apic Defbool
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/2 golang: Fixup binding for Arm FF-A

In reply to Jason Andryuk

The new FF-A TEE type changed the go bindings. Update them.

Fixes 8abdd8d52862 ("tools: add Arm FF-A mediator")
---
 tools/golang/xenlight/types.gen.go | 1 +
 1 file changed, 1 insertion(+)
tools/golang/xenlight/types.gen.go +1 -0
index 4f40aac28c..6a9ebb3fec 100644
@@ -488,6 +488,7 @@ type TeeType int
 const(
 TeeTypeNone TeeType = 0
 TeeTypeOptee TeeType = 1
+TeeTypeFfa TeeType = 2
 )
 
 type SveType int
Signature · 1 line
2.41.0
#9 lore raw
In reply to Jason Andryuk
Quoted 6 lines · Jason Andryuk

These two patches refresh the bindings which have gone a little stale. I used two separate patches since the XSA-443 one may want backporting.

Jason Andryuk (2):
golang: Fixup binding for Arm FF-A
golang: Fix bindings after XSA-443

Bah - the security team did mess up there.

Also, we very clearly need the Golang bindings to be a blocking build test in GitlabCI to avoid repeats of this in the future.

I'm tempted to the Gitlab change ought to be for-4.18 too.  Henry, thoughts?

~Andrew

#2 lore raw

Re: [PATCH for-4.18 1/2] golang: Fixup binding for Arm FF-A

In reply to Jason Andryuk

Hi Jason,

Quoted 6 lines · Jason Andryuk

The new FF-A TEE type changed the go bindings. Update them.

Fixes 8abdd8d52862 ("tools: add Arm FF-A mediator")

Kind regards,
Henry

Quoted 19 lines

---
tools/golang/xenlight/types.gen.go | 1 +

1 file changed, 1 insertion(+)
tools/golang/xenlight/types.gen.go +0 -0
index 4f40aac28c..6a9ebb3fec 100644
@@ -488,6 +488,7 @@ type TeeType int

const(
TeeTypeNone TeeType = 0
TeeTypeOptee TeeType = 1
+TeeTypeFfa TeeType = 2
)

type SveType int

Signature · 1 line
2.41.0
#5 lore raw

Re: [PATCH for-4.18 2/2] golang: Fix bindings after XSA-443

In reply to Jason Andryuk

Hi Jason,

Quoted 7 lines · Jason Andryuk

The new bootloader_restrict and bootloader_user fields in the libxl idl change the bindings. Update them.

Fixes 1f762642d2ca ("libxl: add support for running bootloader in restricted mode")

Kind regards,
Henry

Quoted 48 lines

---
tools/golang/xenlight/helpers.gen.go | 9 +++++++++
tools/golang/xenlight/types.gen.go | 2 ++

2 files changed, 11 insertions(+)
tools/golang/xenlight/helpers.gen.go +9 -0
index 3ecffdf0ef..35e209ff1b 100644
@@ -1112,6 +1112,10 @@ x.Bootloader = C.GoString(xc.bootloader)
 if err := x.BootloaderArgs.fromC(&xc.bootloader_args);err != nil {
 return fmt.Errorf("converting field BootloaderArgs: %v", err)
 }
+if err := x.BootloaderRestrict.fromC(&xc.bootloader_restrict);err != nil {
+return fmt.Errorf("converting field BootloaderRestrict: %v", err)
+}
+x.BootloaderUser = C.GoString(xc.bootloader_user)
 x.TimerMode = TimerMode(xc.timer_mode)
 if err := x.NestedHvm.fromC(&xc.nested_hvm);err != nil {
 return fmt.Errorf("converting field NestedHvm: %v", err)
@@ -1465,6 +1469,11 @@ xc.bootloader = C.CString(x.Bootloader)}
 if err := x.BootloaderArgs.toC(&xc.bootloader_args); err != nil {
 return fmt.Errorf("converting field BootloaderArgs: %v", err)
 }
+if err := x.BootloaderRestrict.toC(&xc.bootloader_restrict); err != nil {
+return fmt.Errorf("converting field BootloaderRestrict: %v", err)
+}
+if x.BootloaderUser != "" {
+xc.bootloader_user = C.CString(x.BootloaderUser)}
 xc.timer_mode = C.libxl_timer_mode(x.TimerMode)
 if err := x.NestedHvm.toC(&xc.nested_hvm); err != nil {
 return fmt.Errorf("converting field NestedHvm: %v", err)
tools/golang/xenlight/types.gen.go +0 -0
index 6a9ebb3fec..7907aa8999 100644
@@ -577,6 +577,8 @@ DeviceTree string

Acpi Defbool
Bootloader string
BootloaderArgs StringList

tools/golang/xenlight/types.gen.go +2 -0
+BootloaderRestrict Defbool
+BootloaderUser string

TimerMode TimerMode
NestedHvm Defbool
Apic Defbool

Signature · 1 line
2.41.0
#10 lore raw
In reply to Andrew Cooper

Hi Andrew,

Quoted 3 lines · Andrew Cooper

[[email protected] appears similar to someone who previously sent you email, but may not be that person. Learn why this could be a risk at https://aka.ms/LearnAboutSenderIdentification ]

(+Your work email address since this reply somehow ended up with my filter, I found this email a bit later, sorry for the late reply.)

Quoted 9 lines · Jason Andryuk
Quoted 6 lines

These two patches refresh the bindings which have gone a little stale. I used two separate patches since the XSA-443 one may want backporting.

Jason Andryuk (2):
golang: Fixup binding for Arm FF-A
golang: Fix bindings after XSA-443

Quoted 6 lines

Bah - the security team did mess up there.

Also, we very clearly need the Golang bindings to be a blocking build test in GitlabCI to avoid repeats of this in the future.

I'm tempted to the Gitlab change ought to be for-4.18 too. Henry, thoughts?

As long as the GitLab CI change can be submitted within the 4.18 release timeline, I won’t object it. Thanks.

Kind regards,
Henry

Quoted 2 lines

~Andrew

#12 lore raw
In reply to Jason Andryuk
Quoted 3 lines · Jason Andryuk

These two patches refresh the bindings which have gone a little stale. I used two separate patches since the XSA-443 one may want backporting.

Thanks for these. Out of curiosity, do you use the golang bindings, and if so, are you happy with how you're consuming them now? We had talked at some point about exposing the bindings somewhere on xenbits (or maybe gitlab) such that people should simply add the path to their golang projects and have it download & build like "normal". Is that something you'd find useful?

Peace,
-George

#7 lore raw

Re: [PATCH for-4.18 2/2] golang: Fix bindings after XSA-443

In reply to George Dunlap
Quoted 10 lines · George Dunlap
Quoted 6 lines · Jason Andryuk

The new bootloader_restrict and bootloader_user fields in the libxl idl change the bindings. Update them.

Fixes 1f762642d2ca ("libxl: add support for running bootloader in restricted mode")

Also, as Jason pointed out in the cover letter, we probably want to backport this patch; I'm not sure exactly who's in charge of that for tools.

-George

#8 lore raw

Re: [PATCH for-4.18 2/2] golang: Fix bindings after XSA-443

Quoted 7 lines · George Dunlap
Quoted 6 lines · George Dunlap
Quoted 4 lines · Jason Andryuk

The new bootloader_restrict and bootloader_user fields in the libxl idl change the bindings. Update them.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Fixes 1f762642d2ca ("libxl: add support for running bootloader in restricted mode")

Also, as Jason pointed out in the cover letter, we probably want to backport this patch; I'm not sure exactly who's in charge of that for tools.

I'll try to remember to pick this up once it has been committed.

Jan

#14 lore raw
In reply to Jason Andryuk
Quoted 2 lines · Jason Andryuk

These two patches refresh the bindings which have gone a little stale. I used two separate patches since the XSA-443 one may want backporting.

The XSA-443 one is only relevant for unstable and 4.18. Stable branches at the time of the XSA didn't get those fields added as it would break the API.

Regards, Roger.

#13 lore raw
In reply to George Dunlap
Quoted 6 lines · George Dunlap
Quoted 3 lines · Jason Andryuk

These two patches refresh the bindings which have gone a little stale. I used two separate patches since the XSA-443 one may want backporting.

Quoted 6 lines

Thanks for these. Out of curiosity, do you use the golang bindings, and if so, are you happy with how you're consuming them now? We had talked at some point about exposing the bindings somewhere on xenbits (or maybe gitlab) such that people should simply add the path to their golang projects and have it download & build like "normal". Is that something you'd find useful?

Hi George,

No, I do not use the bindings, so I cannot answer your questions. I just noticed the bindings were stale when doing a rebase.

I think Andrew's idea to check these via gitlab is a good one. They seem to often be missed. I only noticed because I had installed go, and I only installed go to check binding generation for a previous patch series.

Since the bindings are auto generated, do they really need to be checked into the tree? If gitlab checks their generation, then maybe they don't need to be checked in?

Regards,
Jason

#15 lore raw
In reply to Roger Pau Monné
Quoted 8 lines · Roger Pau Monné
Quoted 2 lines · Jason Andryuk

These two patches refresh the bindings which have gone a little stale. I used two separate patches since the XSA-443 one may want backporting.

The XSA-443 one is only relevant for unstable and 4.18. Stable branches at the time of the XSA didn't get those fields added as it would break the API.

Oh, good. Thanks for confirming, Roger.

Regards,
Jason

#11 lore raw
In reply to Henry Wang
Quoted 7 lines · Henry Wang

Hi Andrew,

Quoted 3 lines · Andrew Cooper

[[email protected] appears similar to someone who previously sent you email, but may not be that person. Learn why this could be a risk at https://aka.ms/LearnAboutSenderIdentification ]

(+Your work email address since this reply somehow ended up with my filter, I found this email a bit later, sorry for the late reply.)

sigh.

It seems a Thunderbird update has clobbered my configuration, and for reasons of the corporate merger, @tibco is still our probably accounts.

I'll see about fixing up.

~Andrew