* linux-evl 7.2 compilation without SMP
@ 2026-10-13 7:06 Martínek Petr
2026-11-11 9:11 ` Philippe Gerum
2026-11-11 11:53 ` linux-evl 7.2 OOB GPIO NULL dereference in lineevent_create Martínek Petr
0 siblings, 2 replies; 4+ messages in thread
From: Martínek Petr @ 2026-10-13 7:06 UTC (permalink / raw)
To: xenomai@lists.linux.dev
It is not possible to compile linux-evl 7.2 without SMP due to bad port of
include/linux/spinlock_api_up.h code and kernel/irq/pipeline.c
pipeline_percpu_data being inside define for SMP, while being used without it.
Included are patches to fix compilation.
Signed-off-by: Petr Martínek <petr.martinek@elvac.eu>
---
diff -Naur a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h
--- a/include/linux/spinlock_api_up.h 2026-09-23 08:39:20.000000000 +0200
+++ b/include/linux/spinlock_api_up.h 2026-10-08 14:21:40.410814000 +0200
@@ -62,22 +62,22 @@
do { local_irq_restore(flags); __UNLOCK(lock, ##__VA_ARGS__); } while (0)
#define __HARD_LOCK(lock) \
- do { ___LOCK_##__VA_ARGS__(lock); } while (0)
+ do { ___LOCK_(lock); } while (0)
#define __HARD_LOCK_IRQ(lock) \
- do { hard_local_irq_disable(); __HARD_LOCK(lock, ##__VA_ARGS__); } while (0)
+ do { hard_local_irq_disable(); __HARD_LOCK(lock); } while (0)
#define __HARD_LOCK_IRQSAVE(lock, flags) \
- do { flags = hard_local_irq_save(); __HARD_LOCK(lock, ##__VA_ARGS__); } while (0)
+ do { flags = hard_local_irq_save(); __HARD_LOCK(lock); } while (0)
#define __HARD_UNLOCK(lock) \
- do { ___UNLOCK_##__VA_ARGS__(lock); } while (0)
+ do { ___UNLOCK_(lock); } while (0)
#define __HARD_UNLOCK_IRQ(lock) \
- do { hard_local_irq_enable(); __HARD_UNLOCK(lock, ##__VA_ARGS__); } while (0)
+ do { hard_local_irq_enable(); __HARD_UNLOCK(lock); } while (0)
#define __HARD_UNLOCK_IRQRESTORE(lock, flags) \
- do { hard_local_irq_restore(flags); __HARD_UNLOCK(lock, ##__VA_ARGS__); } while (0)
+ do { hard_local_irq_restore(flags); __HARD_UNLOCK(lock); } while (0)
#define _raw_spin_lock(lock) __LOCK(lock)
#define _raw_spin_lock_nested(lock, subclass) __LOCK(lock)
diff -Naur a/kernel/irq/pipeline.c b/kernel/irq/pipeline.c
--- a/kernel/irq/pipeline.c 2026-09-23 08:39:20.000000000 +0200
+++ b/kernel/irq/pipeline.c 2026-10-08 14:30:08.315420000 +0200
@@ -75,6 +75,9 @@
unsigned long flat[IRQ_FLAT_MAPSZ];
};
+struct pipeline_percpu_data { };
+static DEFINE_PER_CPU(struct pipeline_percpu_data, pipeline_percpu_data);
+
#ifdef CONFIG_SMP
static struct irq_event_map bootup_irq_map __initdata;
@@ -92,9 +95,6 @@
},
};
-struct pipeline_percpu_data { };
-static DEFINE_PER_CPU(struct pipeline_percpu_data, pipeline_percpu_data);
-
static irqreturn_t smp_call_function_ipi_handler(int irq, void *dev_id)
{
smp_flush_oob_call_function_queue();
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: linux-evl 7.2 compilation without SMP
2026-10-13 7:06 linux-evl 7.2 compilation without SMP Martínek Petr
@ 2026-11-11 9:11 ` Philippe Gerum
2026-11-11 11:53 ` linux-evl 7.2 OOB GPIO NULL dereference in lineevent_create Martínek Petr
1 sibling, 0 replies; 4+ messages in thread
From: Philippe Gerum @ 2026-11-11 9:11 UTC (permalink / raw)
To: Martínek Petr; +Cc: xenomai@lists.linux.dev
Martínek Petr <petr.martinek@elvac.eu> writes:
> It is not possible to compile linux-evl 7.2 without SMP due to bad port of
> include/linux/spinlock_api_up.h code and kernel/irq/pipeline.c
> pipeline_percpu_data being inside define for SMP, while being used without it.
> Included are patches to fix compilation.
>
> Signed-off-by: Petr Martínek <petr.martinek@elvac.eu>
> ---
> diff -Naur a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h
> --- a/include/linux/spinlock_api_up.h 2026-09-23 08:39:20.000000000 +0200
> +++ b/include/linux/spinlock_api_up.h 2026-10-08 14:21:40.410814000 +0200
> @@ -62,22 +62,22 @@
> do { local_irq_restore(flags); __UNLOCK(lock, ##__VA_ARGS__); } while (0)
>
> #define __HARD_LOCK(lock) \
> - do { ___LOCK_##__VA_ARGS__(lock); } while (0)
> + do { ___LOCK_(lock); } while (0)
>
> #define __HARD_LOCK_IRQ(lock) \
> - do { hard_local_irq_disable(); __HARD_LOCK(lock, ##__VA_ARGS__); } while (0)
> + do { hard_local_irq_disable(); __HARD_LOCK(lock); } while (0)
>
> #define __HARD_LOCK_IRQSAVE(lock, flags) \
> - do { flags = hard_local_irq_save(); __HARD_LOCK(lock, ##__VA_ARGS__); } while (0)
> + do { flags = hard_local_irq_save(); __HARD_LOCK(lock); } while (0)
>
> #define __HARD_UNLOCK(lock) \
> - do { ___UNLOCK_##__VA_ARGS__(lock); } while (0)
> + do { ___UNLOCK_(lock); } while (0)
>
> #define __HARD_UNLOCK_IRQ(lock) \
> - do { hard_local_irq_enable(); __HARD_UNLOCK(lock, ##__VA_ARGS__); } while (0)
> + do { hard_local_irq_enable(); __HARD_UNLOCK(lock); } while (0)
>
> #define __HARD_UNLOCK_IRQRESTORE(lock, flags) \
> - do { hard_local_irq_restore(flags); __HARD_UNLOCK(lock, ##__VA_ARGS__); } while (0)
> + do { hard_local_irq_restore(flags); __HARD_UNLOCK(lock); } while (0)
>
> #define _raw_spin_lock(lock) __LOCK(lock)
> #define _raw_spin_lock_nested(lock, subclass) __LOCK(lock)
> diff -Naur a/kernel/irq/pipeline.c b/kernel/irq/pipeline.c
> --- a/kernel/irq/pipeline.c 2026-09-23 08:39:20.000000000 +0200
> +++ b/kernel/irq/pipeline.c 2026-10-08 14:30:08.315420000 +0200
> @@ -75,6 +75,9 @@
> unsigned long flat[IRQ_FLAT_MAPSZ];
> };
>
> +struct pipeline_percpu_data { };
> +static DEFINE_PER_CPU(struct pipeline_percpu_data, pipeline_percpu_data);
> +
> #ifdef CONFIG_SMP
>
> static struct irq_event_map bootup_irq_map __initdata;
> @@ -92,9 +95,6 @@
> },
> };
>
> -struct pipeline_percpu_data { };
> -static DEFINE_PER_CPU(struct pipeline_percpu_data, pipeline_percpu_data);
> -
> static irqreturn_t smp_call_function_ipi_handler(int irq, void *dev_id)
> {
> smp_flush_oob_call_function_queue();
This one slipped through the cracks. Merged, thanks.
--
Philippe.
^ permalink raw reply [flat|nested] 4+ messages in thread* linux-evl 7.2 OOB GPIO NULL dereference in lineevent_create
2026-10-13 7:06 linux-evl 7.2 compilation without SMP Martínek Petr
2026-11-11 9:11 ` Philippe Gerum
@ 2026-11-11 11:53 ` Martínek Petr
2026-11-12 14:20 ` Philippe Gerum
1 sibling, 1 reply; 4+ messages in thread
From: Martínek Petr @ 2026-11-11 11:53 UTC (permalink / raw)
To: xenomai@lists.linux.dev
In lineevent_create le->oob_state is used after retain_and_null_ptr(le)
which set le to NULL. Included patch adds oob_state variable
to fix this.
Signed-off-by: Petr Martínek <petr.martinek@elvac.eu>
---
diff -Naur a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
--- a/drivers/gpio/gpiolib-cdev.c 2026-09-23 08:39:20.000000000 +0200
+++ b/drivers/gpio/gpiolib-cdev.c 2026-11-11 10:25:07.714465106 +0100
@@ -2222,6 +2222,7 @@
{
struct gpioevent_request eventreq;
struct lineevent_state *le __free(lineevent_free) = NULL;
+ struct lineevent_oob_state* oob_state;
struct gpio_desc *desc;
u32 offset;
u32 lflags;
@@ -2340,10 +2341,12 @@
O_RDONLY | O_CLOEXEC));
if (fdf.err)
return fdf.err;
+
+ oob_state = &le->oob_state;
retain_and_null_ptr(le);
if (oob_handling_requested(lflags)) {
- ret = evl_open_file(&le->oob_state.efile, fd_prepare_file(fdf));
+ ret = evl_open_file(&oob_state->efile, fd_prepare_file(fdf));
if (ret)
return ret;
}
@@ -2351,7 +2354,7 @@
eventreq.fd = fd_prepare_fd(fdf);
if (copy_to_user(ip, &eventreq, sizeof(eventreq))) {
if (oob_handling_requested(lflags))
- evl_release_file(&le->oob_state.efile);
+ evl_release_file(&oob_state->efile);
return -EFAULT;
}
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: linux-evl 7.2 OOB GPIO NULL dereference in lineevent_create
2026-11-11 11:53 ` linux-evl 7.2 OOB GPIO NULL dereference in lineevent_create Martínek Petr
@ 2026-11-12 14:20 ` Philippe Gerum
0 siblings, 0 replies; 4+ messages in thread
From: Philippe Gerum @ 2026-11-12 14:20 UTC (permalink / raw)
To: Martínek Petr; +Cc: xenomai@lists.linux.dev
Martínek Petr <petr.martinek@elvac.eu> writes:
> In lineevent_create le->oob_state is used after retain_and_null_ptr(le)
> which set le to NULL. Included patch adds oob_state variable
> to fix this.
>
> Signed-off-by: Petr Martínek <petr.martinek@elvac.eu>
> ---
> diff -Naur a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
> --- a/drivers/gpio/gpiolib-cdev.c 2026-09-23 08:39:20.000000000 +0200
> +++ b/drivers/gpio/gpiolib-cdev.c 2026-11-11 10:25:07.714465106 +0100
> @@ -2222,6 +2222,7 @@
> {
> struct gpioevent_request eventreq;
> struct lineevent_state *le __free(lineevent_free) = NULL;
> + struct lineevent_oob_state* oob_state;
> struct gpio_desc *desc;
> u32 offset;
> u32 lflags;
> @@ -2340,10 +2341,12 @@
> O_RDONLY | O_CLOEXEC));
> if (fdf.err)
> return fdf.err;
> +
> + oob_state = &le->oob_state;
> retain_and_null_ptr(le);
>
> if (oob_handling_requested(lflags)) {
> - ret = evl_open_file(&le->oob_state.efile, fd_prepare_file(fdf));
> + ret = evl_open_file(&oob_state->efile, fd_prepare_file(fdf));
> if (ret)
> return ret;
> }
> @@ -2351,7 +2354,7 @@
> eventreq.fd = fd_prepare_fd(fdf);
> if (copy_to_user(ip, &eventreq, sizeof(eventreq))) {
> if (oob_handling_requested(lflags))
> - evl_release_file(&le->oob_state.efile);
> + evl_release_file(&oob_state->efile);
> return -EFAULT;
> }
>
Merged, thanks.
--
Philippe.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-12 14:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 7:06 linux-evl 7.2 compilation without SMP Martínek Petr
2026-11-11 9:11 ` Philippe Gerum
2026-11-11 11:53 ` linux-evl 7.2 OOB GPIO NULL dereference in lineevent_create Martínek Petr
2026-11-12 14:20 ` Philippe Gerum
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.