[SRU] nginx segfault when adding add_header in configuration

Bug #1264674 reported by Timo Witte
36
This bug affects 6 people
Affects Status Importance Assigned to Milestone
nginx (Debian)
Fix Released
Unknown
nginx (Ubuntu)
Fix Released
Undecided
Unassigned
Saucy
Fix Released
Undecided
Unassigned

Bug Description

[Impact]

There is a segmentation fault bug in the nginx-auth-pam module that exists for nginx-extras. It usually happens when you are adding a header via the nginx configuration option `add_header`, however this is actually a bug in the nginx-auth-pam module.

[Test Case]

Use `add_header Via "1.1 keys.example.org:80 (nginx)";` or similar Via header with a proxy_pass while using nginx-extras. This typically will end up with a segmentation fault.

Using the attached debdiff, which applies an upstream fix for this, you will not encounter a segmentation fault.

(A more detailed test case is unavailable, however there are example configurations and situations where this can trigger on the Debian bug)

[Regression Potential]

According to the upstream commit:

"ngx_module_t commands array should end with a ngx_null_command."

There should be no regression risk for this as the module is supposed to end with the command, but previously did not.

[Other Info]

This was test-built inside Saucy sbuild chroots for i386 and amd64 without incident by myself.

[Original Description]

Please see bug http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=721702 would be nice if we can update nginx in saucy, so this bug no longer persists!

Changed in nginx (Debian):
status: Unknown → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in nginx (Ubuntu):
status: New → Confirmed
Revision history for this message
Kálmán, Ferenc (fkalman) wrote :

This bug is only persists in package nginx-extras, ngnix(-full) is working properly.

Revision history for this message
Kálmán, Ferenc (fkalman) wrote :

This bug is only exists in package nginx-extras, ngnix(-full) is working properly. (Sorry)

Revision history for this message
Raoul Bhatia (raoul-bhatia) wrote :

ack for nginx-extra

gdb backtrace:

root@www /etc/nginx # gdb nginx
GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/sbin/nginx...Reading symbols from /usr/lib/debug/usr/sbin/nginx...done.
done.
(gdb) run -t
Starting program: /usr/sbin/nginx -t
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
__strcmp_sse2 () at ../sysdeps/x86_64/multiarch/../strcmp.S:213
213 ../sysdeps/x86_64/multiarch/../strcmp.S: No such file or directory.
(gdb) bt
#0 __strcmp_sse2 () at ../sysdeps/x86_64/multiarch/../strcmp.S:213
#1 0x0000000000428be1 in ngx_conf_handler (last=0, cf=0x7fffffffe1e0) at src/core/ngx_conf_file.c:305
#2 ngx_conf_parse (cf=cf@entry=0x7fffffffe1e0, filename=filename@entry=0x0) at src/core/ngx_conf_file.c:243
#3 0x0000000000445d8b in ngx_http_core_server (cf=0x7fffffffe1e0, cmd=<optimized out>, dummy=<optimized out>) at src/http/ngx_http_core_module.c:3009
#4 0x0000000000428d1a in ngx_conf_handler (last=1, cf=0x7fffffffe1e0) at src/core/ngx_conf_file.c:387
#5 ngx_conf_parse (cf=cf@entry=0x7fffffffe1e0, filename=filename@entry=0x7fffffffdb70) at src/core/ngx_conf_file.c:243
#6 0x0000000000429115 in ngx_conf_include (cf=0x7fffffffe1e0, cmd=<optimized out>, conf=<optimized out>) at src/core/ngx_conf_file.c:783
#7 0x0000000000428d1a in ngx_conf_handler (last=0, cf=0x7fffffffe1e0) at src/core/ngx_conf_file.c:387
#8 ngx_conf_parse (cf=cf@entry=0x7fffffffe1e0, filename=filename@entry=0x0) at src/core/ngx_conf_file.c:243
#9 0x0000000000440e92 in ngx_http_block (cf=0x7fffffffe1e0, cmd=<optimized out>, conf=<optimized out>) at src/http/ngx_http.c:239
#10 0x0000000000428d1a in ngx_conf_handler (last=1, cf=0x7fffffffe1e0) at src/core/ngx_conf_file.c:387
#11 ngx_conf_parse (cf=cf@entry=0x7fffffffe1e0, filename=filename@entry=0x7767c0) at src/core/ngx_conf_file.c:243
#12 0x00000000004265d9 in ngx_init_cycle (old_cycle=old_cycle@entry=0x7fffffffe390) at src/core/ngx_cycle.c:268
#13 0x000000000041841a in main (argc=<optimized out>, argv=<optimized out>) at src/core/nginx.c:333
(gdb)

