public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] linux/semctl: fix SEM_STAT_ANY support [BZ #26637]
@ 2020-09-20 18:05 Dmitry V. Levin
  2020-09-25 11:51 ` Florian Weimer
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry V. Levin @ 2020-09-20 18:05 UTC (permalink / raw)
  To: libc-alpha

Handle SEM_STAT_ANY the same way as SEM_STAT so that the buffer argument
of SEM_STAT_ANY is properly passed to the kernel and back.

* sysdeps/unix/sysv/linux/semctl.c (semun64_to_ksemun64,
semun_to_semun64, __semctl, __semctl_mode16, __old_semctl): Handle
SEM_STAT_ANY.
---
 sysdeps/unix/sysv/linux/semctl.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c
index f131a26fc7..1cdabde8f2 100644
--- a/sysdeps/unix/sysv/linux/semctl.c
+++ b/sysdeps/unix/sysv/linux/semctl.c
@@ -102,6 +102,7 @@ semun64_to_ksemun64 (int cmd, union semun64 semun64,
       r.array = semun64.array;
       break;
     case SEM_STAT:
+    case SEM_STAT_ANY:
     case IPC_STAT:
     case IPC_SET:
       r.buf = buf;
@@ -150,6 +151,7 @@ __semctl64 (int semid, int semnum, int cmd, ...)
     case IPC_STAT:      /* arg.buf */
     case IPC_SET:
     case SEM_STAT:
+    case SEM_STAT_ANY:
     case IPC_INFO:      /* arg.__buf */
     case SEM_INFO:
       va_start (ap, cmd);
@@ -238,6 +240,7 @@ semun_to_semun64 (int cmd, union semun semun, struct __semid64_ds *semid64)
       r.array = semun.array;
       break;
     case SEM_STAT:
+    case SEM_STAT_ANY:
     case IPC_STAT:
     case IPC_SET:
       r.buf = semid64;
@@ -267,6 +270,7 @@ __semctl (int semid, int semnum, int cmd, ...)
     case IPC_STAT:      /* arg.buf */
     case IPC_SET:
     case SEM_STAT:
+    case SEM_STAT_ANY:
     case IPC_INFO:      /* arg.__buf */
     case SEM_INFO:
       va_start (ap, cmd);
@@ -321,6 +325,7 @@ __semctl_mode16 (int semid, int semnum, int cmd, ...)
     case IPC_STAT:      /* arg.buf */
     case IPC_SET:
     case SEM_STAT:
+    case SEM_STAT_ANY:
     case IPC_INFO:      /* arg.__buf */
     case SEM_INFO:
       va_start (ap, cmd);
@@ -354,6 +359,7 @@ __old_semctl (int semid, int semnum, int cmd, ...)
     case IPC_STAT:      /* arg.buf */
     case IPC_SET:
     case SEM_STAT:
+    case SEM_STAT_ANY:
     case IPC_INFO:      /* arg.__buf */
     case SEM_INFO:
       va_start (ap, cmd);
-- 
ldv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] linux/semctl: fix SEM_STAT_ANY support [BZ #26637]
  2020-09-20 18:05 [PATCH] linux/semctl: fix SEM_STAT_ANY support [BZ #26637] Dmitry V. Levin
@ 2020-09-25 11:51 ` Florian Weimer
  2020-09-25 17:12   ` Adhemerval Zanella
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2020-09-25 11:51 UTC (permalink / raw)
  To: Dmitry V. Levin; +Cc: libc-alpha

* Dmitry V. Levin:

> Handle SEM_STAT_ANY the same way as SEM_STAT so that the buffer argument
> of SEM_STAT_ANY is properly passed to the kernel and back.
>
> * sysdeps/unix/sysv/linux/semctl.c (semun64_to_ksemun64,
> semun_to_semun64, __semctl, __semctl_mode16, __old_semctl): Handle
> SEM_STAT_ANY.

As a stop-gap measure, this is okay, but we really need to reconsider
what we are doing here.  We really need to return EINVAL if we do not
recognize the cmd value.  It means patching glibc each time the system
call is enhanced, but I don't see a way around that.

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] linux/semctl: fix SEM_STAT_ANY support [BZ #26637]
  2020-09-25 11:51 ` Florian Weimer
@ 2020-09-25 17:12   ` Adhemerval Zanella
  0 siblings, 0 replies; 3+ messages in thread
From: Adhemerval Zanella @ 2020-09-25 17:12 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Dmitry V. Levin, GNU C Library

As a side note I am also working on this patch as well with BZ#26636
and BZ#26639
to add a regression test.

On Fri, Sep 25, 2020 at 8:51 AM Florian Weimer via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> * Dmitry V. Levin:
>
> > Handle SEM_STAT_ANY the same way as SEM_STAT so that the buffer argument
> > of SEM_STAT_ANY is properly passed to the kernel and back.
> >
> > * sysdeps/unix/sysv/linux/semctl.c (semun64_to_ksemun64,
> > semun_to_semun64, __semctl, __semctl_mode16, __old_semctl): Handle
> > SEM_STAT_ANY.
>
> As a stop-gap measure, this is okay, but we really need to reconsider
> what we are doing here.  We really need to return EINVAL if we do not
> recognize the cmd value.  It means patching glibc each time the system
> call is enhanced, but I don't see a way around that.
>
> Thanks,
> Florian
> --
> Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
> Commercial register: Amtsgericht Muenchen, HRB 153243,
> Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-25 17:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-20 18:05 [PATCH] linux/semctl: fix SEM_STAT_ANY support [BZ #26637] Dmitry V. Levin
2020-09-25 11:51 ` Florian Weimer
2020-09-25 17:12   ` Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).