Skip to contentSkip to conversation

cobalt: remove call to sigprocmask

PATCH In review Norbert Lange 3 participants 4 messages Jul 12, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cobalt: remove call to sigprocmask

sigprocmask should not be used in multithreaded applications, doing so is "unspecified".

---
 lib/cobalt/printf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/cobalt/printf.c +1 -1
index 7426f2bda..80db9516a 100644
@@ -647,7 +647,7 @@ static void spawn_printer_thread(void)
 	sigfillset(&sset);
 	pthread_sigmask(SIG_BLOCK, &sset, &oset);
 	pthread_create(&printer_thread, &thattr, printer_loop, NULL);
-	sigprocmask(SIG_SETMASK, &oset, NULL);
+	pthread_sigmask(SIG_SETMASK, &oset, NULL);
 	pthread_setname_np(printer_thread, "cobalt_printf");
 }
 
Signature · 1 line
2.20.1
#1 lore raw
Quoted 2 lines · Norbert Lange via Xenomai

sigprocmask should not be used in multithreaded applications, doing so is "unspecified".

Is this more than cosmetic on Linux? Then it should be documented here because we shipped the change in 3.0.9, and if that may have caused regressions, users should know.

Quoted 12 lines
---
 lib/cobalt/printf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/cobalt/printf.c +0 -0
index 7426f2bda..80db9516a 100644

lib/cobalt/printf.c static void spawn_printer_thread(void) · line 653

Quoted 8 lines
lib/cobalt/printf.c +1 -1
@@ -647,7 +647,7 @@ static void spawn_printer_thread(void)
 	sigfillset(&sset);
 	pthread_sigmask(SIG_BLOCK, &sset, &oset);
 	pthread_create(&printer_thread, &thattr, printer_loop, NULL);
-	sigprocmask(SIG_SETMASK, &oset, NULL);
+	pthread_sigmask(SIG_SETMASK, &oset, NULL);
 	pthread_setname_np(printer_thread, "cobalt_printf");
 }
 

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
#2 lore raw
Quoted 14 lines

-----Original Message-----
From: Xenomai <[email protected]> On Behalf Of Jan Kiszka via Xenomai
Sent: Freitag, 12. Juli 2019 15:07
To: Norbert Lange <[email protected]>; [email protected]
Subject: Re: [PATCH] cobalt: remove call to sigprocmask

E-MAIL FROM A NON-ANDRITZ SOURCE: AS A SECURITY MEASURE, PLEASE EXERCISE CAUTION WITH E-MAIL CONTENT AND ANY LINKS OR ATTACHMENTS.

Quoted 7 lines
Quoted 2 lines · Norbert Lange via Xenomai

sigprocmask should not be used in multithreaded applications, doing so is "unspecified".

Is this more than cosmetic on Linux? Then it should be documented here because we shipped the change in 3.0.9, and if that may have caused regressions, users should know.

There is no practical issue to be expected, AFAIK with NPTL at least.
The only issue could be, that libpthread is not pulled in (might need to run some setup), but that’s ensured with libcobalt.

Sorry for the mess, must have send a stale patch in the first place (always get problems with whitespace issues).

Norbert

________________________________

This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.

ANDRITZ HYDRO GmbH

Rechtsform/ Legal form: Gesellschaft mit beschränkter Haftung / Corporation

Firmensitz/ Registered seat: Wien

Firmenbuchgericht/ Court of registry: Handelsgericht Wien

Firmenbuchnummer/ Company registration: FN 61833 g

DVR: 0605077

UID-Nr.: ATU14756806

Thank You
________________________________

#3 lore raw
Quoted 18 lines · Lange Norbert via Xenomai
Quoted 18 lines

-----Original Message-----
From: Xenomai <[email protected]> On Behalf Of Jan Kiszka via Xenomai
Sent: Freitag, 12. Juli 2019 15:07
To: Norbert Lange <[email protected]>; [email protected]
Subject: Re: [PATCH] cobalt: remove call to sigprocmask

E-MAIL FROM A NON-ANDRITZ SOURCE: AS A SECURITY MEASURE, PLEASE EXERCISE CAUTION WITH E-MAIL CONTENT AND ANY LINKS OR ATTACHMENTS.

Quoted 2 lines · Norbert Lange via Xenomai

sigprocmask should not be used in multithreaded applications, doing so is "unspecified".

Quoted 6 lines
Quoted 3 lines

Is this more than cosmetic on Linux? Then it should be documented here because we shipped the change in 3.0.9, and if that may have caused regressions, users should know.

There is no practical issue to be expected, AFAIK with NPTL at least.
The only issue could be, that libpthread is not pulled in (might need to run some setup), but that’s ensured with libcobalt.

OK, applied to next. Will add to stable as well, just to avoid confusion.

Quoted 3 lines

Sorry for the mess, must have send a stale patch in the first place (always get problems with whitespace issues).

No problem.

Thanks,
Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux