Bug 38694 - Executable stack in mpeg2desc
Summary: Executable stack in mpeg2desc
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: dvdauthor (show other bugs)
Version: unstable
Hardware: x86_64 Linux
: P5 normal
Assignee: Yuri N. Sedunov
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-10 00:45 MSK by Dmitry V. Levin
Modified: 2020-07-10 16:45 MSK (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry V. Levin 2020-07-10 00:45:30 MSK
mpeg2desc.c:819:26: warning: trampoline generated for nested function 'bufread' [-Wtrampolines]
verify-elf: WARNING: ./usr/bin/mpeg2desc: found executable STACK entry:   GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RWE 0x10
Comment 1 Repository Robot 2020-07-10 14:14:17 MSK
dvdauthor-0.7.2-alt4 -> sisyphus:

 Fri Jul 10 2020 Yuri N. Sedunov <aris@altlinux> 0.7.2-alt4
 - updated to 0.7.2-9-gd5bb0bd
 - implemented "magick" knob (set to "graphicsmagick" by default)
 - built with "-z noexecstack" linker flags (ALT #38694)
Comment 2 Dmitry V. Levin 2020-07-10 14:31:11 MSK
(In reply to Repository Robot from comment #1)
> dvdauthor-0.7.2-alt4 -> sisyphus:
>  - built with "-z noexecstack" linker flags (ALT #38694)

Я прошу прощения, но если "trampoline generated for nested function 'bufread'" никуда не делось, не вызывает ли теперь этот код segfault?
Comment 3 Yuri N. Sedunov 2020-07-10 16:45:12 MSK
(Ответ для Dmitry V. Levin на комментарий #2)
> (In reply to Repository Robot from comment #1)
> > dvdauthor-0.7.2-alt4 -> sisyphus:
> >  - built with "-z noexecstack" linker flags (ALT #38694)
> 
> Я прошу прощения, но если "trampoline generated for nested function
> 'bufread'" никуда не делось, не вызывает ли теперь этот код segfault?

Уверенно вызывает. Виноват, поторопился подсмотрев у suse'й.
https://build.opensuse.org/package/show/openSUSE%3ALeap%3A15.2/dvdauthor

Посоветуете ли, что делать с этим куском кода в src/mpeg2desc.c?

812 #if defined(HAVE_NESTED_ROUTINES)
    813                 if (outputenglish && packetid >= MPID_VIDEO_FIRST && packetid <= MPID_VIDEO_LAST)
    814                   {
    815                   /* look inside PES packet to report on details of video packets */
    816                     unsigned int remaining = readlen;
    817                     jmp_buf resume;
    818                   /* GCC extension! nested routine */
    819                     void bufread(void *ptr, int len, bool required)
    820                       {
    821                         const unsigned int tocopy = remaining > len ? len : remaining;
    822                         if (tocopy != 0)
    823                           {
    824                             memcpy(ptr, buf + contentoffs, tocopy);
    825                             ptr = (unsigned char *)ptr + tocopy;
    826                             len -= tocopy;
    827                             contentoffs += tocopy;
    828                             remaining -= tocopy;
    829                             inputpos += tocopy;
    830                           } /*if*/
    831                         if (len != 0)
    832                           {
    833                           /* read more of packet */
    834                             const unsigned int toread = packetlen < len ? packetlen : len;
    835                             readinput(ptr, toread, required);
    836                             if (dowrite)
    837                               {
    838                                 writetostream(packetid, ptr, toread);
    839                               } /*if*/
    840                             packetlen -= toread;
    841                             len -= toread;
    842                             if (len != 0)
    843                               {
    844                                 if (false /*required*/)
    845                                   {
    846                                     fprintf(stderr, "Unexpected nested read EOF\n");
    847                                   } /*if*/
    848                                 longjmp(resume, 1);
    849                               } /*if*/
    850                           } /*if*/
    851                       } /*bufread*/
    852                     inputpos -= remaining; /* rewind to start of packet content */
    853                     if (!setjmp(resume))
    854                       {
    855                         process_packets(bufread, true);
    856                       } /*if*/
    857                   }
    858                 else
    859 #endif