Revision history for this message
Thomas Ward (teward) wrote :

Which Ubuntu releases are affected by this? Just Saucy?

Revision history for this message
Thomas Ward (teward) wrote :

Based on the Debian bug, and these lines on it, only Saucy is impacted at this time, but this fix has been released in Trusty already (1.4.4 is in Trusty):

Found in version nginx/1.4.1-3
Fixed in version nginx/1.4.3-1

------

To that end, I'm marking this 'Fix Released' and nominating it for Saucy, in preparation to get an SRU ready for this.

NOTE: I know that this is not yet fixed in Saucy. Triage procedure requires me to mark this as affecting Saucy and mark this "Fix Released" against the Ubuntu development release (Trusty) since this is already fixed there.

Changed in nginx (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Thomas Ward (teward) wrote :

In order to facilitate my ease of finding this patch between reboots, the link to the Debian commit that fixes this is located here:

http://anonscm.debian.org/gitweb/?p=collab-maint/nginx.git;a=commitdiff;h=bdf157e88

I'll nitpick the specific changes later.

Thomas Ward (teward)
Changed in nginx (Ubuntu Saucy):
status: New → Confirmed
Thomas Ward (teward)
Changed in nginx (Ubuntu Saucy):
status: Confirmed → In Progress
assignee: nobody → Thomas Ward (teward)
Revision history for this message
Thomas Ward (teward) wrote :

Attached here is a debdiff containing a fix for this. It is derived from upstream changes.

Please let me know if I'm missing something in this debdiff.

Changed in nginx (Ubuntu Saucy):
assignee: Thomas Ward (teward) → nobody
status: In Progress → Triaged
Revision history for this message
Robie Basak (racb) wrote :

I coommented on IRC - don't know if you missed it.

09:10 <rbasak> teward: the debdiff in bug 1264674 looks fine. But before I
               test/sponsor, could you complete the SRU justification please?

Revision history for this message
Thomas Ward (teward) wrote :

Knew I forgot something.

Was at work, robie, I'll add the SRU justification shortly, after dinner.

Thomas Ward (teward)
description: updated
Revision history for this message
Peter Waller (peter.waller) wrote :

This bug says "fix released" but it isn't actually updating on my machine. How is this? nginx won't currently start - when is this going to be fixed?!

Revision history for this message
Thomas Ward (teward) wrote :

If you read the comment on the bug where I changed this (Comment 6) you'll see that it's Fix Releaded against Trusty. Also, if you look at the top of the bug, it's Triaged for Saucy, pending a sponsor to upload the fix to the saucy-proposed repository.

Thomas Ward (teward)
summary: - nginx segfault when adding add_header in configuration
+ [SRU] nginx segfault when adding add_header in configuration
Revision history for this message
Robie Basak (racb) wrote :

Uploaded. Thanks!

Now awaiting SRU team review.

Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Timo, or anyone else affected,

Accepted nginx into saucy-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/nginx/1.4.1-3ubuntu1.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in nginx (Ubuntu Saucy):
status: Triaged → Fix Committed
tags: added: verification-needed
Revision history for this message
Thomas Ward (teward) wrote :

Due to some issue that isn't explained anywhere, the i386 build for this failed to upload. If you are testing this on a 32-bit release of Ubuntu, you will not be able to test or verify this.

I poked William Grant (wgrant) on IRC in #launchpad to debug this, and they said it seems it was a Launchpad network glitch. They also poked the build to get it to build and upload. When that's done you will be able to test this on 32-bit systems. All other architectures should be fine for testing, based on the information at this page: https://launchpad.net/ubuntu/+source/nginx/1.4.1-3ubuntu1.2

Revision history for this message
Thomas Ward (teward) wrote :

The i386 (32bit) nginx package has now built and uploaded successfully this time, so you can test on 32bit too, if you wish. (this is a followup to my previous comment in #15)

Revision history for this message
Kálmán, Ferenc (fkalman) wrote :

I have tested nginx-extras_1.4.1-3ubuntu1.2 package and it worked fine.

Revision history for this message
Kálmán, Ferenc (fkalman) wrote :

I have only tested amd64.

Revision history for this message
Thomas Ward (teward) wrote :

Tagged verification-done since fkalman tested this and it worked.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for nginx has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package nginx - 1.4.1-3ubuntu1.2

---------------
nginx (1.4.1-3ubuntu1.2) saucy; urgency=low

  * Apply upstream changes to fix a segmentation fault in the third-party
    ngx_auth_pam module in nginx-full and nginx-extras. (LP: #1264674)
 -- Thomas Ward <email address hidden> Sun, 09 Feb 2014 21:14:14 -0500

Changed in nginx (Ubuntu Saucy):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.