Skip to contentSkip to conversation

tracing: do not export user_events uapi

PATCH In review Mathieu Desnoyers 4 participants 9 messages Mar 30, 2022 – Mar 31, 2022

Subsystems (5)
lore
Share & tools
lore

Mathieu Desnoyers

author reviewer
#0 lore raw

PATCH 1/1 tracing: do not export user_events uapi

In addition to mark the USER_EVENTS feature BROKEN until all interested parties figure out the user-space API, do not install the uapi header.

This prevents situations where a non-final uapi header would end up being installed into a distribution image and used to build user-space programs that would then run against newer kernels that will implement user events with a different ABI.

---
 include/uapi/Kbuild | 3 +++
 1 file changed, 3 insertions(+)
include/uapi/Kbuild +3 -0
index 61ee6e59c930..425ea8769ddc 100644
@@ -12,3 +12,6 @@ ifeq ($(wildcard $(objtree)/arch/$(SRCARCH)/include/generated/uapi/asm/kvm_para.
 no-export-headers += linux/kvm_para.h
 endif
 endif
+
+# API is not finalized
+no-export-headers += linux/user_events.h
Signature · 1 line
2.20.1
maintainer
#1 lore raw

Adding the build maintainers.

-- Steve

Quoted 26 lines · On Wed, 30 Mar 2022 16:17:55 -0400 Mathieu Desnoyers…

In addition to mark the USER_EVENTS feature BROKEN until all interested parties figure out the user-space API, do not install the uapi header.

This prevents situations where a non-final uapi header would end up being installed into a distribution image and used to build user-space programs that would then run against newer kernels that will implement user events with a different ABI.

---
 include/uapi/Kbuild | 3 +++
 1 file changed, 3 insertions(+)
include/uapi/Kbuild +3 -0
index 61ee6e59c930..425ea8769ddc 100644
@@ -12,3 +12,6 @@ ifeq ($(wildcard $(objtree)/arch/$(SRCARCH)/include/generated/uapi/asm/kvm_para.
 no-export-headers += linux/kvm_para.h
 endif
 endif
+
+# API is not finalized
+no-export-headers += linux/user_events.h
#2 lore raw
Quoted 24 lines · Steven Rostedt

Adding the build maintainers.

-- Steve

Quoted 15 lines · On Wed, 30 Mar 2022 16:17:55 -0400 Mathieu Desnoyers…

In addition to mark the USER_EVENTS feature BROKEN until all interested parties figure out the user-space API, do not install the uapi header.

This prevents situations where a non-final uapi header would end up being installed into a distribution image and used to build user-space programs that would then run against newer kernels that will implement user events with a different ABI.

---
 include/uapi/Kbuild | 3 +++
 1 file changed, 3 insertions(+)
Quoted 12 lines

include/uapi/Kbuild ifeq ($(wildcard $(objtree)/arch/$(SRCARCH)/include/generated/uapi/asm/kvm_para. · line 17

Quoted 11 lines
include/uapi/Kbuild +3 -0
index 61ee6e59c930..425ea8769ddc 100644
@@ -12,3 +12,6 @@ ifeq ($(wildcard $(objtree)/arch/$(SRCARCH)/include/generated/uapi/asm/kvm_para.
 no-export-headers += linux/kvm_para.h
 endif
 endif
+
+# API is not finalized
+no-export-headers += linux/user_events.h

Well, the intended usage of no-export-headers is to cater to the UAPI supported by only some architectures. We have kvm(_para).h here because not all architectures support kvm.

If you do not want to export the UAPI,
you should not put it in include/uapi/.

After the API is finalized, you can move it to include/uapi.

Signature · 2 lines
Best Regards
Masahiro Yamada
maintainer
#3 lore raw
Quoted 10 lines · On Thu, 31 Mar 2022 16:29:30 +0900 Masahiro Yamada <[email protected]> wrote:

Well, the intended usage of no-export-headers is to cater to the UAPI supported by only some architectures. We have kvm(_para).h here because not all architectures support kvm.

If you do not want to export the UAPI,
you should not put it in include/uapi/.

After the API is finalized, you can move it to include/uapi.

So a little bit of background. I and a few others thought it was done, and pushed it to Linus. Then when it made it into his tree (and mentioned on LWN) it got a wider audience that had concerns. After they brought up those concerns, we agreed that this needs a bit more work. I was hoping not to do a full revert and simply marked the change for broken so that it can be worked on upstream with the wider audience. Linus appears to be fine with this approach, as he helped me with my "mark for BROKEN" patch.

Mathieu's concern is that this header file could be used in older distros with newer kernels that have it implemented and added this to keep out of those older distros.

The options to make Mathieu sleep better at night are:

1) this patch

2) move this file out of uapi.

3) revert the entire thing.

I really do not want to do #3 but I am willing to do 1 or 2.

-- Steve

#4 lore raw
Quoted 29 lines · Steven Rostedt
Quoted 10 lines · On Thu, 31 Mar 2022 16:29:30 +0900 Masahiro Yamada <[email protected]> wrote:

Well, the intended usage of no-export-headers is to cater to the UAPI supported by only some architectures. We have kvm(_para).h here because not all architectures support kvm.

If you do not want to export the UAPI,
you should not put it in include/uapi/.

After the API is finalized, you can move it to include/uapi.

So a little bit of background. I and a few others thought it was done, and pushed it to Linus. Then when it made it into his tree (and mentioned on LWN) it got a wider audience that had concerns. After they brought up those concerns, we agreed that this needs a bit more work. I was hoping not to do a full revert and simply marked the change for broken so that it can be worked on upstream with the wider audience. Linus appears to be fine with this approach, as he helped me with my "mark for BROKEN" patch.

Mathieu's concern is that this header file could be used in older distros with newer kernels that have it implemented and added this to keep out of those older distros.

The options to make Mathieu sleep better at night are:

Quoted 7 lines

1) this patch

2) move this file out of uapi.

3) revert the entire thing.

I really do not want to do #3 but I am willing to do 1 or 2.

I see.

Either 1 or 2 is OK
if you are sure this will be fixed sooner or later.

Signature · 2 lines
Best Regards
Masahiro Yamada
maintainer
#5 lore raw
Quoted 2 lines · On Thu, 31 Mar 2022 23:41:34 +0900 Masahiro Yamada <[email protected]> wrote:

Either 1 or 2 is OK
if you are sure this will be fixed sooner or later.

Thanks,

Then I'll go and pull in Mathieu's patch.

I want this done too, and I believe Beau has a vested interest to get this correctly done as well, thus it should be worked on and hopefully we will have something solid by the next merge window.

-- Steve

author reviewer
#6 lore raw
In reply to Steven Rostedt
Quoted 26 lines · ----- On Mar 31, 2022, at 8:13 AM, rostedt [email protected] wrote:
Quoted 10 lines · On Thu, 31 Mar 2022 16:29:30 +0900 Masahiro Yamada <[email protected]> wrote:

Well, the intended usage of no-export-headers is to cater to the UAPI supported by only some architectures. We have kvm(_para).h here because not all architectures support kvm.

If you do not want to export the UAPI,
you should not put it in include/uapi/.

After the API is finalized, you can move it to include/uapi.

So a little bit of background. I and a few others thought it was done, and pushed it to Linus. Then when it made it into his tree (and mentioned on LWN) it got a wider audience that had concerns. After they brought up those concerns, we agreed that this needs a bit more work. I was hoping not to do a full revert and simply marked the change for broken so that it can be worked on upstream with the wider audience. Linus appears to be fine with this approach, as he helped me with my "mark for BROKEN" patch.

Mathieu's concern is that this header file could be used in older distros with newer kernels that have it implemented and added this to keep out of those older distros.

Quoted 5 lines

The options to make Mathieu sleep better at night are:

1) this patch

2) move this file out of uapi.

I would be fine with this approach as well. This is simple enough:

git mv include/uapi/linux/user_events.h include/linux/

and:

kernel/trace/trace_events_user.c +1 -1
index 8b3d241a31c2..823d7b09dcba 100644
@@ -18,7 +18,7 @@
 #include <linux/tracefs.h>
 #include <linux/types.h>
 #include <linux/uaccess.h>
-#include <uapi/linux/user_events.h>
+#include <linux/user_events.h>
 #include "trace.h"
 #include "trace_dynevent.h"
 

Including <linux/user_events.h> will continue to work even when the header is moved to uapi in the future.

Thanks,

Mathieu

Quoted 6 lines

3) revert the entire thing.

I really do not want to do #3 but I am willing to do 1 or 2.

-- Steve

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
maintainer
#7 lore raw
Quoted 13 lines · On Thu, 31 Mar 2022 12:07:28 -0400 (EDT) Mathieu Desnoyers…
kernel/trace/trace_events_user.c +1 -1
index 8b3d241a31c2..823d7b09dcba 100644
@@ -18,7 +18,7 @@
 #include <linux/tracefs.h>
 #include <linux/types.h>
 #include <linux/uaccess.h>
-#include <uapi/linux/user_events.h>
+#include <linux/user_events.h>
 #include "trace.h"
 #include "trace_dynevent.h"
 
Quoted 2 lines

Including <linux/user_events.h> will continue to work even when the header is moved to uapi in the future.

Actually, when I thought of this, I was thinking more of:

kernel/trace/trace_events_user.c +4 -0
index 846c27bc7aef..0f3aa855cf72 100644
@@ -18,7 +18,11 @@
 #include <linux/tracefs.h>
 #include <linux/types.h>
 #include <linux/uaccess.h>
+#ifdef CONFIG_COMPILE_TEST
+#include <linux/user_events.h>
+#else
 #include <uapi/linux/user_events.h>
+#endif
 #include "trace.h"
 #include "trace_dynevent.h"
 

That way, when we take it out of broken state, it will fail to compile, and remind us to put it back into the uapi directory.

-- Steve

maintainer Reviewed-by on v1 1/1
#8 lore raw
In reply to Mathieu Desnoyers
Quoted 10 lines · On Wed, 30 Mar 2022 16:17:55 -0400 Mathieu Desnoyers…

In addition to mark the USER_EVENTS feature BROKEN until all interested parties figure out the user-space API, do not install the uapi header.

This prevents situations where a non-final uapi header would end up being installed into a distribution image and used to build user-space programs that would then run against newer kernels that will implement user events with a different ABI.

Looks good to me.

Thank you,

Quoted 19 lines
---
 include/uapi/Kbuild | 3 +++
 1 file changed, 3 insertions(+)
include/uapi/Kbuild +3 -0
index 61ee6e59c930..425ea8769ddc 100644
@@ -12,3 +12,6 @@ ifeq ($(wildcard $(objtree)/arch/$(SRCARCH)/include/generated/uapi/asm/kvm_para.
 no-export-headers += linux/kvm_para.h
 endif
 endif
+
+# API is not finalized
+no-export-headers += linux/user_events.h
Signature · 1 line
2.20.1
Signature · 1 line
Masami Hiramatsu <[email protected]>